@b3dotfun/sdk 0.0.19-alpha.1 → 0.0.19

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 (38) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +1 -0
  2. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -0
  3. package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +1 -0
  4. package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +1 -0
  5. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
  6. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +4 -0
  7. package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.js +1 -1
  8. package/dist/cjs/anyspend/react/hooks/useStripeSupport.d.ts +1 -1
  9. package/dist/cjs/anyspend/react/hooks/useStripeSupport.js +4 -4
  10. package/dist/cjs/anyspend/services/anyspend.d.ts +1 -1
  11. package/dist/cjs/anyspend/services/anyspend.js +2 -1
  12. package/dist/cjs/anyspend/types/api.d.ts +16 -1
  13. package/dist/esm/anyspend/react/components/AnySpend.js +1 -0
  14. package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -0
  15. package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +1 -0
  16. package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +1 -0
  17. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
  18. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +4 -0
  19. package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.js +1 -1
  20. package/dist/esm/anyspend/react/hooks/useStripeSupport.d.ts +1 -1
  21. package/dist/esm/anyspend/react/hooks/useStripeSupport.js +4 -4
  22. package/dist/esm/anyspend/services/anyspend.d.ts +1 -1
  23. package/dist/esm/anyspend/services/anyspend.js +2 -1
  24. package/dist/esm/anyspend/types/api.d.ts +16 -1
  25. package/dist/types/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
  26. package/dist/types/anyspend/react/hooks/useStripeSupport.d.ts +1 -1
  27. package/dist/types/anyspend/services/anyspend.d.ts +1 -1
  28. package/dist/types/anyspend/types/api.d.ts +16 -1
  29. package/package.json +1 -1
  30. package/src/anyspend/react/components/AnySpend.tsx +1 -0
  31. package/src/anyspend/react/components/AnySpendCustom.tsx +1 -0
  32. package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +1 -0
  33. package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +1 -0
  34. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +6 -0
  35. package/src/anyspend/react/hooks/useGeoOnrampOptions.ts +1 -0
  36. package/src/anyspend/react/hooks/useStripeSupport.ts +4 -3
  37. package/src/anyspend/services/anyspend.ts +2 -0
  38. package/src/anyspend/types/api.ts +16 -1
@@ -725,6 +725,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, isMai
725
725
  vendor: vendor,
726
726
  paymentMethod: paymentMethodString,
727
727
  country: geoData?.country || "US",
728
+ ipAddress: geoData?.ip,
728
729
  redirectUrl: window.location.origin === "https://basement.fun" ? "https://basement.fun/deposit" : window.location.origin,
729
730
  },
730
731
  expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
@@ -306,6 +306,7 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
306
306
  vendor: onramp.vendor,
307
307
  paymentMethod: onramp.paymentMethod,
308
308
  country: geoData?.country || "US",
309
+ ipAddress: geoData?.ip,
309
310
  redirectUrl: window.location.origin === "https://basement.fun"
310
311
  ? "https://basement.fun/deposit"
311
312
  : window.location.origin,
@@ -79,6 +79,7 @@ function PanelOnrampPaymentInner(props) {
79
79
  vendor: vendor,
80
80
  paymentMethod: paymentMethod || "",
81
81
  country: geoData?.country || "US",
82
+ ipAddress: geoData?.ip,
82
83
  redirectUrl: window.location.origin === "https://basement.fun" ? "https://basement.fun/deposit" : window.location.origin,
83
84
  },
84
85
  expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
