@b3dotfun/sdk 0.0.40-alpha.2 → 0.0.40-alpha.21

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 (181) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +10 -1
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +8 -4
  3. package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +0 -1
  4. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +0 -1
  5. package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +1 -0
  6. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +26 -10
  7. package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +2 -1
  8. package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
  9. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +0 -1
  10. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
  11. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +6 -3
  12. package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +0 -1
  13. package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +5 -3
  14. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
  15. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +9 -9
  16. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
  17. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
  18. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +40 -37
  19. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +8 -8
  20. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
  21. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +23 -9
  22. package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  23. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +10 -6
  24. package/dist/cjs/anyspend/react/components/common/PointsBadge.d.ts +7 -0
  25. package/dist/cjs/anyspend/react/components/common/PointsBadge.js +7 -0
  26. package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
  27. package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +14 -0
  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 +1 -0
  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 +11 -1
  37. package/dist/cjs/anyspend/utils/orderPayload.js +1 -0
  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 +4 -3
  53. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +35 -9
  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/useAuthentication.js +1 -2
  58. package/dist/cjs/global-account/react/hooks/useSimBalance.js +2 -2
  59. package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +22 -20
  60. package/dist/esm/anyspend/react/components/AnySpend.d.ts +10 -1
  61. package/dist/esm/anyspend/react/components/AnySpend.js +8 -4
  62. package/dist/esm/anyspend/react/components/AnySpendBondKit.js +0 -1
  63. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +0 -1
  64. package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +1 -0
  65. package/dist/esm/anyspend/react/components/AnySpendCustom.js +26 -10
  66. package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +2 -1
  67. package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
  68. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +0 -1
  69. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
  70. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +6 -3
  71. package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +0 -1
  72. package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +6 -4
  73. package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
  74. package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +9 -9
  75. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
  76. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
  77. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +40 -37
  78. package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -8
  79. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
  80. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +23 -9
  81. package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  82. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +10 -6
  83. package/dist/esm/anyspend/react/components/common/PointsBadge.d.ts +7 -0
  84. package/dist/esm/anyspend/react/components/common/PointsBadge.js +4 -0
  85. package/dist/esm/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
  86. package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +8 -0
  87. package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
  88. package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.js +17 -0
  89. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
  90. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +1 -0
  91. package/dist/esm/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
  92. package/dist/esm/anyspend/react/providers/AnyspendProvider.js +5 -3
  93. package/dist/esm/anyspend/react/providers/index.d.ts +1 -0
  94. package/dist/esm/anyspend/react/providers/index.js +1 -0
  95. package/dist/esm/anyspend/types/api.d.ts +11 -1
  96. package/dist/esm/anyspend/utils/orderPayload.js +1 -0
  97. package/dist/esm/bondkit/bondkitToken.d.ts +37 -2
  98. package/dist/esm/bondkit/bondkitToken.js +268 -2
  99. package/dist/esm/bondkit/bondkitTokenFactory.d.ts +1 -1
  100. package/dist/esm/bondkit/bondkitTokenFactory.js +2 -2
  101. package/dist/esm/bondkit/config.d.ts +1 -1
  102. package/dist/esm/bondkit/config.js +5 -2
  103. package/dist/esm/bondkit/constants.d.ts +4 -0
  104. package/dist/esm/bondkit/constants.js +5 -0
  105. package/dist/esm/bondkit/index.d.ts +1 -0
  106. package/dist/esm/bondkit/index.js +2 -0
  107. package/dist/esm/bondkit/swapService.d.ts +43 -0
  108. package/dist/esm/bondkit/swapService.js +369 -0
  109. package/dist/esm/bondkit/types.d.ts +10 -4
  110. package/dist/esm/bondkit/types.js +4 -5
  111. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +4 -3
  112. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +36 -9
  113. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +65 -5
  114. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
  115. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -2
  116. package/dist/esm/global-account/react/hooks/useAuthentication.js +1 -2
  117. package/dist/esm/global-account/react/hooks/useSimBalance.js +2 -2
  118. package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +22 -20
  119. package/dist/styles/index.css +1 -1
  120. package/dist/types/anyspend/react/components/AnySpend.d.ts +10 -1
  121. package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +1 -0
  122. package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +2 -1
  123. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
  124. package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
  125. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
  126. package/dist/types/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
  127. package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  128. package/dist/types/anyspend/react/components/common/PointsBadge.d.ts +7 -0
  129. package/dist/types/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
  130. package/dist/types/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
  131. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
  132. package/dist/types/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
  133. package/dist/types/anyspend/react/providers/index.d.ts +1 -0
  134. package/dist/types/anyspend/types/api.d.ts +11 -1
  135. package/dist/types/bondkit/bondkitToken.d.ts +37 -2
  136. package/dist/types/bondkit/bondkitTokenFactory.d.ts +1 -1
  137. package/dist/types/bondkit/config.d.ts +1 -1
  138. package/dist/types/bondkit/constants.d.ts +4 -0
  139. package/dist/types/bondkit/index.d.ts +1 -0
  140. package/dist/types/bondkit/swapService.d.ts +43 -0
  141. package/dist/types/bondkit/types.d.ts +10 -4
  142. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +4 -3
  143. package/package.json +6 -5
  144. package/src/anyspend/react/components/AnySpend.tsx +24 -1
  145. package/src/anyspend/react/components/AnySpendBondKit.tsx +0 -1
  146. package/src/anyspend/react/components/AnySpendBuySpin.tsx +0 -1
  147. package/src/anyspend/react/components/AnySpendCustom.tsx +55 -13
  148. package/src/anyspend/react/components/AnySpendNFT.tsx +3 -0
  149. package/src/anyspend/react/components/AnySpendStakeB3.tsx +0 -1
  150. package/src/anyspend/react/components/AnyspendDepositHype.tsx +22 -0
  151. package/src/anyspend/react/components/AnyspendSignatureMint.tsx +0 -1
  152. package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +7 -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 +61 -45
  156. package/src/anyspend/react/components/common/OrderDetails.tsx +8 -9
  157. package/src/anyspend/react/components/common/OrderTokenAmount.tsx +28 -8
  158. package/src/anyspend/react/components/common/PanelOnramp.tsx +28 -15
  159. package/src/anyspend/react/components/common/PointsBadge.tsx +20 -0
  160. package/src/anyspend/react/components/common/PointsDetailPanel.tsx +55 -0
  161. package/src/anyspend/react/contexts/FeatureFlagsContext.tsx +34 -0
  162. package/src/anyspend/react/hooks/useAnyspendFlow.ts +1 -0
  163. package/src/anyspend/react/providers/AnyspendProvider.tsx +11 -6
  164. package/src/anyspend/react/providers/index.ts +1 -0
  165. package/src/anyspend/types/api.ts +11 -1
  166. package/src/anyspend/types/api_req_res.ts +6 -10
  167. package/src/anyspend/utils/orderPayload.ts +1 -0
  168. package/src/bondkit/bondkitToken.ts +323 -3
  169. package/src/bondkit/bondkitTokenFactory.ts +2 -2
  170. package/src/bondkit/config.ts +5 -2
  171. package/src/bondkit/constants.ts +7 -0
  172. package/src/bondkit/index.ts +3 -0
  173. package/src/bondkit/swapService.ts +461 -0
  174. package/src/bondkit/types.ts +12 -5
  175. package/src/global-account/react/components/B3Provider/B3Provider.tsx +51 -15
  176. package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +106 -32
  177. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +60 -5
  178. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +4 -2
  179. package/src/global-account/react/hooks/useAuthentication.ts +1 -2
  180. package/src/global-account/react/hooks/useSimBalance.ts +2 -2
  181. package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +23 -21
