@b3dotfun/sdk 0.1.6 → 0.1.61

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 (27) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +3 -3
  2. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +5 -3
  3. package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +6 -4
  4. package/dist/cjs/anyspend/services/anyspend.d.ts +1 -1
  5. package/dist/cjs/anyspend/services/anyspend.js +2 -2
  6. package/dist/cjs/anyspend/types/api.d.ts +23 -2
  7. package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +1 -1
  8. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
  9. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +3 -3
  10. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +5 -3
  11. package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +4 -2
  12. package/dist/esm/anyspend/services/anyspend.d.ts +1 -1
  13. package/dist/esm/anyspend/services/anyspend.js +2 -2
  14. package/dist/esm/anyspend/types/api.d.ts +23 -2
  15. package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +1 -1
  16. package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
  17. package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +3 -3
  18. package/dist/types/anyspend/services/anyspend.d.ts +1 -1
  19. package/dist/types/anyspend/types/api.d.ts +23 -2
  20. package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
  21. package/package.json +1 -1
  22. package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +8 -5
  23. package/src/anyspend/react/hooks/useAnyspendQuote.ts +5 -2
  24. package/src/anyspend/services/anyspend.ts +2 -2
  25. package/src/anyspend/types/api.ts +23 -2
  26. package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +1 -1
  27. package/src/global-account/react/stores/useModalStore.ts +4 -0