@@ -134,6 +134,7 @@ function WebviewOnrampPaymentInner({ srcAmountOnRamp, recipientAddress, destinat
134
134
  vendor: "stripe-web2",
135
135
  paymentMethod: "",
136
136
  country: geoData.country || "US",
137
+ ipAddress: geoData.ip,
137
138
  redirectUrl: `${window.location.origin}${userId ? `?userId=${userId}` : ""}`,
138
139
  },
139
140
  expectedDstAmount: anyspendQuote.data?.currencyOut?.amount?.toString() || "0",
@@ -5,6 +5,7 @@ export type OnrampOptions = {
5
5
  paymentMethod: string;
6
6
  country: string;
7
7
  redirectUrl: string;
8
+ ipAddress?: string;
8
9
  };
9
10
  export type CreateOnrampOrderParams = Omit<CreateOrderParams, "srcChain" | "srcToken" | "srcAmount"> & {
10
11
  srcFiatAmount: string;
@@ -24,6 +24,10 @@ function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
24
24
  mutationFn: async (params) => {
25
25
  const { isMainnet, recipientAddress, orderType, dstChain, dstToken, srcFiatAmount, onramp, creatorAddress, expectedDstAmount, nft, tournament, payload, partnerId, } = params;
26
26
  try {
27
+ // Validate Stripe onramp options
28
+ if (onramp.vendor === "stripe" && !onramp.ipAddress) {
29
+ throw new Error("IP address is required for Stripe onramp");
30
+ }
27
31
  // Validate required onramp fields
28
32
  if (!onramp.vendor || !onramp.country) {
29
33
  throw new Error("Missing required onramp fields: vendor, country");
@@ -16,7 +16,7 @@ function useGeoOnrampOptions(isMainnet, srcFiatAmount) {
16
16
  // Use existing hooks
17
17
  const { geoData, loading: isLoadingGeo, error: geoError } = (0, useGetGeo_1.useGetGeo)();
18
18
  const { coinbaseOnrampOptions, isLoadingCoinbaseOnrampOptions, coinbaseOnrampOptionsError } = (0, useCoinbaseOnrampOptions_1.useCoinbaseOnrampOptions)(isMainnet, geoData?.country, visitorData);
19
- const { isStripeOnrampSupported, stripeWeb2Support, isLoadingStripeSupport, stripeSupportError } = (0, useStripeSupport_1.useStripeSupport)(isMainnet, srcFiatAmount, visitorData);
19
+ const { isStripeOnrampSupported, stripeWeb2Support, isLoadingStripeSupport, stripeSupportError } = (0, useStripeSupport_1.useStripeSupport)(isMainnet, geoData?.ip || "", srcFiatAmount, visitorData);
20
20
  // Calculate available payment methods based on the amount
21
21
  const coinbaseAvailablePaymentMethods = (0, react_1.useMemo)(() => {
22
22
  if (!coinbaseOnrampOptions?.paymentCurrencies?.[0]?.limits || !srcFiatAmount)
@@ -1,5 +1,5 @@
1
1
  import { VisitorData } from "../../../anyspend/types/fingerprint";
2
- export declare function useStripeSupport(isMainnet: boolean, usdAmount?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
2
+ export declare function useStripeSupport(isMainnet: boolean, ipAddress: string, usdAmount?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
3
3
  isStripeOnrampSupported: boolean;
4
4
  stripeWeb2Support: {
5
5
  isSupport: false;
@@ -4,11 +4,11 @@ exports.useStripeSupport = useStripeSupport;
4
4
  const anyspend_1 = require("../../../anyspend/services/anyspend");
5
5
  const react_query_1 = require("@tanstack/react-query");
6
6
  const react_1 = require("react");
7
- function useStripeSupport(isMainnet, usdAmount, visitorData, isLoadingVisitorData) {
7
+ function useStripeSupport(isMainnet, ipAddress, usdAmount, visitorData, isLoadingVisitorData) {
8
8
  const { data, isLoading, error, refetch } = (0, react_query_1.useQuery)({
9
- queryKey: ["useStripeSupport", isMainnet, usdAmount, visitorData?.requestId, visitorData?.visitorId],
10
- queryFn: () => anyspend_1.anyspendService.checkStripeSupport(isMainnet, usdAmount, visitorData),
11
- enabled: !isLoadingVisitorData,
9
+ queryKey: ["useStripeSupport", isMainnet, ipAddress, usdAmount, visitorData?.requestId, visitorData?.visitorId],
10
+ queryFn: () => anyspend_1.anyspendService.checkStripeSupport(isMainnet, ipAddress, usdAmount, visitorData),
11
+ enabled: !!ipAddress && !isLoadingVisitorData,
12
12
  });
13
13
  return (0, react_1.useMemo)(() => ({
14
14
  isStripeOnrampSupported: data?.stripeOnramp || false,
@@ -30,7 +30,7 @@ export declare const anyspendService: {
30
30
  getOrderAndTransactions: (isMainnet: boolean, orderId: string | undefined) => Promise<GetOrderAndTxsResponse>;
31
31
  getOrderHistory: (isMainnet: boolean, creatorAddress: string | undefined, limit?: number, offset?: number) => Promise<GetOrderHistoryResponse>;
32
32
  getCoinbaseOnrampOptions: (isMainnet: boolean, country: string, visitorData?: VisitorData) => Promise<GetCoinbaseOnrampOptionsResponse>;
33
- checkStripeSupport: (isMainnet: boolean, usdAmount?: string, visitorData?: VisitorData) => Promise<{
33
+ checkStripeSupport: (isMainnet: boolean, ipAddress: string, usdAmount?: string, visitorData?: VisitorData) => Promise<{
34
34
  stripeOnramp: boolean;
35
35
  stripeWeb2: components["schemas"]["StripeWeb2Support"];
36
36
  }>;
@@ -96,8 +96,9 @@ exports.anyspendService = {
96
96
  const data = await response.json();
97
97
  return data;
98
98
  },
99
- checkStripeSupport: async (isMainnet, usdAmount, visitorData) => {
99
+ checkStripeSupport: async (isMainnet, ipAddress, usdAmount, visitorData) => {
100
100
  const params = new URLSearchParams({
101
+ ipAddress,
101
102
  usdAmount: usdAmount || "",
102
103
  });
103
104
  const response = await fetch(`${isMainnet ? constants_1.ANYSPEND_MAINNET_BASE_URL : constants_1.ANYSPEND_TESTNET_BASE_URL}/onramp/stripe/supported?${params.toString()}`, {
@@ -238,7 +238,12 @@ export interface paths {
238
238
  */
239
239
  get: {
240
240
  parameters: {
241
- query?: {
241
+ query: {
242
+ /**
243
+ * @description IP address to check location-based support
244
+ * @example 192.168.1.1
245
+ */
246
+ ipAddress: string;
242
247
  /**
243
248
  * @description Optional USD amount for transaction limit checks
244
249
  * @example 100.00
@@ -898,6 +903,11 @@ export interface components {
898
903
  * @example
899
904
  */
900
905
  paymentMethod?: string;
906
+ /**
907
+ * @description User's IP address
908
+ * @example 96.225.86.216
909
+ */
910
+ ipAddress?: string;
901
911
  /**
902
912
  * @description Redirect URL after payment
903
913
  * @example https://www.anyspend.com
@@ -926,6 +936,11 @@ export interface components {
926
936
  * @example SG
927
937
  */
928
938
  country?: string;
939
+ /**
940
+ * @description User's IP address
941
+ * @example 149.88.23.87
942
+ */
943
+ ipAddress?: string;
929
944
  /**
930
945
  * @description URL to redirect after payment
931
946
  * @example https://www.anyspend.com
@@ -718,6 +718,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, isMai
718
718
  vendor: vendor,
719
719
  paymentMethod: paymentMethodString,
720
720
  country: geoData?.country || "US",
721
+ ipAddress: geoData?.ip,
721
722
  redirectUrl: window.location.origin === "https://basement.fun" ? "https://basement.fun/deposit" : window.location.origin,
722
723
  },
723
724
  expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
@@ -300,6 +300,7 @@ export function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", re
300
300
  vendor: onramp.vendor,
301
301
  paymentMethod: onramp.paymentMethod,
302
302
  country: geoData?.country || "US",
303
+ ipAddress: geoData?.ip,
303
304
  redirectUrl: window.location.origin === "https://basement.fun"
304
305
  ? "https://basement.fun/deposit"
305
306
  : window.location.origin,
@@ -73,6 +73,7 @@ function PanelOnrampPaymentInner(props) {
73
73
  vendor: vendor,
74
74
  paymentMethod: paymentMethod || "",
75
75
  country: geoData?.country || "US",
76
+ ipAddress: geoData?.ip,
76
77
  redirectUrl: window.location.origin === "https://basement.fun" ? "https://basement.fun/deposit" : window.location.origin,
77
78
  },
78
79
  expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
@@ -128,6 +128,7 @@ function WebviewOnrampPaymentInner({ srcAmountOnRamp, recipientAddress, destinat
128
128
  vendor: "stripe-web2",
129
129
  paymentMethod: "",
130
130
  country: geoData.country || "US",
131
+ ipAddress: geoData.ip,
131
132
  redirectUrl: `${window.location.origin}${userId ? `?userId=${userId}` : ""}`,
132
133
  },
133
134
  expectedDstAmount: anyspendQuote.data?.currencyOut?.amount?.toString() || "0",
@@ -5,6 +5,7 @@ export type OnrampOptions = {
5
5
  paymentMethod: string;
6
6
  country: string;
7
7
  redirectUrl: string;
8
+ ipAddress?: string;
8
9
  };
9
10
  export type CreateOnrampOrderParams = Omit<CreateOrderParams, "srcChain" | "srcToken" | "srcAmount"> & {
10
11
  srcFiatAmount: string;
@@ -21,6 +21,10 @@ export function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
21
21
  mutationFn: async (params) => {
22
22
  const { isMainnet, recipientAddress, orderType, dstChain, dstToken, srcFiatAmount, onramp, creatorAddress, expectedDstAmount, nft, tournament, payload, partnerId, } = params;
23
23
  try {
24
+ // Validate Stripe onramp options
25
+ if (onramp.vendor === "stripe" && !onramp.ipAddress) {
26
+ throw new Error("IP address is required for Stripe onramp");
27
+ }
24
28
  // Validate required onramp fields
25
29
  if (!onramp.vendor || !onramp.country) {
26
30
  throw new Error("Missing required onramp fields: vendor, country");
@@ -13,7 +13,7 @@ export function useGeoOnrampOptions(isMainnet, srcFiatAmount) {
13
13
  // Use existing hooks
14
14
  const { geoData, loading: isLoadingGeo, error: geoError } = useGetGeo();
15
15
  const { coinbaseOnrampOptions, isLoadingCoinbaseOnrampOptions, coinbaseOnrampOptionsError } = useCoinbaseOnrampOptions(isMainnet, geoData?.country, visitorData);
16
- const { isStripeOnrampSupported, stripeWeb2Support, isLoadingStripeSupport, stripeSupportError } = useStripeSupport(isMainnet, srcFiatAmount, visitorData);
16
+ const { isStripeOnrampSupported, stripeWeb2Support, isLoadingStripeSupport, stripeSupportError } = useStripeSupport(isMainnet, geoData?.ip || "", srcFiatAmount, visitorData);
17
17
  // Calculate available payment methods based on the amount
18
18
  const coinbaseAvailablePaymentMethods = useMemo(() => {
19
19
  if (!coinbaseOnrampOptions?.paymentCurrencies?.[0]?.limits || !srcFiatAmount)
@@ -1,5 +1,5 @@
1
1
  import { VisitorData } from "../../../anyspend/types/fingerprint";
2
- export declare function useStripeSupport(isMainnet: boolean, usdAmount?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
2
+ export declare function useStripeSupport(isMainnet: boolean, ipAddress: string, usdAmount?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
3
3
  isStripeOnrampSupported: boolean;
4
4
  stripeWeb2Support: {
5
5
  isSupport: false;
@@ -1,11 +1,11 @@
1
1
  import { anyspendService } from "../../../anyspend/services/anyspend.js";
2
2
  import { useQuery } from "@tanstack/react-query";
3
3
  import { useMemo } from "react";
4
- export function useStripeSupport(isMainnet, usdAmount, visitorData, isLoadingVisitorData) {
4
+ export function useStripeSupport(isMainnet, ipAddress, usdAmount, visitorData, isLoadingVisitorData) {
5
5
  const { data, isLoading, error, refetch } = useQuery({
6
- queryKey: ["useStripeSupport", isMainnet, usdAmount, visitorData?.requestId, visitorData?.visitorId],
7
- queryFn: () => anyspendService.checkStripeSupport(isMainnet, usdAmount, visitorData),
8
- enabled: !isLoadingVisitorData,
6
+ queryKey: ["useStripeSupport", isMainnet, ipAddress, usdAmount, visitorData?.requestId, visitorData?.visitorId],
7
+ queryFn: () => anyspendService.checkStripeSupport(isMainnet, ipAddress, usdAmount, visitorData),
8
+ enabled: !!ipAddress && !isLoadingVisitorData,
9
9
  });
10
10
  return useMemo(() => ({
11
11
  isStripeOnrampSupported: data?.stripeOnramp || false,
@@ -30,7 +30,7 @@ export declare const anyspendService: {
30
30
  getOrderAndTransactions: (isMainnet: boolean, orderId: string | undefined) => Promise<GetOrderAndTxsResponse>;
31
31
  getOrderHistory: (isMainnet: boolean, creatorAddress: string | undefined, limit?: number, offset?: number) => Promise<GetOrderHistoryResponse>;
32
32
  getCoinbaseOnrampOptions: (isMainnet: boolean, country: string, visitorData?: VisitorData) => Promise<GetCoinbaseOnrampOptionsResponse>;
33
- checkStripeSupport: (isMainnet: boolean, usdAmount?: string, visitorData?: VisitorData) => Promise<{
33
+ checkStripeSupport: (isMainnet: boolean, ipAddress: string, usdAmount?: string, visitorData?: VisitorData) => Promise<{
34
34
  stripeOnramp: boolean;
35
35
  stripeWeb2: components["schemas"]["StripeWeb2Support"];
36
36
  }>;
@@ -90,8 +90,9 @@ export const anyspendService = {
90
90
  const data = await response.json();
91
91
  return data;
92
92
  },
93
- checkStripeSupport: async (isMainnet, usdAmount, visitorData) => {
93
+ checkStripeSupport: async (isMainnet, ipAddress, usdAmount, visitorData) => {
94
94
  const params = new URLSearchParams({
95
+ ipAddress,
95
96
  usdAmount: usdAmount || "",
96
97
  });
97
98
  const response = await fetch(`${isMainnet ? ANYSPEND_MAINNET_BASE_URL : ANYSPEND_TESTNET_BASE_URL}/onramp/stripe/supported?${params.toString()}`, {
@@ -238,7 +238,12 @@ export interface paths {
238
238
  */
239
239
  get: {
240
240
  parameters: {
241
- query?: {
241
+ query: {
242
+ /**
243
+ * @description IP address to check location-based support
244
+ * @example 192.168.1.1
245
+ */
246
+ ipAddress: string;
242
247
  /**
243
248
  * @description Optional USD amount for transaction limit checks
244
249
  * @example 100.00
@@ -898,6 +903,11 @@ export interface components {
898
903
  * @example
899
904
  */
900
905
  paymentMethod?: string;
906
+ /**
907
+ * @description User's IP address
908
+ * @example 96.225.86.216
909
+ */
910
+ ipAddress?: string;
901
911
  /**
902
912
  * @description Redirect URL after payment
903
913
  * @example https://www.anyspend.com
@@ -926,6 +936,11 @@ export interface components {
926
936
  * @example SG
927
937
  */
928
938
  country?: string;
939
+ /**
940
+ * @description User's IP address
941
+ * @example 149.88.23.87
942
+ */
943
+ ipAddress?: string;
929
944
  /**
930
945
  * @description URL to redirect after payment
931
946
  * @example https://www.anyspend.com
@@ -5,6 +5,7 @@ export type OnrampOptions = {
5
5
  paymentMethod: string;
6
6
  country: string;
7
7
  redirectUrl: string;
8
+ ipAddress?: string;
8
9
  };
9
10
  export type CreateOnrampOrderParams = Omit<CreateOrderParams, "srcChain" | "srcToken" | "srcAmount"> & {
10
11
  srcFiatAmount: string;
@@ -1,5 +1,5 @@
1
1
  import { VisitorData } from "@b3dotfun/sdk/anyspend/types/fingerprint";
2
- export declare function useStripeSupport(isMainnet: boolean, usdAmount?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
2
+ export declare function useStripeSupport(isMainnet: boolean, ipAddress: string, usdAmount?: string, visitorData?: VisitorData, isLoadingVisitorData?: boolean): {
3
3
  isStripeOnrampSupported: boolean;
4
4
  stripeWeb2Support: {
5
5
  isSupport: false;
@@ -30,7 +30,7 @@ export declare const anyspendService: {
30
30
  getOrderAndTransactions: (isMainnet: boolean, orderId: string | undefined) => Promise<GetOrderAndTxsResponse>;
31
31
  getOrderHistory: (isMainnet: boolean, creatorAddress: string | undefined, limit?: number, offset?: number) => Promise<GetOrderHistoryResponse>;
32
32
  getCoinbaseOnrampOptions: (isMainnet: boolean, country: string, visitorData?: VisitorData) => Promise<GetCoinbaseOnrampOptionsResponse>;
33
- checkStripeSupport: (isMainnet: boolean, usdAmount?: string, visitorData?: VisitorData) => Promise<{
33
+ checkStripeSupport: (isMainnet: boolean, ipAddress: string, usdAmount?: string, visitorData?: VisitorData) => Promise<{
34
34
  stripeOnramp: boolean;
35
35
  stripeWeb2: components["schemas"]["StripeWeb2Support"];
36
36
  }>;
@@ -238,7 +238,12 @@ export interface paths {
238
238
  */
239
239
  get: {
240
240
  parameters: {
241
- query?: {
241
+ query: {
242
+ /**
243
+ * @description IP address to check location-based support
244
+ * @example 192.168.1.1
245
+ */
246
+ ipAddress: string;
242
247
  /**
243
248
  * @description Optional USD amount for transaction limit checks
244
249
  * @example 100.00
@@ -898,6 +903,11 @@ export interface components {
898
903
  * @example
899
904
  */
900
905
  paymentMethod?: string;
906
+ /**
907
+ * @description User's IP address
908
+ * @example 96.225.86.216
909
+ */
910
+ ipAddress?: string;
901
911
  /**
902
912
  * @description Redirect URL after payment
903
913
  * @example https://www.anyspend.com
@@ -926,6 +936,11 @@ export interface components {
926
936
  * @example SG
927
937
  */
928
938
  country?: string;
939
+ /**
940
+ * @description User's IP address
941
+ * @example 149.88.23.87
942
+ */
943
+ ipAddress?: string;
929
944
  /**
930
945
  * @description URL to redirect after payment
931
946
  * @example https://www.anyspend.com
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.19-alpha.1",
3
+ "version": "0.0.19",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -878,6 +878,7 @@ function AnySpendInner({
878
878
  vendor: vendor,
879
879
  paymentMethod: paymentMethodString,
880
880
  country: geoData?.country || "US",
881
+ ipAddress: geoData?.ip,
881
882
  redirectUrl:
882
883
  window.location.origin === "https://basement.fun" ? "https://basement.fun/deposit" : window.location.origin,
883
884
  },
@@ -440,6 +440,7 @@ export function AnySpendCustom({
440
440
  vendor: onramp.vendor,
441
441
  paymentMethod: onramp.paymentMethod,
442
442
  country: geoData?.country || "US",
443
+ ipAddress: geoData?.ip,
443
444
  redirectUrl:
444
445
  window.location.origin === "https://basement.fun"
445
446
  ? "https://basement.fun/deposit"
@@ -143,6 +143,7 @@ function PanelOnrampPaymentInner(props: PanelOnrampPaymentProps) {
143
143
  vendor: vendor,
144
144
  paymentMethod: paymentMethod || "",
145
145
  country: geoData?.country || "US",
146
+ ipAddress: geoData?.ip,
146
147
  redirectUrl:
147
148
  window.location.origin === "https://basement.fun" ? "https://basement.fun/deposit" : window.location.origin,
148
149
  },
@@ -213,6 +213,7 @@ function WebviewOnrampPaymentInner({
213
213
  vendor: "stripe-web2",
214
214
  paymentMethod: "",
215
215
  country: geoData.country || "US",
216
+ ipAddress: geoData.ip,
216
217
  redirectUrl: `${window.location.origin}${userId ? `?userId=${userId}` : ""}`,
217
218
  },
218
219
  expectedDstAmount: anyspendQuote.data?.currencyOut?.amount?.toString() || "0",
@@ -16,6 +16,7 @@ export type OnrampOptions = {
16
16
  paymentMethod: string;
17
17
  country: string;
18
18
  redirectUrl: string;
19
+ ipAddress?: string; // Required for Stripe
19
20
  };
20
21
 
21
22
  export type CreateOnrampOrderParams = Omit<CreateOrderParams, "srcChain" | "srcToken" | "srcAmount"> & {
@@ -59,6 +60,11 @@ export function useAnyspendCreateOnrampOrder({ onSuccess, onError }: UseAnyspend
59
60
  } = params;
60
61
 
61
62
  try {
63
+ // Validate Stripe onramp options
64
+ if (onramp.vendor === "stripe" && !onramp.ipAddress) {
65
+ throw new Error("IP address is required for Stripe onramp");
66
+ }
67
+
62
68
  // Validate required onramp fields
63
69
  if (!onramp.vendor || !onramp.country) {
64
70
  throw new Error("Missing required onramp fields: vendor, country");
@@ -22,6 +22,7 @@ export function useGeoOnrampOptions(isMainnet: boolean, srcFiatAmount: string) {
22
22
  useCoinbaseOnrampOptions(isMainnet, geoData?.country, visitorData);
23
23
  const { isStripeOnrampSupported, stripeWeb2Support, isLoadingStripeSupport, stripeSupportError } = useStripeSupport(
24
24
  isMainnet,
25
+ geoData?.ip || "",
25
26
  srcFiatAmount,
26
27
  visitorData,
27
28
  );
@@ -5,14 +5,15 @@ import { useMemo } from "react";
5
5
 
6
6
  export function useStripeSupport(
7
7
  isMainnet: boolean,
8
+ ipAddress: string,
8
9
  usdAmount?: string,
9
10
  visitorData?: VisitorData,
10
11
  isLoadingVisitorData?: boolean,
11
12
  ) {
12
13
  const { data, isLoading, error, refetch } = useQuery({
13
- queryKey: ["useStripeSupport", isMainnet, usdAmount, visitorData?.requestId, visitorData?.visitorId],
14
- queryFn: () => anyspendService.checkStripeSupport(isMainnet, usdAmount, visitorData),
15
- enabled: !isLoadingVisitorData,
14
+ queryKey: ["useStripeSupport", isMainnet, ipAddress, usdAmount, visitorData?.requestId, visitorData?.visitorId],
15
+ queryFn: () => anyspendService.checkStripeSupport(isMainnet, ipAddress, usdAmount, visitorData),
16
+ enabled: !!ipAddress && !isLoadingVisitorData,
16
17
  });
17
18
 
18
19
  return useMemo(
@@ -170,10 +170,12 @@ export const anyspendService = {
170
170
 
171
171
  checkStripeSupport: async (
172
172
  isMainnet: boolean,
173
+ ipAddress: string,
173
174
  usdAmount?: string,
174
175
  visitorData?: VisitorData,
175
176
  ): Promise<{ stripeOnramp: boolean; stripeWeb2: components["schemas"]["StripeWeb2Support"] }> => {
176
177
  const params = new URLSearchParams({
178
+ ipAddress,
177
179
  usdAmount: usdAmount || "",
178
180
  });
179
181
  const response = await fetch(
@@ -239,7 +239,12 @@ export interface paths {
239
239
  */
240
240
  get: {
241
241
  parameters: {
242
- query?: {
242
+ query: {
243
+ /**
244
+ * @description IP address to check location-based support
245
+ * @example 192.168.1.1
246
+ */
247
+ ipAddress: string;
243
248
  /**
244
249
  * @description Optional USD amount for transaction limit checks
245
250
  * @example 100.00
@@ -904,6 +909,11 @@ export interface components {
904
909
  * @example
905
910
  */
906
911
  paymentMethod?: string;
912
+ /**
913
+ * @description User's IP address
914
+ * @example 96.225.86.216
915
+ */
916
+ ipAddress?: string;
907
917
  /**
908
918
  * @description Redirect URL after payment
909
919
  * @example https://www.anyspend.com
@@ -932,6 +942,11 @@ export interface components {
932
942
  * @example SG
933
943
  */
934
944
  country?: string;
945
+ /**
946
+ * @description User's IP address
947
+ * @example 149.88.23.87
948
+ */
949
+ ipAddress?: string;
935
950
  /**
936
951
  * @description URL to redirect after payment
937
952
  * @example https://www.anyspend.com