@b3dotfun/sdk 0.0.70-alpha.1 → 0.0.70-alpha.3

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 (143) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +0 -6
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +1 -13
  3. package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +1 -3
  4. package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +2 -2
  5. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.d.ts +1 -2
  6. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -2
  7. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +57 -0
  8. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +82 -0
  9. package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +0 -1
  10. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -3
  11. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -1
  12. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +1 -3
  13. package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.d.ts +1 -2
  14. package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.js +2 -2
  15. package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +1 -2
  16. package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
  17. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.d.ts +1 -2
  18. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -2
  19. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +1 -2
  20. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
  21. package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.d.ts +1 -2
  22. package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +2 -2
  23. package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +1 -2
  24. package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
  25. package/dist/cjs/anyspend/react/components/AnySpendTournament.d.ts +0 -2
  26. package/dist/cjs/anyspend/react/components/AnySpendTournament.js +1 -1
  27. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +1 -2
  28. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
  29. package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.d.ts +1 -2
  30. package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +2 -2
  31. package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
  32. package/dist/cjs/anyspend/react/components/index.js +3 -1
  33. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +5 -2
  34. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +0 -1
  35. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +5 -2
  36. package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
  37. package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.d.ts +5 -0
  38. package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +35 -0
  39. package/dist/cjs/anyspend/services/anyspend.js +3 -0
  40. package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -0
  41. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +4 -2
  42. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +4 -3
  43. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +1 -0
  44. package/dist/cjs/global-account/react/components/B3Provider/types.js +1 -0
  45. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -1
  46. package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
  47. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +23 -1
  48. package/dist/esm/anyspend/react/components/AnySpend.d.ts +0 -6
  49. package/dist/esm/anyspend/react/components/AnySpend.js +1 -13
  50. package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +1 -3
  51. package/dist/esm/anyspend/react/components/AnySpendBondKit.js +2 -2
  52. package/dist/esm/anyspend/react/components/AnySpendBuySpin.d.ts +1 -2
  53. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -2
  54. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +57 -0
  55. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +79 -0
  56. package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +0 -1
  57. package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -3
  58. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -1
  59. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +1 -3
  60. package/dist/esm/anyspend/react/components/AnySpendDepositUpside.d.ts +1 -2
  61. package/dist/esm/anyspend/react/components/AnySpendDepositUpside.js +2 -2
  62. package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +1 -2
  63. package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
  64. package/dist/esm/anyspend/react/components/AnySpendStakeB3.d.ts +1 -2
  65. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -2
  66. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +1 -2
  67. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
  68. package/dist/esm/anyspend/react/components/AnySpendStakeUpside.d.ts +1 -2
  69. package/dist/esm/anyspend/react/components/AnySpendStakeUpside.js +2 -2
  70. package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +1 -2
  71. package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
  72. package/dist/esm/anyspend/react/components/AnySpendTournament.d.ts +0 -2
  73. package/dist/esm/anyspend/react/components/AnySpendTournament.js +1 -1
  74. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +1 -2
  75. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
  76. package/dist/esm/anyspend/react/components/AnyspendSignatureMint.d.ts +1 -2
  77. package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +2 -2
  78. package/dist/esm/anyspend/react/components/index.d.ts +1 -0
  79. package/dist/esm/anyspend/react/components/index.js +1 -0
  80. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +5 -2
  81. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +0 -1
  82. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +5 -2
  83. package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
  84. package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.d.ts +5 -0
  85. package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +32 -0
  86. package/dist/esm/anyspend/services/anyspend.js +3 -0
  87. package/dist/esm/global-account/react/components/B3DynamicModal.js +3 -1
  88. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +4 -2
  89. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +4 -3
  90. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +1 -0
  91. package/dist/esm/global-account/react/components/B3Provider/types.js +1 -0
  92. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -1
  93. package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
  94. package/dist/esm/global-account/react/stores/useModalStore.d.ts +23 -1
  95. package/dist/types/anyspend/react/components/AnySpend.d.ts +0 -6
  96. package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +1 -3
  97. package/dist/types/anyspend/react/components/AnySpendBuySpin.d.ts +1 -2
  98. package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +57 -0
  99. package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +0 -1
  100. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -1
  101. package/dist/types/anyspend/react/components/AnySpendDepositUpside.d.ts +1 -2
  102. package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +1 -2
  103. package/dist/types/anyspend/react/components/AnySpendStakeB3.d.ts +1 -2
  104. package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +1 -2
  105. package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +1 -2
  106. package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +1 -2
  107. package/dist/types/anyspend/react/components/AnySpendTournament.d.ts +0 -2
  108. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +1 -2
  109. package/dist/types/anyspend/react/components/AnyspendSignatureMint.d.ts +1 -2
  110. package/dist/types/anyspend/react/components/index.d.ts +1 -0
  111. package/dist/types/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +0 -1
  112. package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
  113. package/dist/types/anyspend/react/hooks/useValidatedClientReferenceId.d.ts +5 -0
  114. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +4 -2
  115. package/dist/types/global-account/react/components/B3Provider/types.d.ts +1 -0
  116. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -1
  117. package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
  118. package/dist/types/global-account/react/stores/useModalStore.d.ts +23 -1
  119. package/package.json +1 -1
  120. package/src/anyspend/react/components/AnySpend.tsx +0 -23
  121. package/src/anyspend/react/components/AnySpendBondKit.tsx +1 -3
  122. package/src/anyspend/react/components/AnySpendBuySpin.tsx +0 -3
  123. package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +178 -0
  124. package/src/anyspend/react/components/AnySpendCustom.tsx +0 -5
  125. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +0 -4
  126. package/src/anyspend/react/components/AnySpendDepositUpside.tsx +0 -3
  127. package/src/anyspend/react/components/AnySpendNFT.tsx +0 -3
  128. package/src/anyspend/react/components/AnySpendStakeB3.tsx +0 -3
  129. package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +0 -3
  130. package/src/anyspend/react/components/AnySpendStakeUpside.tsx +0 -3
  131. package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +0 -3
  132. package/src/anyspend/react/components/AnySpendTournament.tsx +0 -3
  133. package/src/anyspend/react/components/AnyspendDepositHype.tsx +0 -3
  134. package/src/anyspend/react/components/AnyspendSignatureMint.tsx +0 -3
  135. package/src/anyspend/react/components/index.ts +1 -0
  136. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +5 -2
  137. package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +6 -13
  138. package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +40 -0
  139. package/src/anyspend/services/anyspend.ts +3 -0
  140. package/src/global-account/react/components/B3DynamicModal.tsx +3 -0
  141. package/src/global-account/react/components/B3Provider/B3Provider.tsx +6 -0
  142. package/src/global-account/react/components/B3Provider/types.ts +2 -0
  143. package/src/global-account/react/stores/useModalStore.ts +25 -1