@@ -39,9 +39,9 @@ export interface AnySpendCollectorClubPurchaseProps {
39
39
  */
40
40
  spenderAddress?: string;
41
41
  /**
42
- * Collector Club Shop contract address (defaults to Base mainnet shop)
42
+ * Use staging contract address instead of production
43
43
  */
44
- ccShopAddress?: string;
44
+ isStaging?: boolean;
45
45
  /**
46
46
  * Success callback
47
47
  */
@@ -70,4 +70,4 @@ export interface AnySpendCollectorClubPurchaseProps {
70
70
  */
71
71
  forceFiatPayment?: boolean;
72
72
  }
73
- export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, ccShopAddress, spenderAddress, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
73
+ export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, isStaging, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
@@ -33,8 +33,9 @@ const number_1 = require("../../../shared/utils/number");
33
33
  const react_1 = require("react");
34
34
  const viem_1 = require("viem");
35
35
  const AnySpendCustom_1 = require("./AnySpendCustom");
36
- // Default Collector Club Shop contract on Base
37
- const DEFAULT_CC_SHOP_ADDRESS = "0x47366E64E4917dd4DdC04Fb9DC507c1dD2b87294";
36
+ // Collector Club Shop contract addresses on Base
37
+ const CC_SHOP_ADDRESS = "0x47366E64E4917dd4DdC04Fb9DC507c1dD2b87294";
38
+ const CC_SHOP_ADDRESS_STAGING = "0x8b751143342ac41eB965E55430e3F7Adf6BE01fA";
38
39
  const BASE_CHAIN_ID = 8453;
39
40
  // ABI for buyPacksFor function only
40
41
  const BUY_PACKS_FOR_ABI = {
@@ -48,7 +49,8 @@ const BUY_PACKS_FOR_ABI = {
48
49
  stateMutability: "nonpayable",
49
50
  type: "function",
50
51
  };
51
- function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = constants_1.USDC_BASE, recipientAddress, ccShopAddress = DEFAULT_CC_SHOP_ADDRESS, spenderAddress, onSuccess, header, showRecipient = true, vendingMachineId, packType, forceFiatPayment, }) {
52
+ function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = constants_1.USDC_BASE, recipientAddress, spenderAddress, isStaging = false, onSuccess, header, showRecipient = true, vendingMachineId, packType, forceFiatPayment, }) {
53
+ const ccShopAddress = isStaging ? CC_SHOP_ADDRESS_STAGING : CC_SHOP_ADDRESS;
52
54
  // Calculate total amount needed (pricePerPack * packAmount)
53
55
  const totalAmount = (0, react_1.useMemo)(() => {
54
56
  try {
@@ -2,13 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useAnyspendQuote = useAnyspendQuote;
4
4
  const anyspend_1 = require("../../../anyspend/services/anyspend");
5
+ const react_1 = require("../../../global-account/react");
5
6
  const react_query_1 = require("@tanstack/react-query");
6
- const react_1 = require("react");
7
+ const react_2 = require("react");
7
8
  function useAnyspendQuote(req) {
9
+ const { partnerId } = (0, react_1.useB3Config)();
8
10
  const { data, isLoading, refetch, error } = (0, react_query_1.useQuery)({
9
- queryKey: ["useAnyspendQuote", JSON.stringify(req)],
11
+ queryKey: ["useAnyspendQuote", JSON.stringify(req), partnerId],
10
12
  queryFn: () => {
11
- return anyspend_1.anyspendService.getQuote(req);
13
+ return anyspend_1.anyspendService.getQuote(req, partnerId);
12
14
  },
13
15
  enabled: Boolean(req.srcChain &&
14
16
  req.dstChain &&
@@ -26,7 +28,7 @@ function useAnyspendQuote(req) {
26
28
  refetchInterval: 10000,
27
29
  retry: false,
28
30
  });
29
- return (0, react_1.useMemo)(() => ({
31
+ return (0, react_2.useMemo)(() => ({
30
32
  anyspendQuote: data,
31
33
  isLoadingAnyspendQuote: isLoading,
32
34
  getAnyspendQuoteError: error,
@@ -5,7 +5,7 @@ import { VisitorData } from "../types/fingerprint";
5
5
  export declare const anyspendService: {
6
6
  getTokenList: (chainId: number, query: string) => Promise<components["schemas"]["Token"][]>;
7
7
  getToken: (chainId: number, tokenAddress: string) => Promise<components["schemas"]["Token"]>;
8
- getQuote: (req: GetQuoteRequest) => Promise<GetQuoteResponse>;
8
+ getQuote: (req: GetQuoteRequest, partnerId?: string) => Promise<GetQuoteResponse>;
9
9
  createOrder: ({ recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, clientReferenceId, visitorData, }: {
10
10
  recipientAddress: string;
11
11
  type: string;
@@ -27,14 +27,14 @@ exports.anyspendService = {
27
27
  }
28
28
  return token;
29
29
  },
30
- getQuote: async (req) => {
30
+ getQuote: async (req, partnerId) => {
31
31
  const url = `${constants_1.ANYSPEND_MAINNET_BASE_URL}/orders/quote`;
32
32
  const response = await fetch(url, {
33
33
  method: "POST",
34
34
  headers: {
35
35
  "Content-Type": "application/json",
36
36
  },
37
- body: JSON.stringify(req),
37
+ body: JSON.stringify({ ...req, partnerId }),
38
38
  });
39
39
  const data = await response.json();
40
40
  if (response.status !== 200)
@@ -928,6 +928,8 @@ export interface paths {
928
928
  * @enum {string}
929
929
  */
930
930
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
931
+ /** @description Optional partner ID */
932
+ partnerId?: string;
931
933
  } | {
932
934
  /**
933
935
  * @description Order type for X402 swap
@@ -969,6 +971,8 @@ export interface paths {
969
971
  * @enum {string}
970
972
  */
971
973
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
974
+ /** @description Optional partner ID */
975
+ partnerId?: string;
972
976
  } | {
973
977
  /**
974
978
  * @description Order type for custom execution
@@ -1016,6 +1020,8 @@ export interface paths {
1016
1020
  * @enum {string}
1017
1021
  */
1018
1022
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1023
+ /** @description Optional partner ID */
1024
+ partnerId?: string;
1019
1025
  } | {
1020
1026
  /** @enum {string} */
1021
1027
  type: "mint_nft";
@@ -1030,6 +1036,8 @@ export interface paths {
1030
1036
  recipientAddress?: string;
1031
1037
  /** @enum {string} */
1032
1038
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1039
+ /** @description Optional partner ID */
1040
+ partnerId?: string;
1033
1041
  contractAddress: string;
1034
1042
  tokenId?: number | null;
1035
1043
  /** @enum {string} */
@@ -1049,6 +1057,8 @@ export interface paths {
1049
1057
  recipientAddress?: string;
1050
1058
  /** @enum {string} */
1051
1059
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1060
+ /** @description Optional partner ID */
1061
+ partnerId?: string;
1052
1062
  contractAddress: string;
1053
1063
  price: string;
1054
1064
  } | {
@@ -1065,6 +1075,8 @@ export interface paths {
1065
1075
  recipientAddress?: string;
1066
1076
  /** @enum {string} */
1067
1077
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1078
+ /** @description Optional partner ID */
1079
+ partnerId?: string;
1068
1080
  contractAddress: string;
1069
1081
  fundAmount: string;
1070
1082
  } | {
@@ -1108,6 +1120,8 @@ export interface paths {
1108
1120
  * @enum {string}
1109
1121
  */
1110
1122
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1123
+ /** @description Optional partner ID */
1124
+ partnerId?: string;
1111
1125
  } | {
1112
1126
  /**
1113
1127
  * @description Order type for custom exact in execution
@@ -1149,6 +1163,8 @@ export interface paths {
1149
1163
  * @enum {string}
1150
1164
  */
1151
1165
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1166
+ /** @description Optional partner ID */
1167
+ partnerId?: string;
1152
1168
  };
1153
1169
  };
1154
1170
  };
@@ -1896,6 +1912,11 @@ export interface components {
1896
1912
  * @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
1897
1913
  */
1898
1914
  spenderAddress?: string;
1915
+ /**
1916
+ * @description Native token value to send with the transaction (in wei)
1917
+ * @example 1000000000000000000
1918
+ */
1919
+ value?: string;
1899
1920
  /**
1900
1921
  * @description Optional action identifier used for display purposes
1901
1922
  * @example stake B3
@@ -2933,7 +2954,7 @@ export interface components {
2933
2954
  */
2934
2955
  anyspendWhaleDiscountBps: number;
2935
2956
  /**
2936
- * @description Partner discount in basis points
2957
+ * @description Partner discount in basis points (deprecated, always 0)
2937
2958
  * @example 0
2938
2959
  */
2939
2960
  anyspendPartnerDiscountBps: number;
@@ -2989,7 +3010,7 @@ export interface components {
2989
3010
  */
2990
3011
  anyspendWhaleDiscountBps: number;
2991
3012
  /**
2992
- * @description Partner discount in basis points
3013
+ * @description Partner discount in basis points (deprecated, always 0)
2993
3014
  * @example 0
2994
3015
  */
2995
3016
  anyspendPartnerDiscountBps: number;
@@ -83,7 +83,7 @@ const SettingsProfileCard = () => {
83
83
  // Note: Type assertion needed until @b3dotfun/b3-api package is updated with RegisterUsername type
84
84
  const updatedUser = (await app_1.default
85
85
  .service("users")
86
- .registerUsername({ username: b3Username, message: usernameSignMessage, hash: usernameSignature }, {}));
86
+ .registerUsername({ username: sanitizedUsername, message: usernameSignMessage, hash: usernameSignature }, {}));
87
87
  // Update user state - registerUsername returns an array with single user
88
88
  setUser(Array.isArray(updatedUser) ? updatedUser[0] : updatedUser);
89
89
  // Refresh profile to get updated data
@@ -131,6 +131,8 @@ export interface AnySpendModalProps extends BaseModalProps {
131
131
  hideHeader?: boolean;
132
132
  /** When true, disables URL parameter management for swap configuration */
133
133
  disableUrlParamManagement?: boolean;
134
+ /** Staging environment support */
135
+ isStaging?: boolean;
134
136
  }
135
137
  /**
136
138
  * Props for the AnySpend NFT modal
@@ -466,6 +468,8 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
466
468
  activeTab?: "crypto" | "fiat";
467
469
  /** Force fiat payment */
468
470
  forceFiatPayment?: boolean;
471
+ /** Staging environment support */
472
+ isStaging?: boolean;
469
473
  }
470
474
  /**
471
475
  * Props for the AnySpend Deposit modal
@@ -39,9 +39,9 @@ export interface AnySpendCollectorClubPurchaseProps {
39
39
  */
40
40
  spenderAddress?: string;
41
41
  /**
42
- * Collector Club Shop contract address (defaults to Base mainnet shop)
42
+ * Use staging contract address instead of production
43
43
  */
44
- ccShopAddress?: string;
44
+ isStaging?: boolean;
45
45
  /**
46
46
  * Success callback
47
47
  */
@@ -70,4 +70,4 @@ export interface AnySpendCollectorClubPurchaseProps {
70
70
  */
71
71
  forceFiatPayment?: boolean;
72
72
  }
73
- export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, ccShopAddress, spenderAddress, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
73
+ export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, isStaging, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
@@ -30,8 +30,9 @@ import { formatUnits } from "../../../shared/utils/number.js";
30
30
  import { useMemo } from "react";
31
31
  import { encodeFunctionData } from "viem";
32
32
  import { AnySpendCustom } from "./AnySpendCustom.js";
33
- // Default Collector Club Shop contract on Base
34
- const DEFAULT_CC_SHOP_ADDRESS = "0x47366E64E4917dd4DdC04Fb9DC507c1dD2b87294";
33
+ // Collector Club Shop contract addresses on Base
34
+ const CC_SHOP_ADDRESS = "0x47366E64E4917dd4DdC04Fb9DC507c1dD2b87294";
35
+ const CC_SHOP_ADDRESS_STAGING = "0x8b751143342ac41eB965E55430e3F7Adf6BE01fA";
35
36
  const BASE_CHAIN_ID = 8453;
36
37
  // ABI for buyPacksFor function only
37
38
  const BUY_PACKS_FOR_ABI = {
@@ -45,7 +46,8 @@ const BUY_PACKS_FOR_ABI = {
45
46
  stateMutability: "nonpayable",
46
47
  type: "function",
47
48
  };
48
- export function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = USDC_BASE, recipientAddress, ccShopAddress = DEFAULT_CC_SHOP_ADDRESS, spenderAddress, onSuccess, header, showRecipient = true, vendingMachineId, packType, forceFiatPayment, }) {
49
+ export function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = USDC_BASE, recipientAddress, spenderAddress, isStaging = false, onSuccess, header, showRecipient = true, vendingMachineId, packType, forceFiatPayment, }) {
50
+ const ccShopAddress = isStaging ? CC_SHOP_ADDRESS_STAGING : CC_SHOP_ADDRESS;
49
51
  // Calculate total amount needed (pricePerPack * packAmount)
50
52
  const totalAmount = useMemo(() => {
51
53
  try {
@@ -1,11 +1,13 @@
1
1
  import { anyspendService } from "../../../anyspend/services/anyspend.js";
2
+ import { useB3Config } from "../../../global-account/react/index.js";
2
3
  import { useQuery } from "@tanstack/react-query";
3
4
  import { useMemo } from "react";
4
5
  export function useAnyspendQuote(req) {
6
+ const { partnerId } = useB3Config();
5
7
  const { data, isLoading, refetch, error } = useQuery({
6
- queryKey: ["useAnyspendQuote", JSON.stringify(req)],
8
+ queryKey: ["useAnyspendQuote", JSON.stringify(req), partnerId],
7
9
  queryFn: () => {
8
- return anyspendService.getQuote(req);
10
+ return anyspendService.getQuote(req, partnerId);
9
11
  },
10
12
  enabled: Boolean(req.srcChain &&
11
13
  req.dstChain &&
@@ -5,7 +5,7 @@ import { VisitorData } from "../types/fingerprint";
5
5
  export declare const anyspendService: {
6
6
  getTokenList: (chainId: number, query: string) => Promise<components["schemas"]["Token"][]>;
7
7
  getToken: (chainId: number, tokenAddress: string) => Promise<components["schemas"]["Token"]>;
8
- getQuote: (req: GetQuoteRequest) => Promise<GetQuoteResponse>;
8
+ getQuote: (req: GetQuoteRequest, partnerId?: string) => Promise<GetQuoteResponse>;
9
9
  createOrder: ({ recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, clientReferenceId, visitorData, }: {
10
10
  recipientAddress: string;
11
11
  type: string;
@@ -21,14 +21,14 @@ export const anyspendService = {
21
21
  }
22
22
  return token;
23
23
  },
24
- getQuote: async (req) => {
24
+ getQuote: async (req, partnerId) => {
25
25
  const url = `${ANYSPEND_MAINNET_BASE_URL}/orders/quote`;
26
26
  const response = await fetch(url, {
27
27
  method: "POST",
28
28
  headers: {
29
29
  "Content-Type": "application/json",
30
30
  },
31
- body: JSON.stringify(req),
31
+ body: JSON.stringify({ ...req, partnerId }),
32
32
  });
33
33
  const data = await response.json();
34
34
  if (response.status !== 200)
@@ -928,6 +928,8 @@ export interface paths {
928
928
  * @enum {string}
929
929
  */
930
930
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
931
+ /** @description Optional partner ID */
932
+ partnerId?: string;
931
933
  } | {
932
934
  /**
933
935
  * @description Order type for X402 swap
@@ -969,6 +971,8 @@ export interface paths {
969
971
  * @enum {string}
970
972
  */
971
973
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
974
+ /** @description Optional partner ID */
975
+ partnerId?: string;
972
976
  } | {
973
977
  /**
974
978
  * @description Order type for custom execution
@@ -1016,6 +1020,8 @@ export interface paths {
1016
1020
  * @enum {string}
1017
1021
  */
1018
1022
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1023
+ /** @description Optional partner ID */
1024
+ partnerId?: string;
1019
1025
  } | {
1020
1026
  /** @enum {string} */
1021
1027
  type: "mint_nft";
@@ -1030,6 +1036,8 @@ export interface paths {
1030
1036
  recipientAddress?: string;
1031
1037
  /** @enum {string} */
1032
1038
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1039
+ /** @description Optional partner ID */
1040
+ partnerId?: string;
1033
1041
  contractAddress: string;
1034
1042
  tokenId?: number | null;
1035
1043
  /** @enum {string} */
@@ -1049,6 +1057,8 @@ export interface paths {
1049
1057
  recipientAddress?: string;
1050
1058
  /** @enum {string} */
1051
1059
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1060
+ /** @description Optional partner ID */
1061
+ partnerId?: string;
1052
1062
  contractAddress: string;
1053
1063
  price: string;
1054
1064
  } | {
@@ -1065,6 +1075,8 @@ export interface paths {
1065
1075
  recipientAddress?: string;
1066
1076
  /** @enum {string} */
1067
1077
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1078
+ /** @description Optional partner ID */
1079
+ partnerId?: string;
1068
1080
  contractAddress: string;
1069
1081
  fundAmount: string;
1070
1082
  } | {
@@ -1108,6 +1120,8 @@ export interface paths {
1108
1120
  * @enum {string}
1109
1121
  */
1110
1122
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1123
+ /** @description Optional partner ID */
1124
+ partnerId?: string;
1111
1125
  } | {
1112
1126
  /**
1113
1127
  * @description Order type for custom exact in execution
@@ -1149,6 +1163,8 @@ export interface paths {
1149
1163
  * @enum {string}
1150
1164
  */
1151
1165
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1166
+ /** @description Optional partner ID */
1167
+ partnerId?: string;
1152
1168
  };
1153
1169
  };
1154
1170
  };
@@ -1896,6 +1912,11 @@ export interface components {
1896
1912
  * @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
1897
1913
  */
1898
1914
  spenderAddress?: string;
1915
+ /**
1916
+ * @description Native token value to send with the transaction (in wei)
1917
+ * @example 1000000000000000000
1918
+ */
1919
+ value?: string;
1899
1920
  /**
1900
1921
  * @description Optional action identifier used for display purposes
1901
1922
  * @example stake B3
@@ -2933,7 +2954,7 @@ export interface components {
2933
2954
  */
2934
2955
  anyspendWhaleDiscountBps: number;
2935
2956
  /**
2936
- * @description Partner discount in basis points
2957
+ * @description Partner discount in basis points (deprecated, always 0)
2937
2958
  * @example 0
2938
2959
  */
2939
2960
  anyspendPartnerDiscountBps: number;
@@ -2989,7 +3010,7 @@ export interface components {
2989
3010
  */
2990
3011
  anyspendWhaleDiscountBps: number;
2991
3012
  /**
2992
- * @description Partner discount in basis points
3013
+ * @description Partner discount in basis points (deprecated, always 0)
2993
3014
  * @example 0
2994
3015
  */
2995
3016
  anyspendPartnerDiscountBps: number;
@@ -78,7 +78,7 @@ const SettingsProfileCard = () => {
78
78
  // Note: Type assertion needed until @b3dotfun/b3-api package is updated with RegisterUsername type
79
79
  const updatedUser = (await app
80
80
  .service("users")
81
- .registerUsername({ username: b3Username, message: usernameSignMessage, hash: usernameSignature }, {}));
81
+ .registerUsername({ username: sanitizedUsername, message: usernameSignMessage, hash: usernameSignature }, {}));
82
82
  // Update user state - registerUsername returns an array with single user
83
83
  setUser(Array.isArray(updatedUser) ? updatedUser[0] : updatedUser);
84
84
  // Refresh profile to get updated data
@@ -131,6 +131,8 @@ export interface AnySpendModalProps extends BaseModalProps {
131
131
  hideHeader?: boolean;
132
132
  /** When true, disables URL parameter management for swap configuration */
133
133
  disableUrlParamManagement?: boolean;
134
+ /** Staging environment support */
135
+ isStaging?: boolean;
134
136
  }
135
137
  /**
136
138
  * Props for the AnySpend NFT modal
@@ -466,6 +468,8 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
466
468
  activeTab?: "crypto" | "fiat";
467
469
  /** Force fiat payment */
468
470
  forceFiatPayment?: boolean;
471
+ /** Staging environment support */
472
+ isStaging?: boolean;
469
473
  }
470
474
  /**
471
475
  * Props for the AnySpend Deposit modal
@@ -39,9 +39,9 @@ export interface AnySpendCollectorClubPurchaseProps {
39
39
  */
40
40
  spenderAddress?: string;
41
41
  /**
42
- * Collector Club Shop contract address (defaults to Base mainnet shop)
42
+ * Use staging contract address instead of production
43
43
  */
44
- ccShopAddress?: string;
44
+ isStaging?: boolean;
45
45
  /**
46
46
  * Success callback
47
47
  */
@@ -70,4 +70,4 @@ export interface AnySpendCollectorClubPurchaseProps {
70
70
  */
71
71
  forceFiatPayment?: boolean;
72
72
  }
73
- export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, ccShopAddress, spenderAddress, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
73
+ export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, isStaging, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
@@ -5,7 +5,7 @@ import { VisitorData } from "../types/fingerprint";
5
5
  export declare const anyspendService: {
6
6
  getTokenList: (chainId: number, query: string) => Promise<components["schemas"]["Token"][]>;
7
7
  getToken: (chainId: number, tokenAddress: string) => Promise<components["schemas"]["Token"]>;
8
- getQuote: (req: GetQuoteRequest) => Promise<GetQuoteResponse>;
8
+ getQuote: (req: GetQuoteRequest, partnerId?: string) => Promise<GetQuoteResponse>;
9
9
  createOrder: ({ recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, clientReferenceId, visitorData, }: {
10
10
  recipientAddress: string;
11
11
  type: string;
@@ -928,6 +928,8 @@ export interface paths {
928
928
  * @enum {string}
929
929
  */
930
930
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
931
+ /** @description Optional partner ID */
932
+ partnerId?: string;
931
933
  } | {
932
934
  /**
933
935
  * @description Order type for X402 swap
@@ -969,6 +971,8 @@ export interface paths {
969
971
  * @enum {string}
970
972
  */
971
973
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
974
+ /** @description Optional partner ID */
975
+ partnerId?: string;
972
976
  } | {
973
977
  /**
974
978
  * @description Order type for custom execution
@@ -1016,6 +1020,8 @@ export interface paths {
1016
1020
  * @enum {string}
1017
1021
  */
1018
1022
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1023
+ /** @description Optional partner ID */
1024
+ partnerId?: string;
1019
1025
  } | {
1020
1026
  /** @enum {string} */
1021
1027
  type: "mint_nft";
@@ -1030,6 +1036,8 @@ export interface paths {
1030
1036
  recipientAddress?: string;
1031
1037
  /** @enum {string} */
1032
1038
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1039
+ /** @description Optional partner ID */
1040
+ partnerId?: string;
1033
1041
  contractAddress: string;
1034
1042
  tokenId?: number | null;
1035
1043
  /** @enum {string} */
@@ -1049,6 +1057,8 @@ export interface paths {
1049
1057
  recipientAddress?: string;
1050
1058
  /** @enum {string} */
1051
1059
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1060
+ /** @description Optional partner ID */
1061
+ partnerId?: string;
1052
1062
  contractAddress: string;
1053
1063
  price: string;
1054
1064
  } | {
@@ -1065,6 +1075,8 @@ export interface paths {
1065
1075
  recipientAddress?: string;
1066
1076
  /** @enum {string} */
1067
1077
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1078
+ /** @description Optional partner ID */
1079
+ partnerId?: string;
1068
1080
  contractAddress: string;
1069
1081
  fundAmount: string;
1070
1082
  } | {
@@ -1108,6 +1120,8 @@ export interface paths {
1108
1120
  * @enum {string}
1109
1121
  */
1110
1122
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1123
+ /** @description Optional partner ID */
1124
+ partnerId?: string;
1111
1125
  } | {
1112
1126
  /**
1113
1127
  * @description Order type for custom exact in execution
@@ -1149,6 +1163,8 @@ export interface paths {
1149
1163
  * @enum {string}
1150
1164
  */
1151
1165
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1166
+ /** @description Optional partner ID */
1167
+ partnerId?: string;
1152
1168
  };
1153
1169
  };
1154
1170
  };
@@ -1896,6 +1912,11 @@ export interface components {
1896
1912
  * @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
1897
1913
  */
1898
1914
  spenderAddress?: string;
1915
+ /**
1916
+ * @description Native token value to send with the transaction (in wei)
1917
+ * @example 1000000000000000000
1918
+ */
1919
+ value?: string;
1899
1920
  /**
1900
1921
  * @description Optional action identifier used for display purposes
1901
1922
  * @example stake B3
@@ -2933,7 +2954,7 @@ export interface components {
2933
2954
  */
2934
2955
  anyspendWhaleDiscountBps: number;
2935
2956
  /**
2936
- * @description Partner discount in basis points
2957
+ * @description Partner discount in basis points (deprecated, always 0)
2937
2958
  * @example 0
2938
2959
  */
2939
2960
  anyspendPartnerDiscountBps: number;
@@ -2989,7 +3010,7 @@ export interface components {
2989
3010
  */
2990
3011
  anyspendWhaleDiscountBps: number;
2991
3012
  /**
2992
- * @description Partner discount in basis points
3013
+ * @description Partner discount in basis points (deprecated, always 0)
2993
3014
  * @example 0
2994
3015
  */
2995
3016
  anyspendPartnerDiscountBps: number;
@@ -131,6 +131,8 @@ export interface AnySpendModalProps extends BaseModalProps {
131
131
  hideHeader?: boolean;
132
132
  /** When true, disables URL parameter management for swap configuration */
133
133
  disableUrlParamManagement?: boolean;
134
+ /** Staging environment support */
135
+ isStaging?: boolean;
134
136
  }
135
137
  /**
136
138
  * Props for the AnySpend NFT modal
@@ -466,6 +468,8 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
466
468
  activeTab?: "crypto" | "fiat";
467
469
  /** Force fiat payment */
468
470
  forceFiatPayment?: boolean;
471
+ /** Staging environment support */
472
+ isStaging?: boolean;
469
473
  }
470
474
  /**
471
475
  * Props for the AnySpend Deposit modal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.1.6",
3
+ "version": "0.1.61",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -32,8 +32,9 @@ import React, { useMemo } from "react";
32
32
  import { encodeFunctionData } from "viem";
33
33
  import { AnySpendCustom } from "./AnySpendCustom";
34
34
 
35
- // Default Collector Club Shop contract on Base
36
- const DEFAULT_CC_SHOP_ADDRESS = "0x47366E64E4917dd4DdC04Fb9DC507c1dD2b87294";
35
+ // Collector Club Shop contract addresses on Base
36
+ const CC_SHOP_ADDRESS = "0x47366E64E4917dd4DdC04Fb9DC507c1dD2b87294";
37
+ const CC_SHOP_ADDRESS_STAGING = "0x8b751143342ac41eB965E55430e3F7Adf6BE01fA";
37
38
  const BASE_CHAIN_ID = 8453;
38
39
 
39
40
  // ABI for buyPacksFor function only
@@ -87,9 +88,9 @@ export interface AnySpendCollectorClubPurchaseProps {
87
88
  */
88
89
  spenderAddress?: string;
89
90
  /**
90
- * Collector Club Shop contract address (defaults to Base mainnet shop)
91
+ * Use staging contract address instead of production
91
92
  */
92
- ccShopAddress?: string;
93
+ isStaging?: boolean;
93
94
  /**
94
95
  * Success callback
95
96
  */
@@ -128,8 +129,8 @@ export function AnySpendCollectorClubPurchase({
128
129
  pricePerPack,
129
130
  paymentToken = USDC_BASE,
130
131
  recipientAddress,
131
- ccShopAddress = DEFAULT_CC_SHOP_ADDRESS,
132
132
  spenderAddress,
133
+ isStaging = false,
133
134
  onSuccess,
134
135
  header,
135
136
  showRecipient = true,
@@ -137,6 +138,8 @@ export function AnySpendCollectorClubPurchase({
137
138
  packType,
138
139
  forceFiatPayment,
139
140
  }: AnySpendCollectorClubPurchaseProps) {
141
+ const ccShopAddress = isStaging ? CC_SHOP_ADDRESS_STAGING : CC_SHOP_ADDRESS;
142
+
140
143
  // Calculate total amount needed (pricePerPack * packAmount)
141
144
  const totalAmount = useMemo(() => {
142
145
  try {
@@ -1,4 +1,5 @@
1
1
  import { anyspendService } from "@b3dotfun/sdk/anyspend/services/anyspend";
2
+ import { useB3Config } from "@b3dotfun/sdk/global-account/react";
2
3
  import { useQuery } from "@tanstack/react-query";
3
4
  import { useMemo } from "react";
4
5
  import { GetQuoteRequest, GetQuoteResponse } from "../../types/api_req_res";
@@ -16,10 +17,12 @@ export type UseAnyspendQuoteResult = {
16
17
  refetchAnyspendQuote: () => void;
17
18
  };
18
19
  export function useAnyspendQuote(req: GetQuoteRequest): UseAnyspendQuoteResult {
20
+ const { partnerId } = useB3Config();
21
+
19
22
  const { data, isLoading, refetch, error } = useQuery({
20
- queryKey: ["useAnyspendQuote", JSON.stringify(req)],
23
+ queryKey: ["useAnyspendQuote", JSON.stringify(req), partnerId],
21
24
  queryFn: (): Promise<GetQuoteResponse> => {
22
- return anyspendService.getQuote(req);
25
+ return anyspendService.getQuote(req, partnerId);
23
26
  },
24
27
  enabled: Boolean(
25
28
  req.srcChain &&
@@ -40,14 +40,14 @@ export const anyspendService = {
40
40
  return token;
41
41
  },
42
42
 
43
- getQuote: async (req: GetQuoteRequest): Promise<GetQuoteResponse> => {
43
+ getQuote: async (req: GetQuoteRequest, partnerId?: string): Promise<GetQuoteResponse> => {
44
44
  const url = `${ANYSPEND_MAINNET_BASE_URL}/orders/quote`;
45
45
  const response = await fetch(url, {
46
46
  method: "POST",
47
47
  headers: {
48
48
  "Content-Type": "application/json",
49
49
  },
50
- body: JSON.stringify(req),
50
+ body: JSON.stringify({ ...req, partnerId }),
51
51
  });
52
52
  const data: GetQuoteResponse = await response.json();
53
53
  if (response.status !== 200) throw new Error(data.message);
@@ -930,6 +930,8 @@ export interface paths {
930
930
  * @enum {string}
931
931
  */
932
932
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
933
+ /** @description Optional partner ID */
934
+ partnerId?: string;
933
935
  }
934
936
  | {
935
937
  /**
@@ -972,6 +974,8 @@ export interface paths {
972
974
  * @enum {string}
973
975
  */
974
976
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
977
+ /** @description Optional partner ID */
978
+ partnerId?: string;
975
979
  }
976
980
  | {
977
981
  /**
@@ -1020,6 +1024,8 @@ export interface paths {
1020
1024
  * @enum {string}
1021
1025
  */
1022
1026
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1027
+ /** @description Optional partner ID */
1028
+ partnerId?: string;
1023
1029
  }
1024
1030
  | {
1025
1031
  /** @enum {string} */
@@ -1035,6 +1041,8 @@ export interface paths {
1035
1041
  recipientAddress?: string;
1036
1042
  /** @enum {string} */
1037
1043
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1044
+ /** @description Optional partner ID */
1045
+ partnerId?: string;
1038
1046
  contractAddress: string;
1039
1047
  tokenId?: number | null;
1040
1048
  /** @enum {string} */
@@ -1055,6 +1063,8 @@ export interface paths {
1055
1063
  recipientAddress?: string;
1056
1064
  /** @enum {string} */
1057
1065
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1066
+ /** @description Optional partner ID */
1067
+ partnerId?: string;
1058
1068
  contractAddress: string;
1059
1069
  price: string;
1060
1070
  }
@@ -1072,6 +1082,8 @@ export interface paths {
1072
1082
  recipientAddress?: string;
1073
1083
  /** @enum {string} */
1074
1084
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1085
+ /** @description Optional partner ID */
1086
+ partnerId?: string;
1075
1087
  contractAddress: string;
1076
1088
  fundAmount: string;
1077
1089
  }
@@ -1116,6 +1128,8 @@ export interface paths {
1116
1128
  * @enum {string}
1117
1129
  */
1118
1130
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1131
+ /** @description Optional partner ID */
1132
+ partnerId?: string;
1119
1133
  }
1120
1134
  | {
1121
1135
  /**
@@ -1158,6 +1172,8 @@ export interface paths {
1158
1172
  * @enum {string}
1159
1173
  */
1160
1174
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
1175
+ /** @description Optional partner ID */
1176
+ partnerId?: string;
1161
1177
  };
1162
1178
  };
1163
1179
  };
@@ -1905,6 +1921,11 @@ export interface components {
1905
1921
  * @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
1906
1922
  */
1907
1923
  spenderAddress?: string;
1924
+ /**
1925
+ * @description Native token value to send with the transaction (in wei)
1926
+ * @example 1000000000000000000
1927
+ */
1928
+ value?: string;
1908
1929
  /**
1909
1930
  * @description Optional action identifier used for display purposes
1910
1931
  * @example stake B3
@@ -2974,7 +2995,7 @@ export interface components {
2974
2995
  */
2975
2996
  anyspendWhaleDiscountBps: number;
2976
2997
  /**
2977
- * @description Partner discount in basis points
2998
+ * @description Partner discount in basis points (deprecated, always 0)
2978
2999
  * @example 0
2979
3000
  */
2980
3001
  anyspendPartnerDiscountBps: number;
@@ -3031,7 +3052,7 @@ export interface components {
3031
3052
  */
3032
3053
  anyspendWhaleDiscountBps: number;
3033
3054
  /**
3034
- * @description Partner discount in basis points
3055
+ * @description Partner discount in basis points (deprecated, always 0)
3035
3056
  * @example 0
3036
3057
  */
3037
3058
  anyspendPartnerDiscountBps: number;
@@ -94,7 +94,7 @@ const SettingsProfileCard = () => {
94
94
  const updatedUser = (await app
95
95
  .service("users")
96
96
  .registerUsername(
97
- { username: b3Username, message: usernameSignMessage, hash: usernameSignature },
97
+ { username: sanitizedUsername, message: usernameSignMessage, hash: usernameSignature },
98
98
  {} as any,
99
99
  )) as unknown as Users;
100
100
  // Update user state - registerUsername returns an array with single user
@@ -137,6 +137,8 @@ export interface AnySpendModalProps extends BaseModalProps {
137
137
  hideHeader?: boolean;
138
138
  /** When true, disables URL parameter management for swap configuration */
139
139
  disableUrlParamManagement?: boolean;
140
+ /** Staging environment support */
141
+ isStaging?: boolean;
140
142
  }
141
143
 
142
144
  /**
@@ -493,6 +495,8 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
493
495
  activeTab?: "crypto" | "fiat";
494
496
  /** Force fiat payment */
495
497
  forceFiatPayment?: boolean;
498
+ /** Staging environment support */
499
+ isStaging?: boolean;
496
500
  }
497
501
 
498
502
  /**