@@ -507,7 +507,7 @@ export interface paths {
507
507
  * @description Type of trade execution
508
508
  * @enum {string}
509
509
  */
510
- tradeType: "EXACT_INPUT" | "EXPECTED_OUTPUT" | "EXACT_OUTPUT";
510
+ tradeType: "EXACT_INPUT" | "EXACT_OUTPUT";
511
511
  /**
512
512
  * @description Amount to quote
513
513
  * @example 1000000000000000000
@@ -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
+ }
@@ -1,13 +1,12 @@
1
1
  import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
2
+ import "@reservoir0x/relay-kit-ui/styles.css";
2
3
  import { Account } from "thirdweb/wallets";
3
4
  import { ClientType } from "../../../client-manager";
4
5
  import { B3ContextType } from "./types";
5
- import "@reservoir0x/relay-kit-ui/styles.css";
6
- export declare const wagmiConfig: import("wagmi").Config<readonly [import("viem").Chain, ...import("viem").Chain[]], any, readonly import("wagmi").CreateConnectorFn[]>;
7
6
  /**
8
7
  * Main B3Provider component
9
8
  */
10
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, }: {
9
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, rpcUrls, partnerId, }: {
11
10
  theme: "light" | "dark";
12
11
  children: React.ReactNode;
13
12
  accountOverride?: Account;
@@ -19,6 +18,8 @@ export declare function B3Provider({ theme, children, accountOverride, environme
19
18
  style?: React.CSSProperties;
20
19
  };
21
20
  clientType?: ClientType;
21
+ rpcUrls?: Record<number, string>;
22
+ partnerId?: string;
22
23
  }): import("react/jsx-runtime").JSX.Element;