@@ -0,0 +1,57 @@
1
+ import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
+ import { GetQuoteResponse } from "@b3dotfun/sdk/anyspend/types/api_req_res";
3
+ import React from "react";
4
+ export interface AnySpendCollectorClubPurchaseProps {
5
+ /**
6
+ * Optional order ID to load existing order
7
+ */
8
+ loadOrder?: string;
9
+ /**
10
+ * Display mode
11
+ */
12
+ mode?: "modal" | "page";
13
+ /**
14
+ * Active tab (crypto or fiat payment)
15
+ */
16
+ activeTab?: "crypto" | "fiat";
17
+ /**
18
+ * The pack ID to purchase
19
+ */
20
+ packId: number;
21
+ /**
22
+ * The number of packs to purchase
23
+ */
24
+ packAmount: number;
25
+ /**
26
+ * Price per pack in wei (e.g., "10000" for 0.01 USDC with 6 decimals)
27
+ */
28
+ pricePerPack: string;
29
+ /**
30
+ * The payment token (defaults to USDC on Base)
31
+ */
32
+ paymentToken?: components["schemas"]["Token"];
33
+ /**
34
+ * Address that will receive the packs
35
+ */
36
+ recipientAddress: string;
37
+ /**
38
+ * Optional spender address (defaults to contract address)
39
+ */
40
+ spenderAddress?: string;
41
+ /**
42
+ * Success callback
43
+ */
44
+ onSuccess?: (txHash?: string) => void;
45
+ /**
46
+ * Optional custom header component
47
+ */
48
+ header?: (props: {
49
+ anyspendPrice: GetQuoteResponse | undefined;
50
+ isLoadingAnyspendPrice: boolean;
51
+ }) => React.JSX.Element;
52
+ /**
53
+ * Show recipient selection (default: true)
54
+ */
55
+ showRecipient?: boolean;
56
+ }
57
+ export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, onSuccess, header, showRecipient, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
@@ -21,5 +21,4 @@ export declare function AnySpendCustom(props: {
21
21
  onSuccess?: (txHash?: string) => void;
22
22
  showRecipient?: boolean;
23
23
  onShowPointsDetail?: () => void;
24
- clientReferenceId?: string;
25
24
  }): import("react/jsx-runtime").JSX.Element;
@@ -31,7 +31,6 @@ export interface AnySpendCustomExactInProps {
31
31
  anyspendPrice: GetQuoteResponse | undefined;
32
32
  isLoadingAnyspendPrice: boolean;
33
33
  }) => React.JSX.Element;
34
- clientReferenceId?: string;
35
34
  }
36
35
  export declare function AnySpendCustomExactIn(props: AnySpendCustomExactInProps): import("react/jsx-runtime").JSX.Element;
37
36
  export {};
@@ -1,5 +1,5 @@
1
1
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
- export declare function AnySpendDepositUpside({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, depositContractAddress, token, onSuccess, clientReferenceId, }: {
2
+ export declare function AnySpendDepositUpside({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, depositContractAddress, token, onSuccess, }: {
3
3
  loadOrder?: string;
4
4
  mode?: "modal" | "page";
5
5
  recipientAddress: string;
@@ -8,5 +8,4 @@ export declare function AnySpendDepositUpside({ loadOrder, mode, recipientAddres
8
8
  depositContractAddress: string;
9
9
  token: components["schemas"]["Token"];
10
10
  onSuccess?: (amount: string) => void;
11
- clientReferenceId?: string;
12
11
  }): import("react/jsx-runtime").JSX.Element | null;
@@ -1,10 +1,9 @@
1
1
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
- export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail, clientReferenceId, }: {
2
+ export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail, }: {
3
3
  loadOrder?: string;
4
4
  mode?: "modal" | "page";
5
5
  recipientAddress?: string;
6
6
  nftContract: components["schemas"]["NftContract"];
7
7
  onSuccess?: (txHash?: string) => void;
8
8
  onShowPointsDetail?: () => void;
9
- clientReferenceId?: string;
10
9
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,7 @@
1
- export declare function AnySpendStakeB3({ loadOrder, mode, recipientAddress, stakeAmount, onSuccess, clientReferenceId, }: {
1
+ export declare function AnySpendStakeB3({ loadOrder, mode, recipientAddress, stakeAmount, onSuccess, }: {
2
2
  loadOrder?: string;
3
3
  mode?: "modal" | "page";
4
4
  recipientAddress: string;
5
5
  stakeAmount?: string;
6
6
  onSuccess?: () => void;
7
- clientReferenceId?: string;
8
7
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess, clientReferenceId, }: {
1
+ export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess, }: {
2
2
  loadOrder?: string;
3
3
  mode?: "modal" | "page";
4
4
  sourceTokenAddress?: string;
@@ -6,5 +6,4 @@ export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, sourceTokenAdd
6
6
  recipientAddress: string;
7
7
  stakeAmount?: string;
8
8
  onSuccess?: (amount: string) => void;
9
- clientReferenceId?: string;
10
9
  }): import("react/jsx-runtime").JSX.Element | null;
@@ -1,5 +1,5 @@
1
1
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
- export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, clientReferenceId, }: {
2
+ export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, }: {
3
3
  loadOrder?: string;
4
4
  mode?: "modal" | "page";
5
5
  beneficiaryAddress: string;
@@ -8,5 +8,4 @@ export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddres
8
8
  token: components["schemas"]["Token"];
9
9
  onSuccess?: () => void;
10
10
  activeTab?: "crypto" | "fiat";
11
- clientReferenceId?: string;
12
11
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
- export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess, clientReferenceId, }: {
2
+ export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess, }: {
3
3
  loadOrder?: string;
4
4
  mode?: "modal" | "page";
5
5
  recipientAddress: string;
@@ -8,5 +8,4 @@ export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientA
8
8
  stakingContractAddress: string;
9
9
  token: components["schemas"]["Token"];
10
10
  onSuccess?: (amount: string) => void;
11
- clientReferenceId?: string;
12
11
  }): import("react/jsx-runtime").JSX.Element | null;
@@ -10,7 +10,6 @@ type AnySpendTournamentProps = {
10
10
  tournamentEntryToken: components["schemas"]["Token"];
11
11
  tournamentEntryFee: string;
12
12
  onSuccess?: () => void;
13
- clientReferenceId?: string;
14
13
  } | {
15
14
  mode?: "modal" | "page";
16
15
  action: "fund";
@@ -21,7 +20,6 @@ type AnySpendTournamentProps = {
21
20
  tournamentFundToken: components["schemas"]["Token"];
22
21
  tournamentFundAmount: string;
23
22
  onSuccess?: () => void;
24
- clientReferenceId?: string;
25
23
  };
26
24
  export declare function AnySpendTournament(props: AnySpendTournamentProps): import("react/jsx-runtime").JSX.Element;
27
25
  export {};
@@ -21,6 +21,5 @@ export interface AnySpendDepositHypeProps {
21
21
  }) => void;
22
22
  customUsdInputValues?: string[];
23
23
  preferEoa?: boolean;
24
- clientReferenceId?: string;
25
24
  }
26
- export declare function AnySpendDepositHype({ loadOrder, mode, recipientAddress, paymentType, sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, clientReferenceId, }: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element | null;
25
+ export declare function AnySpendDepositHype({ loadOrder, mode, recipientAddress, paymentType, sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, }: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,9 +1,8 @@
1
1
  import { GenerateSigMintResponse } from "../../types/signatureMint";
2
- export declare function AnyspendSignatureMint({ loadOrder, mode, signatureData, imageUrl, onSuccess, clientReferenceId, }: {
2
+ export declare function AnyspendSignatureMint({ loadOrder, mode, signatureData, imageUrl, onSuccess, }: {
3
3
  loadOrder?: string;
4
4
  mode?: "modal" | "page";
5
5
  signatureData: GenerateSigMintResponse;
6
6
  imageUrl?: string;
7
7
  onSuccess?: (txHash?: string) => void;
8
- clientReferenceId?: string;
9
8
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  export { AnySpend } from "./AnySpend";
2
2
  export { AnySpendBondKit } from "./AnySpendBondKit";
3
3
  export { AnySpendBuySpin } from "./AnySpendBuySpin";
4
+ export { AnySpendCollectorClubPurchase } from "./AnySpendCollectorClubPurchase";
4
5
  export { AnySpendCustom } from "./AnySpendCustom";
5
6
  export { AnySpendCustomExactIn } from "./AnySpendCustomExactIn";
6
7
  export { AnySpendDepositHype, HYPE_TOKEN_DETAILS } from "./AnyspendDepositHype";
@@ -18,7 +18,6 @@ export type CreateOrderParams = {
18
18
  creatorAddress?: string;
19
19
  payload?: any;
20
20
  partnerId?: string;
21
- clientReferenceId?: string;
22
21
  };
23
22
  export type UseAnyspendCreateOrderProps = {
24
23
  onSuccess?: (data: any) => void;
@@ -48,8 +48,8 @@ export declare const useGenerateSigMintData: ({ recipientAddress, contractAddres
48
48
  creatorMap?: {} | undefined;
49
49
  chainId: number;
50
50
  address: string;
51
- title: string;
52
51
  _id: string | {};
52
+ title: string;
53
53
  };
54
54
  } | null;
55
55
  error: Error | null;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Hook that provides a validated client reference ID
3
+ * Gets the createClientReferenceId function from B3 context and validates the result
4
+ */
5
+ export declare function useValidatedClientReferenceId(): string | undefined;
@@ -7,7 +7,7 @@ import { B3ContextType } from "./types";
7
7
  /**
8
8
  * Main B3Provider component
9
9
  */
10
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, rpcUrls, partnerId, onConnect, connectors, overrideDefaultConnectors, }: {
10
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, rpcUrls, partnerId, onConnect, connectors, overrideDefaultConnectors, createClientReferenceId, }: {
11
11
  theme: "light" | "dark";
12
12
  children: React.ReactNode;
13
13
  accountOverride?: Account;
@@ -24,11 +24,12 @@ export declare function B3Provider({ theme, children, accountOverride, environme
24
24
  onConnect?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
25
25
  connectors?: CreateConnectorFn[];
26
26
  overrideDefaultConnectors?: boolean;
27
+ createClientReferenceId?: () => string;
27
28
  }): import("react/jsx-runtime").JSX.Element;
28
29
  /**
29
30
  * Inner provider component that provides the actual B3Context
30
31
  */
31
- export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, }: {
32
+ export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, createClientReferenceId, }: {
32
33
  children: React.ReactNode;
33
34
  accountOverride?: Account;
34
35
  environment: B3ContextType["environment"];
@@ -37,4 +38,5 @@ export declare function InnerProvider({ children, accountOverride, environment,
37
38
  theme: "light" | "dark";
38
39
  clientType?: ClientType;
39
40
  partnerId: string;
41
+ createClientReferenceId?: () => string;
40
42
  }): import("react/jsx-runtime").JSX.Element;
@@ -20,6 +20,7 @@ export interface B3ContextType {
20
20
  theme: "light" | "dark";
21
21
  clientType: ClientType;
22
22
  partnerId: string;
23
+ createClientReferenceId?: () => string;
23
24
  }
24
25
  /**
25
26
  * Context for B3 provider
@@ -13,8 +13,8 @@ export declare function useAuthentication(partnerId: string): {
13
13
  onConnect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
14
14
  user: {
15
15
  email?: string | undefined;
16
- username?: string | undefined;
17
16
  telNumber?: string | undefined;
17
+ username?: string | undefined;
18
18
  ens?: string | undefined;
19
19
  avatar?: string | undefined;
20
20
  preferences?: {} | undefined;
@@ -8,8 +8,8 @@ import { Users } from "@b3dotfun/b3-api";
8
8
  export declare function useUserQuery(): {
9
9
  user: {
10
10
  email?: string | undefined;
11
- username?: string | undefined;
12
11
  telNumber?: string | undefined;
12
+ username?: string | undefined;
13
13
  ens?: string | undefined;
14
14
  avatar?: string | undefined;
15
15
  preferences?: {} | undefined;
@@ -381,10 +381,32 @@ export interface ProfileEditorModalProps extends BaseModalProps {
381
381
  /** Callback function called when profile is successfully updated */
382
382
  onSuccess?: () => void;
383
383
  }
384
+ /**
385
+ * Props for the AnySpend Collector Club Purchase modal
386
+ * Handles Collector Club pack purchases
387
+ */
388
+ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
389
+ /** Modal type identifier */
390
+ type: "anySpendCollectorClubPurchase";
391
+ /** The pack ID to purchase */
392
+ packId: number;
393
+ /** The number of packs to purchase */
394
+ packAmount: number;
395
+ /** Price per pack in wei (e.g., "10000" for 0.01 USDC with 6 decimals) */
396
+ pricePerPack: string;
397
+ /** Recipient address to receive the packs */
398
+ recipientAddress: string;
399
+ /** Payment type - crypto or fiat */
400
+ paymentType?: "crypto" | "fiat";
401
+ /** Callback function called when the purchase is successful */
402
+ onSuccess?: (txHash?: string) => void;
403
+ /** Client-provided reference ID for tracking orders */
404
+ clientReferenceId?: string;
405
+ }
384
406
  /**
385
407
  * Union type of all possible modal content types
386
408
  */
387
- export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendDepositUpsideProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps | ProfileEditorModalProps;
409
+ export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendDepositUpsideProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps | ProfileEditorModalProps | AnySpendCollectorClubPurchaseProps;
388
410
  /**
389
411
  * State interface for the modal store
390
412
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.70-alpha.1",
3
+ "version": "0.0.70-alpha.3",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -8,7 +8,6 @@ import {
8
8
  useAnyspendQuote,
9
9
  useGeoOnrampOptions,
10
10
  } from "@b3dotfun/sdk/anyspend/react";
11
- import { Validators } from "@b3dotfun/sdk/anyspend/utils/validation";
12
11
  import {
13
12
  Button,
14
13
  ShinyButton,
@@ -88,12 +87,6 @@ export function AnySpend(props: {
88
87
  onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
89
88
  onSuccess?: (txHash?: string) => void;
90
89
  customUsdInputValues?: string[];
91
- /**
92
- * Client-provided reference ID for tracking orders.
93
- * Must be alphanumeric with optional hyphens, underscores, and dots (max 255 chars).
94
- * Auto-generates UUID if not provided.
95
- */
96
- clientReferenceId?: string;
97
90
  }) {
98
91
  const fingerprintConfig = getFingerprintConfig();
99
92
 
@@ -115,7 +108,6 @@ function AnySpendInner({
115
108
  onTokenSelect,
116
109
  onSuccess,
117
110
  customUsdInputValues,
118
- clientReferenceId: clientReferenceIdFromProps,
119
111
  }: {
120
112
  destinationTokenAddress?: string;
121
113
  destinationTokenChainId?: number;
@@ -127,23 +119,10 @@ function AnySpendInner({
127
119
  onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
128
120
  onSuccess?: (txHash?: string) => void;
129
121
  customUsdInputValues?: string[];
130
- clientReferenceId?: string;
131
122
  }) {
132
123
  const searchParams = useSearchParamsSSR();
133
124
  const router = useRouter();
134
125
 
135
- // Validate and clean clientReferenceId
136
- const validatedClientReferenceId = useMemo(() => {
137
- const validation = Validators.clientReferenceId(clientReferenceIdFromProps);
138
- if (!validation.isValid) {
139
- console.error(
140
- `[AnySpend] Invalid clientReferenceId: ${validation.error || "Validation failed"}. Will be set to undefined.`,
141
- );
142
- return undefined;
143
- }
144
- return validation.cleaned;
145
- }, [clientReferenceIdFromProps]);
146
-
147
126
  // Determine if we're in "buy mode" based on whether destination token props are provided
148
127
  const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
149
128
 
@@ -844,7 +823,6 @@ function AnySpendInner({
844
823
  srcAmount: srcAmountBigInt.toString(),
845
824
  expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount || "0",
846
825
  creatorAddress: globalAddress,
847
- clientReferenceId: validatedClientReferenceId,
848
826
  });
849
827
  } catch (err: any) {
850
828
  console.error(err);
@@ -913,7 +891,6 @@ function AnySpendInner({
913
891
  },
914
892
  expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
915
893
  creatorAddress: globalAddress,
916
- clientReferenceId: validatedClientReferenceId,
917
894
  });
918
895
  } catch (err: any) {
919
896
  console.error(err);
@@ -38,8 +38,7 @@ export function AnySpendBondKit({
38
38
  imageUrl,
39
39
  b3Amount: initialB3Amount,
40
40
  onSuccess,
41
- clientReferenceId,
42
- }: AnySpendBondKitProps & { clientReferenceId?: string }) {
41
+ }: AnySpendBondKitProps) {
43
42
  const hasMounted = useHasMounted();
44
43
  const [showAmountPrompt, setShowAmountPrompt] = useState(!initialB3Amount);
45
44
  const [b3Amount, setB3Amount] = useState(initialB3Amount || "");
@@ -372,7 +371,6 @@ export function AnySpendBondKit({
372
371
  header={header}
373
372
  onSuccess={onSuccess}
374
373
  showRecipient={true}
375
- clientReferenceId={clientReferenceId}
376
374
  />
377
375
  );
378
376
  }
@@ -129,7 +129,6 @@ export function AnySpendBuySpin({
129
129
  recipientAddress,
130
130
  prefillQuantity,
131
131
  onSuccess,
132
- clientReferenceId,
133
132
  }: {
134
133
  loadOrder?: string;
135
134
  mode?: "modal" | "page";
@@ -138,7 +137,6 @@ export function AnySpendBuySpin({
138
137
  recipientAddress: string;
139
138
  prefillQuantity?: string;
140
139
  onSuccess?: (txHash?: string) => void;
141
- clientReferenceId?: string;
142
140
  }) {
143
141
  const hasMounted = useHasMounted();
144
142
  const { setB3ModalOpen } = useModalStore();
@@ -682,7 +680,6 @@ export function AnySpendBuySpin({
682
680
  header={header}
683
681
  onSuccess={txHash => onSuccess?.(txHash)}
684
682
  showRecipient={false}
685
- clientReferenceId={clientReferenceId}
686
683
  />
687
684
  );
688
685
  }
@@ -0,0 +1,178 @@
1
+ /**
2
+ * AnySpend component for Collector Club pack purchases
3
+ *
4
+ * This component enables users to purchase Collector Club packs using any token via AnySpend.
5
+ * It calls the `buyPacksFor` function on the Collector Club Shop contract on Base.
6
+ * Uses exact-out flow to ensure the contract receives exactly the required USDC amount.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * import { AnySpendCollectorClubPurchase } from "@b3dotfun/sdk";
11
+ * import { USDC_BASE } from "@b3dotfun/sdk/anyspend/constants";
12
+ *
13
+ * function MyComponent() {
14
+ * return (
15
+ * <AnySpendCollectorClubPurchase
16
+ * packId={1}
17
+ * packAmount={5}
18
+ * pricePerPack="10000" // 0.01 USDC in wei (6 decimals)
19
+ * paymentToken={USDC_BASE}
20
+ * recipientAddress="0x123..."
21
+ * onSuccess={(txHash) => console.log("Purchase successful!", txHash)}
22
+ * />
23
+ * );
24
+ * }
25
+ * ```
26
+ */
27
+ import { USDC_BASE } from "@b3dotfun/sdk/anyspend/constants";
28
+ import { components } from "@b3dotfun/sdk/anyspend/types/api";
29
+ import { GetQuoteResponse } from "@b3dotfun/sdk/anyspend/types/api_req_res";
30
+ import React, { useMemo } from "react";
31
+ import { encodeFunctionData } from "viem";
32
+ import { AnySpendCustom } from "./AnySpendCustom";
33
+
34
+ // Collector Club Shop contract on Base
35
+ const CC_SHOP_ADDRESS = "0x68B32D594E3c7E5B8cd8046BD66AfB0DB5b9BF9c";
36
+ const BASE_CHAIN_ID = 8453;
37
+
38
+ // ABI for buyPacksFor function only
39
+ const BUY_PACKS_FOR_ABI = {
40
+ inputs: [
41
+ { internalType: "address", name: "user", type: "address" },
42
+ { internalType: "uint256", name: "packId", type: "uint256" },
43
+ { internalType: "uint256", name: "amount", type: "uint256" },
44
+ ],
45
+ name: "buyPacksFor",
46
+ outputs: [],
47
+ stateMutability: "nonpayable",
48
+ type: "function",
49
+ } as const;
50
+
51
+ export interface AnySpendCollectorClubPurchaseProps {
52
+ /**
53
+ * Optional order ID to load existing order
54
+ */
55
+ loadOrder?: string;
56
+ /**
57
+ * Display mode
58
+ */
59
+ mode?: "modal" | "page";
60
+ /**
61
+ * Active tab (crypto or fiat payment)
62
+ */
63
+ activeTab?: "crypto" | "fiat";
64
+ /**
65
+ * The pack ID to purchase
66
+ */
67
+ packId: number;
68
+ /**
69
+ * The number of packs to purchase
70
+ */
71
+ packAmount: number;
72
+ /**
73
+ * Price per pack in wei (e.g., "10000" for 0.01 USDC with 6 decimals)
74
+ */
75
+ pricePerPack: string;
76
+ /**
77
+ * The payment token (defaults to USDC on Base)
78
+ */
79
+ paymentToken?: components["schemas"]["Token"];
80
+ /**
81
+ * Address that will receive the packs
82
+ */
83
+ recipientAddress: string;
84
+ /**
85
+ * Optional spender address (defaults to contract address)
86
+ */
87
+ spenderAddress?: string;
88
+ /**
89
+ * Success callback
90
+ */
91
+ onSuccess?: (txHash?: string) => void;
92
+ /**
93
+ * Optional custom header component
94
+ */
95
+ header?: (props: {
96
+ anyspendPrice: GetQuoteResponse | undefined;
97
+ isLoadingAnyspendPrice: boolean;
98
+ }) => React.JSX.Element;
99
+ /**
100
+ * Show recipient selection (default: true)
101
+ */
102
+ showRecipient?: boolean;
103
+ }
104
+
105
+ export function AnySpendCollectorClubPurchase({
106
+ loadOrder,
107
+ mode = "modal",
108
+ activeTab = "crypto",
109
+ packId,
110
+ packAmount,
111
+ pricePerPack,
112
+ paymentToken = USDC_BASE,
113
+ recipientAddress,
114
+ spenderAddress = CC_SHOP_ADDRESS,
115
+ onSuccess,
116
+ header,
117
+ showRecipient = true,
118
+ }: AnySpendCollectorClubPurchaseProps) {
119
+ // Calculate total amount needed (pricePerPack * packAmount)
120
+ const totalAmount = useMemo(() => {
121
+ try {
122
+ return (BigInt(pricePerPack) * BigInt(packAmount)).toString();
123
+ } catch (error) {
124
+ console.error("Failed to calculate total amount from props", { pricePerPack, packAmount, error });
125
+ return "0";
126
+ }
127
+ }, [pricePerPack, packAmount]);
128
+
129
+ // Encode the buyPacksFor function call
130
+ const encodedData = useMemo(() => {
131
+ try {
132
+ return encodeFunctionData({
133
+ abi: [BUY_PACKS_FOR_ABI],
134
+ functionName: "buyPacksFor",
135
+ args: [recipientAddress as `0x${string}`, BigInt(packId), BigInt(packAmount)],
136
+ });
137
+ } catch (error) {
138
+ console.error("Failed to encode function data", { recipientAddress, packId, packAmount, error });
139
+ return "0x";
140
+ }
141
+ }, [recipientAddress, packId, packAmount]);
142
+
143
+ // Default header if not provided
144
+ const defaultHeader = () => (
145
+ <div className="mb-4 flex flex-col items-center gap-3 text-center">
146
+ <div>
147
+ <h1 className="text-as-primary text-xl font-bold">Buy Collector Club Packs</h1>
148
+ <p className="text-as-secondary text-sm">
149
+ Purchase {packAmount} pack{packAmount !== 1 ? "s" : ""} using any token
150
+ </p>
151
+ </div>
152
+ </div>
153
+ );
154
+
155
+ return (
156
+ <AnySpendCustom
157
+ loadOrder={loadOrder}
158
+ mode={mode}
159
+ activeTab={activeTab}
160
+ recipientAddress={recipientAddress}
161
+ spenderAddress={spenderAddress}
162
+ orderType="custom"
163
+ dstChainId={BASE_CHAIN_ID}
164
+ dstToken={paymentToken}
165
+ dstAmount={totalAmount}
166
+ contractAddress={CC_SHOP_ADDRESS}
167
+ encodedData={encodedData}
168
+ metadata={{
169
+ packId,
170
+ packAmount,
171
+ pricePerPack,
172
+ }}
173
+ header={header || defaultHeader}
174
+ onSuccess={onSuccess}
175
+ showRecipient={showRecipient}
176
+ />
177
+ );
178
+ }
@@ -187,7 +187,6 @@ export function AnySpendCustom(props: {
187
187
  onSuccess?: (txHash?: string) => void;
188
188
  showRecipient?: boolean;
189
189
  onShowPointsDetail?: () => void;
190
- clientReferenceId?: string;
191
190
  }) {
192
191
  const fingerprintConfig = getFingerprintConfig();
193
192
 
@@ -215,7 +214,6 @@ function AnySpendCustomInner({
215
214
  onSuccess,
216
215
  showRecipient = true,
217
216
  onShowPointsDetail,
218
- clientReferenceId,
219
217
  }: {
220
218
  loadOrder?: string;
221
219
  mode?: "modal" | "page";
@@ -239,7 +237,6 @@ function AnySpendCustomInner({
239
237
  onSuccess?: (txHash?: string) => void;
240
238
  showRecipient?: boolean;
241
239
  onShowPointsDetail?: () => void;
242
- clientReferenceId?: string;
243
240
  }) {
244
241
  const hasMounted = useHasMounted();
245
242
  const featureFlags = useFeatureFlags();
@@ -535,12 +532,10 @@ function AnySpendCustomInner({
535
532
  : window.location.origin,
536
533
  },
537
534
  expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
538
- clientReferenceId: clientReferenceId,
539
535
  });
540
536
  } else {
541
537
  void createRegularOrder({
542
538
  ...createOrderParams,
543
- clientReferenceId: clientReferenceId,
544
539
  });
545
540
  }
546
541
  } catch (err) {