23
24
  /**
24
25
  * Inner provider component that provides the actual B3Context
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.40-alpha.2",
3
+ "version": "0.0.40-alpha.21",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -241,8 +241,8 @@
241
241
  "@b3dotfun/basement-api": "0.0.11",
242
242
  "@feathersjs/authentication-client": "5.0.33",
243
243
  "@feathersjs/feathers": "5.0.33",
244
- "@feathersjs/socketio-client": "5.0.33",
245
244
  "@feathersjs/rest-client": "5.0.33",
245
+ "@feathersjs/socketio-client": "5.0.33",
246
246
  "@feathersjs/typebox": "5.0.33",
247
247
  "@fingerprintjs/fingerprintjs-pro-react": "^2.7.0",
248
248
  "@hey-api/client-fetch": "0.8.3",
@@ -261,6 +261,7 @@
261
261
  "@solana/web3.js": "^1.98.2",
262
262
  "@stripe/react-stripe-js": "^3.7.0",
263
263
  "@stripe/stripe-js": "^7.3.1",
264
+ "@thirdweb-dev/wagmi-adapter": "^0.2.141",
264
265
  "@web3icons/react": "3.16.0",
265
266
  "big.js": "^7.0.1",
266
267
  "class-variance-authority": "0.7.0",
@@ -329,10 +330,10 @@
329
330
  "react": "^18.0.0 || ^19.0.0",
330
331
  "react-dom": "^18.0.0 || ^19.0.0",
331
332
  "react-native-mmkv": "^3.2.0",
332
- "thirdweb": "^5.105.20",
333
+ "thirdweb": "5.106.0",
333
334
  "three": "^0.175.0",
334
- "wagmi": "^2.14.15",
335
- "viem": "^2.28.1"
335
+ "viem": "^2.28.1",
336
+ "wagmi": "^2.14.15"
336
337
  },
337
338
  "peerDependenciesMeta": {
338
339
  "@react-three/postprocessing": {
@@ -40,6 +40,7 @@ import { OrderDetails, OrderDetailsLoadingView } from "./common/OrderDetails";
40
40
  import { OrderHistory } from "./common/OrderHistory";
41
41
  import { PanelOnramp } from "./common/PanelOnramp";
42
42
  import { PanelOnrampPayment } from "./common/PanelOnrampPayment";
43
+ import { PointsDetailPanel } from "./common/PointsDetailPanel";
43
44
  import { RecipientSelection } from "./common/RecipientSelection";
44
45
  import { TabSection } from "./common/TabSection";
45
46
 
@@ -59,6 +60,7 @@ export enum PanelView {
59
60
  RECIPIENT_SELECTION,
60
61
  CRYPTO_PAYMENT_METHOD,
61
62
  FIAT_PAYMENT_METHOD,
63
+ POINTS_DETAIL,
62
64
  }
63
65
 
64
66
  const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
@@ -71,6 +73,11 @@ export function AnySpend(props: {
71
73
  recipientAddress?: string;
72
74
  loadOrder?: string;
73
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;
74
81
  }) {
75
82
  const fingerprintConfig = getFingerprintConfig();
76
83
 
@@ -89,6 +96,7 @@ function AnySpendInner({
89
96
  loadOrder,
90
97
  hideTransactionHistoryButton,
91
98
  recipientAddress: recipientAddressFromProps,
99
+ onTokenSelect,
92
100
  }: {
93
101
  destinationTokenAddress?: string;
94
102
  destinationTokenChainId?: number;
@@ -97,6 +105,7 @@ function AnySpendInner({
97
105
  loadOrder?: string;
98
106
  hideTransactionHistoryButton?: boolean;
99
107
  recipientAddress?: string;
108
+ onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
100
109
  }) {
101
110
  const searchParams = useSearchParamsSSR();
102
111
  const router = useRouter();
@@ -437,7 +446,7 @@ function AnySpendInner({
437
446
  srcTokenAddress: selectedSrcToken.address,
438
447
  dstTokenAddress: isBuyMode ? destinationTokenAddress : selectedDstToken.address,
439
448
  type: "swap",
440
- tradeType: isSrcInputDirty ? "EXACT_INPUT" : "EXPECTED_OUTPUT",
449
+ tradeType: isSrcInputDirty ? "EXACT_INPUT" : "EXACT_OUTPUT",
441
450
  amount: activeInputAmountInWei,
442
451
  }
443
452
  : {
@@ -869,6 +878,7 @@ function AnySpendInner({
869
878
  selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
870
879
  onSelectCryptoPaymentMethod={() => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD)}
871
880
  anyspendQuote={anyspendQuote}
881
+ onTokenSelect={onTokenSelect}
872
882
  />
873
883
  ) : (
874
884
  <motion.div
@@ -890,6 +900,8 @@ function AnySpendInner({
890
900
  fiatPaymentMethodIndex={PanelView.FIAT_PAYMENT_METHOD}
891
901
  recipientSelectionPanelIndex={PanelView.RECIPIENT_SELECTION}
892
902
  hideDstToken={isBuyMode}
903
+ anyspendQuote={anyspendQuote}
904
+ onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
893
905
  />
894
906
  </motion.div>
895
907
  )}
@@ -949,6 +961,7 @@ function AnySpendInner({
949
961
  setDstAmount(value);
950
962
  }}
951
963
  anyspendQuote={anyspendQuote}
964
+ onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
952
965
  />
953
966
  )}
954
967
  </div>
@@ -1060,6 +1073,13 @@ function AnySpendInner({
1060
1073
  />
1061
1074
  );
1062
1075
 
1076
+ const pointsDetailView = (
1077
+ <PointsDetailPanel
1078
+ pointsAmount={anyspendQuote?.data?.pointsAmount || 0}
1079
+ onBack={() => setActivePanel(PanelView.MAIN)}
1080
+ />
1081
+ );
1082
+
1063
1083
  // Add tabs to the main component when no order is loaded
1064
1084
  return (
1065
1085
  <StyleRoot>
@@ -1115,6 +1135,9 @@ function AnySpendInner({
1115
1135
  <div key="fiat-payment-method-view" className={cn(mode === "page" && "p-6")}>
1116
1136
  {fiatPaymentMethodView}
1117
1137
  </div>,
1138
+ <div key="points-detail-view" className={cn(mode === "page" && "p-6")}>
1139
+ {pointsDetailView}
1140
+ </div>,
1118
1141
  ]}
1119
1142
  </TransitionPanel>
1120
1143
  </div>
@@ -366,7 +366,6 @@ export function AnySpendBondKit({
366
366
  contractAddress={contractAddress}
367
367
  encodedData={encodedData}
368
368
  metadata={{
369
- type: "custom",
370
369
  action: "BondKit Buy",
371
370
  }}
372
371
  header={header}
@@ -675,7 +675,6 @@ export function AnySpendBuySpin({
675
675
  spenderAddress={paymentConfig.entryModule}
676
676
  encodedData={encodedData}
677
677
  metadata={{
678
- type: "custom",
679
678
  action: `buy ${userSpinQuantity} spin${userSpinQuantity !== "1" ? "s" : ""}`,
680
679
  }}
681
680
  header={header}
@@ -42,12 +42,15 @@ import { motion } from "motion/react";
42
42
  import React, { useCallback, useEffect, useMemo, useState } from "react";
43
43
  import { toast } from "sonner";
44
44
  import { base } from "viem/chains";
45
+ import { useFeatureFlags } from "../contexts/FeatureFlagsContext";
45
46
  import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper";
46
47
  import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod";
47
48
  import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
48
49
  import { OrderDetails } from "./common/OrderDetails";
49
50
  import { OrderHistory } from "./common/OrderHistory";
50
51
  import { OrderToken } from "./common/OrderToken";
52
+ import { PointsBadge } from "./common/PointsBadge";
53
+ import { PointsDetailPanel } from "./common/PointsDetailPanel";
51
54
  import { RecipientSelection } from "./common/RecipientSelection";
52
55
 
53
56
  enum PanelView {
@@ -58,6 +61,7 @@ enum PanelView {
58
61
  RECIPIENT_SELECTION,
59
62
  CRYPTO_PAYMENT_METHOD,
60
63
  FIAT_PAYMENT_METHOD,
64
+ POINTS_DETAIL,
61
65
  }
62
66
 
63
67
  function generateGetRelayQuoteRequest({
@@ -165,6 +169,7 @@ export function AnySpendCustom(props: {
165
169
  }) => React.JSX.Element;
166
170
  onSuccess?: (txHash?: string) => void;
167
171
  showRecipient?: boolean;
172
+ onShowPointsDetail?: () => void;
168
173
  }) {
169
174
  const fingerprintConfig = getFingerprintConfig();
170
175
 
@@ -191,6 +196,7 @@ function AnySpendCustomInner({
191
196
  header,
192
197
  onSuccess,
193
198
  showRecipient = true,
199
+ onShowPointsDetail,
194
200
  }: {
195
201
  loadOrder?: string;
196
202
  mode?: "modal" | "page";
@@ -213,8 +219,10 @@ function AnySpendCustomInner({
213
219
  }) => React.JSX.Element;
214
220
  onSuccess?: (txHash?: string) => void;
215
221
  showRecipient?: boolean;
222
+ onShowPointsDetail?: () => void;
216
223
  }) {
217
224
  const hasMounted = useHasMounted();
225
+ const featureFlags = useFeatureFlags();
218
226
 
219
227
  const searchParams = useSearchParamsSSR();
220
228
  const router = useRouter();
@@ -314,8 +322,8 @@ function AnySpendCustomInner({
314
322
  dstToken: dstToken,
315
323
  dstAmount: dstAmount,
316
324
  contractAddress: contractAddress,
317
- tokenId: metadata.type === "mint_nft" ? metadata.nftContract.tokenId : undefined,
318
- contractType: metadata.type === "mint_nft" ? metadata.nftContract.type : undefined,
325
+ tokenId: orderType === "mint_nft" ? metadata.nftContract.tokenId : undefined,
326
+ contractType: orderType === "mint_nft" ? metadata.nftContract.type : undefined,
319
327
  encodedData: encodedData,
320
328
  spenderAddress: spenderAddress,
321
329
  });
@@ -328,7 +336,6 @@ function AnySpendCustomInner({
328
336
  encodedData,
329
337
  metadata?.nftContract?.tokenId,
330
338
  metadata?.nftContract?.type,
331
- metadata?.type,
332
339
  orderType,
333
340
  spenderAddress,
334
341
  srcChainId,
@@ -426,7 +433,7 @@ function AnySpendCustomInner({
426
433
  recipientAddress,
427
434
  creatorAddress: currentWallet?.wallet?.address,
428
435
  nft:
429
- metadata.type === "mint_nft"
436
+ orderType === "mint_nft"
430
437
  ? metadata.nftContract.type === "erc1155"
431
438
  ? {
432
439
  type: "erc1155",
@@ -448,7 +455,7 @@ function AnySpendCustomInner({
448
455
  }
449
456
  : undefined,
450
457
  tournament:
451
- metadata.type === "join_tournament" || metadata.type === "fund_tournament"
458
+ orderType === "join_tournament" || orderType === "fund_tournament"
452
459
  ? {
453
460
  ...metadata.tournament,
454
461
  contractAddress: contractAddress,
@@ -457,13 +464,12 @@ function AnySpendCustomInner({
457
464
  : undefined,
458
465
  // only populate payload for custom tx
459
466
  payload:
460
- metadata.type === "custom"
467
+ orderType === "custom"
461
468
  ? {
462
469
  amount: dstAmount,
463
470
  data: encodedData,
464
471
  spenderAddress: spenderAddress,
465
472
  to: contractAddress,
466
- action: metadata.action,
467
473
  }
468
474
  : undefined,
469
475
  } as CreateOrderParams;
@@ -749,6 +755,23 @@ function AnySpendCustomInner({
749
755
  </div>
750
756
  );
751
757
 
758
+ // Render points badge if conditions are met
759
+ const renderPointsBadge = () => {
760
+ if (featureFlags.showPoints && anyspendQuote?.data?.pointsAmount && anyspendQuote.data.pointsAmount > 0) {
761
+ return (
762
+ <PointsBadge
763
+ pointsAmount={anyspendQuote.data.pointsAmount}
764
+ pointsMultiplier={anyspendQuote.data.pointsMultiplier}
765
+ onClick={() => {
766
+ onShowPointsDetail?.();
767
+ setActivePanel(PanelView.POINTS_DETAIL);
768
+ }}
769
+ />
770
+ );
771
+ }
772
+ return null;
773
+ };
774
+
752
775
  // Confirm order view.
753
776
  const confirmOrderView = (
754
777
  <div className={"relative mx-auto flex w-full flex-col items-center"}>
@@ -917,9 +940,12 @@ function AnySpendCustomInner({
917
940
  transition={{ duration: 0.3, delay: 0.1, ease: "easeInOut" }}
918
941
  className="relative flex w-full items-center justify-between"
919
942
  >
920
- <span className="text-as-tertiarry text-sm">
921
- Total <span className="text-as-tertiarry">(with fee)</span>
922
- </span>
943
+ <div className="flex items-center gap-2">
944
+ <span className="text-as-tertiarry text-sm">
945
+ Total <span className="text-as-tertiarry">(with fee)</span>
946
+ </span>
947
+ {renderPointsBadge()}
948
+ </div>
923
949
  <span className="text-as-primary font-semibold">
924
950
  {formattedSrcAmount || "--"} {srcToken.symbol}
925
951
  </span>
@@ -1040,9 +1066,12 @@ function AnySpendCustomInner({
1040
1066
  transition={{ duration: 0.3, delay: 0.1, ease: "easeInOut" }}
1041
1067
  className="relative flex w-full items-center justify-between"
1042
1068
  >
1043
- <span className="text-as-tertiarry text-sm">
1044
- Total <span className="text-as-tertiarry">(USD)</span>
1045
- </span>
1069
+ <div className="flex items-center gap-2">
1070
+ <span className="text-as-tertiarry text-sm">
1071
+ Total <span className="text-as-tertiarry">(USD)</span>
1072
+ </span>
1073
+ {renderPointsBadge()}
1074
+ </div>
1046
1075
  <span className="text-as-primary text-xl font-semibold">${srcFiatAmount || "0.00"}</span>
1047
1076
  </motion.div>
1048
1077
  </div>
@@ -1153,6 +1182,16 @@ function AnySpendCustomInner({
1153
1182
  </div>
1154
1183
  );
1155
1184
 
1185
+ // Points detail view
1186
+ const pointsDetailView = (
1187
+ <div className={cn("bg-as-surface-primary mx-auto w-[460px] max-w-full rounded-xl p-4")}>
1188
+ <PointsDetailPanel
1189
+ pointsAmount={anyspendQuote?.data?.pointsAmount || 0}
1190
+ onBack={() => setActivePanel(PanelView.CONFIRM_ORDER)}
1191
+ />
1192
+ </div>
1193
+ );
1194
+
1156
1195
  // Return the TransitionPanel with all views
1157
1196
  return (
1158
1197
  <StyleRoot>
@@ -1196,6 +1235,9 @@ function AnySpendCustomInner({
1196
1235
  <div key="fiat-payment-method-view" className="w-full">
1197
1236
  {fiatPaymentMethodView}
1198
1237
  </div>,
1238
+ <div key="points-detail-view" className="w-full">
1239
+ {pointsDetailView}
1240
+ </div>,
1199
1241
  ]}
1200
1242
  </TransitionPanel>
1201
1243
  </StyleRoot>
@@ -36,12 +36,14 @@ export function AnySpendNFT({
36
36
  recipientAddress,
37
37
  nftContract,
38
38
  onSuccess,
39
+ onShowPointsDetail,
39
40
  }: {
40
41
  loadOrder?: string;
41
42
  mode?: "modal" | "page";
42
43
  recipientAddress?: string;
43
44
  nftContract: components["schemas"]["NftContract"];
44
45
  onSuccess?: (txHash?: string) => void;
46
+ onShowPointsDetail?: () => void;
45
47
  }) {
46
48
  const [imageUrlWithFallback, setFallbackImageUrl] = useState<string | null>(nftContract.imageUrl);
47
49
  const [isLoadingFallback, setIsLoadingFallback] = useState(false);
@@ -164,6 +166,7 @@ export function AnySpendNFT({
164
166
  }}
165
167
  header={header}
166
168
  onSuccess={onSuccess}
169
+ onShowPointsDetail={onShowPointsDetail}
167
170
  />
168
171
  );
169
172
  }
@@ -491,7 +491,6 @@ export function AnySpendStakeB3({
491
491
  contractAddress={ERC20Staking}
492
492
  encodedData={encodedData}
493
493
  metadata={{
494
- type: "custom",
495
494
  action: "stake B3",
496
495
  }}
497
496
  header={header}
@@ -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,6 +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";
18
+ import { PointsDetailPanel } from "./common/PointsDetailPanel";
17
19
  import { RecipientSelection } from "./common/RecipientSelection";
18
20
 
19
21
  import { ArrowDown } from "lucide-react";
@@ -35,6 +37,11 @@ export interface AnySpendDepositHypeProps {
35
37
  sourceTokenChainId?: number;
36
38
  onSuccess?: () => void;
37
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;
38
45
  }
39
46
 
40
47
  export function AnySpendDepositHype(props: AnySpendDepositHypeProps) {
@@ -56,6 +63,7 @@ function AnySpendDepositHypeInner({
56
63
  sourceTokenChainId,
57
64
  onSuccess,
58
65
  mainFooter,
66
+ onTokenSelect,
59
67
  }: AnySpendDepositHypeProps) {
60
68
  // Use shared flow hook
61
69
  const {
@@ -201,6 +209,7 @@ function AnySpendDepositHypeInner({
201
209
  selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
202
210
  onSelectCryptoPaymentMethod={() => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD)}
203
211
  anyspendQuote={anyspendQuote}
212
+ onTokenSelect={onTokenSelect}
204
213
  />
205
214
  ) : (
206
215
  <motion.div
@@ -223,6 +232,8 @@ function AnySpendDepositHypeInner({
223
232
  onDestinationChainChange={() => {}}
224
233
  fiatPaymentMethodIndex={PanelView.FIAT_PAYMENT_METHOD}
225
234
  recipientSelectionPanelIndex={PanelView.RECIPIENT_SELECTION}
235
+ anyspendQuote={anyspendQuote}
236
+ onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
226
237
  />
227
238
  </motion.div>
228
239
  )}
@@ -263,6 +274,7 @@ function AnySpendDepositHypeInner({
263
274
  setSrcAmount(value);
264
275
  }}
265
276
  anyspendQuote={anyspendQuote}
277
+ onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
266
278
  />
267
279
  )}
268
280
  </div>
@@ -448,6 +460,13 @@ function AnySpendDepositHypeInner({
448
460
  />
449
461
  );
450
462
 
463
+ const pointsDetailView = (
464
+ <PointsDetailPanel
465
+ pointsAmount={anyspendQuote?.data?.pointsAmount || 0}
466
+ onBack={() => setActivePanel(PanelView.MAIN)}
467
+ />
468
+ );
469
+
451
470
  // If showing token selection, render with panel transitions
452
471
  return (
453
472
  <StyleRoot>
@@ -497,6 +516,9 @@ function AnySpendDepositHypeInner({
497
516
  <div key="loading-view" className={cn(mode === "page" && "p-6")}>
498
517
  {loadingView}
499
518
  </div>,
519
+ <div key="points-detail-view" className={cn(mode === "page" && "p-6")}>
520
+ {pointsDetailView}
521
+ </div>,
500
522
  ]}
501
523
  </TransitionPanel>
502
524
  </div>
@@ -144,7 +144,6 @@ export function AnyspendSignatureMint({
144
144
  contractAddress={signatureData.collection.address!}
145
145
  encodedData={encodedData}
146
146
  metadata={{
147
- type: "custom",
148
147
  action: "Signature Mint",
149
148
  }}
150
149
  header={header}