@b3dotfun/sdk 0.0.70 → 0.0.71
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.
- package/dist/cjs/anyspend/index.d.ts +1 -0
- package/dist/cjs/anyspend/index.js +1 -0
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +57 -0
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +82 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +3 -1
- package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/index.js +3 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +4 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +4 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +16 -0
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.d.ts +5 -0
- package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +35 -0
- package/dist/cjs/anyspend/services/anyspend.d.ts +2 -1
- package/dist/cjs/anyspend/services/anyspend.js +5 -1
- package/dist/cjs/anyspend/types/api.d.ts +295 -0
- package/dist/cjs/anyspend/utils/validation.d.ts +67 -0
- package/dist/cjs/anyspend/utils/validation.js +157 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +4 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +4 -3
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +1 -0
- package/dist/cjs/global-account/react/components/B3Provider/types.js +1 -0
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +27 -1
- package/dist/esm/anyspend/index.d.ts +1 -0
- package/dist/esm/anyspend/index.js +1 -0
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +57 -0
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +79 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -1
- package/dist/esm/anyspend/react/components/index.d.ts +1 -0
- package/dist/esm/anyspend/react/components/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +4 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +4 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +16 -0
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.d.ts +5 -0
- package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +32 -0
- package/dist/esm/anyspend/services/anyspend.d.ts +2 -1
- package/dist/esm/anyspend/services/anyspend.js +5 -1
- package/dist/esm/anyspend/types/api.d.ts +295 -0
- package/dist/esm/anyspend/utils/validation.d.ts +67 -0
- package/dist/esm/anyspend/utils/validation.js +153 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +3 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +4 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +4 -3
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +1 -0
- package/dist/esm/global-account/react/components/B3Provider/types.js +1 -0
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +27 -1
- package/dist/types/anyspend/index.d.ts +1 -0
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +57 -0
- package/dist/types/anyspend/react/components/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +16 -0
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/types/anyspend/react/hooks/useValidatedClientReferenceId.d.ts +5 -0
- package/dist/types/anyspend/services/anyspend.d.ts +2 -1
- package/dist/types/anyspend/types/api.d.ts +295 -0
- package/dist/types/anyspend/utils/validation.d.ts +67 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +4 -2
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +27 -1
- package/package.json +1 -1
- package/src/anyspend/index.ts +1 -0
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +178 -0
- package/src/anyspend/react/components/AnySpendCustom.tsx +3 -1
- package/src/anyspend/react/components/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +5 -0
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +5 -0
- package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +40 -0
- package/src/anyspend/services/anyspend.ts +6 -0
- package/src/anyspend/types/api.ts +295 -0
- package/src/anyspend/utils/validation.ts +209 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +3 -0
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +6 -0
- package/src/global-account/react/components/B3Provider/types.ts +2 -0
- package/src/global-account/react/stores/useModalStore.ts +29 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export interface ValidationResult {
|
|
2
|
+
isValid: boolean;
|
|
3
|
+
error?: string;
|
|
4
|
+
cleaned?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface StringValidationOptions {
|
|
7
|
+
required?: boolean;
|
|
8
|
+
defaultValue?: () => string;
|
|
9
|
+
minLength?: number;
|
|
10
|
+
maxLength?: number;
|
|
11
|
+
pattern?: RegExp;
|
|
12
|
+
patternErrorMessage?: string;
|
|
13
|
+
trim?: boolean;
|
|
14
|
+
toLowerCase?: boolean;
|
|
15
|
+
toUpperCase?: boolean;
|
|
16
|
+
customValidator?: (value: string) => {
|
|
17
|
+
valid: boolean;
|
|
18
|
+
error?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generic string validator with configurable rules
|
|
23
|
+
*/
|
|
24
|
+
export declare function validateString(value: string | undefined, options: StringValidationOptions): ValidationResult;
|
|
25
|
+
/**
|
|
26
|
+
* Common validation patterns
|
|
27
|
+
*/
|
|
28
|
+
export declare const ValidationPatterns: {
|
|
29
|
+
readonly ALPHANUMERIC: RegExp;
|
|
30
|
+
readonly ALPHANUMERIC_WITH_DASH_UNDERSCORE: RegExp;
|
|
31
|
+
readonly ALPHANUMERIC_WITH_SAFE_CHARS: RegExp;
|
|
32
|
+
readonly SAFE_IDENTIFIER: RegExp;
|
|
33
|
+
readonly NO_CONTROL_CHARS: RegExp;
|
|
34
|
+
readonly URL_SAFE: RegExp;
|
|
35
|
+
readonly NUMERIC: RegExp;
|
|
36
|
+
readonly HEX: RegExp;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Pre-configured validators for common use cases
|
|
40
|
+
*/
|
|
41
|
+
export declare const Validators: {
|
|
42
|
+
/**
|
|
43
|
+
* Validates client reference IDs (alphanumeric + safe chars)
|
|
44
|
+
* Returns undefined if not provided
|
|
45
|
+
*/
|
|
46
|
+
clientReferenceId: (value?: string) => ValidationResult;
|
|
47
|
+
/**
|
|
48
|
+
* Validates alphanumeric strings (letters and numbers only)
|
|
49
|
+
*/
|
|
50
|
+
alphanumeric: (value?: string, required?: boolean) => ValidationResult;
|
|
51
|
+
/**
|
|
52
|
+
* Validates wallet addresses (hex format)
|
|
53
|
+
*/
|
|
54
|
+
walletAddress: (value?: string, required?: boolean) => ValidationResult;
|
|
55
|
+
/**
|
|
56
|
+
* Validates order IDs (UUID format)
|
|
57
|
+
*/
|
|
58
|
+
orderId: (value?: string) => ValidationResult;
|
|
59
|
+
/**
|
|
60
|
+
* Validates URL-safe strings
|
|
61
|
+
*/
|
|
62
|
+
urlSafe: (value?: string, maxLength?: number) => ValidationResult;
|
|
63
|
+
/**
|
|
64
|
+
* Validates safe identifiers (no injection risks)
|
|
65
|
+
*/
|
|
66
|
+
safeIdentifier: (value?: string, required?: boolean) => ValidationResult;
|
|
67
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic string validator with configurable rules
|
|
3
|
+
*/
|
|
4
|
+
export function validateString(value, options) {
|
|
5
|
+
const { required = false, defaultValue, minLength, maxLength, pattern, patternErrorMessage, trim = true, toLowerCase = false, toUpperCase = false, customValidator, } = options;
|
|
6
|
+
// Handle empty/undefined
|
|
7
|
+
if (!value || (trim && value.trim() === "")) {
|
|
8
|
+
if (required && !defaultValue) {
|
|
9
|
+
return { isValid: false, error: "This field is required" };
|
|
10
|
+
}
|
|
11
|
+
if (defaultValue) {
|
|
12
|
+
return { isValid: true, cleaned: defaultValue() };
|
|
13
|
+
}
|
|
14
|
+
return { isValid: true, cleaned: undefined };
|
|
15
|
+
}
|
|
16
|
+
// Pre-processing
|
|
17
|
+
let cleaned = value;
|
|
18
|
+
if (trim)
|
|
19
|
+
cleaned = cleaned.trim();
|
|
20
|
+
if (toLowerCase)
|
|
21
|
+
cleaned = cleaned.toLowerCase();
|
|
22
|
+
if (toUpperCase)
|
|
23
|
+
cleaned = cleaned.toUpperCase();
|
|
24
|
+
// Length validation
|
|
25
|
+
if (minLength !== undefined && cleaned.length < minLength) {
|
|
26
|
+
return {
|
|
27
|
+
isValid: false,
|
|
28
|
+
error: `Minimum length is ${minLength} characters`,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (maxLength !== undefined && cleaned.length > maxLength) {
|
|
32
|
+
return {
|
|
33
|
+
isValid: false,
|
|
34
|
+
error: `Maximum length is ${maxLength} characters`,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
// Pattern validation
|
|
38
|
+
if (pattern && !pattern.test(cleaned)) {
|
|
39
|
+
return {
|
|
40
|
+
isValid: false,
|
|
41
|
+
error: patternErrorMessage || "Invalid format",
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// Custom validation
|
|
45
|
+
if (customValidator) {
|
|
46
|
+
const customResult = customValidator(cleaned);
|
|
47
|
+
if (!customResult.valid) {
|
|
48
|
+
return { isValid: false, error: customResult.error };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return { isValid: true, cleaned };
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Common validation patterns
|
|
55
|
+
*/
|
|
56
|
+
export const ValidationPatterns = {
|
|
57
|
+
ALPHANUMERIC: /^[a-zA-Z0-9]+$/,
|
|
58
|
+
ALPHANUMERIC_WITH_DASH_UNDERSCORE: /^[a-zA-Z0-9_-]+$/,
|
|
59
|
+
ALPHANUMERIC_WITH_SAFE_CHARS: /^[a-zA-Z0-9_.\-]+$/,
|
|
60
|
+
SAFE_IDENTIFIER: /^[a-zA-Z0-9_.\-]+$/, // For IDs, references
|
|
61
|
+
NO_CONTROL_CHARS: /^[^\x00-\x1F\x7F]+$/,
|
|
62
|
+
URL_SAFE: /^[a-zA-Z0-9_.\-~]+$/,
|
|
63
|
+
NUMERIC: /^\d+$/,
|
|
64
|
+
HEX: /^[0-9a-fA-F]+$/,
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Pre-configured validators for common use cases
|
|
68
|
+
*/
|
|
69
|
+
export const Validators = {
|
|
70
|
+
/**
|
|
71
|
+
* Validates client reference IDs (alphanumeric + safe chars)
|
|
72
|
+
* Returns undefined if not provided
|
|
73
|
+
*/
|
|
74
|
+
clientReferenceId: (value) => validateString(value, {
|
|
75
|
+
required: false,
|
|
76
|
+
maxLength: 255,
|
|
77
|
+
pattern: ValidationPatterns.SAFE_IDENTIFIER,
|
|
78
|
+
patternErrorMessage: "Only letters, numbers, hyphens, underscores, and dots allowed",
|
|
79
|
+
trim: true,
|
|
80
|
+
customValidator: val => {
|
|
81
|
+
// Additional security checks
|
|
82
|
+
const dangerous = /('|"|;|--|\/\*|\*\/|<|>|script)/i;
|
|
83
|
+
if (dangerous.test(val)) {
|
|
84
|
+
return {
|
|
85
|
+
valid: false,
|
|
86
|
+
error: "Contains potentially dangerous characters",
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return { valid: true };
|
|
90
|
+
},
|
|
91
|
+
}),
|
|
92
|
+
/**
|
|
93
|
+
* Validates alphanumeric strings (letters and numbers only)
|
|
94
|
+
*/
|
|
95
|
+
alphanumeric: (value, required = false) => validateString(value, {
|
|
96
|
+
required,
|
|
97
|
+
pattern: ValidationPatterns.ALPHANUMERIC,
|
|
98
|
+
patternErrorMessage: "Only letters and numbers allowed",
|
|
99
|
+
trim: true,
|
|
100
|
+
}),
|
|
101
|
+
/**
|
|
102
|
+
* Validates wallet addresses (hex format)
|
|
103
|
+
*/
|
|
104
|
+
walletAddress: (value, required = true) => validateString(value, {
|
|
105
|
+
required,
|
|
106
|
+
minLength: 42,
|
|
107
|
+
maxLength: 42,
|
|
108
|
+
pattern: /^0x[a-fA-F0-9]{40}$/,
|
|
109
|
+
patternErrorMessage: "Invalid wallet address format",
|
|
110
|
+
trim: true,
|
|
111
|
+
toLowerCase: true,
|
|
112
|
+
}),
|
|
113
|
+
/**
|
|
114
|
+
* Validates order IDs (UUID format)
|
|
115
|
+
*/
|
|
116
|
+
orderId: (value) => validateString(value, {
|
|
117
|
+
required: false,
|
|
118
|
+
pattern: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
|
|
119
|
+
patternErrorMessage: "Invalid order ID format",
|
|
120
|
+
trim: true,
|
|
121
|
+
toLowerCase: true,
|
|
122
|
+
}),
|
|
123
|
+
/**
|
|
124
|
+
* Validates URL-safe strings
|
|
125
|
+
*/
|
|
126
|
+
urlSafe: (value, maxLength = 255) => validateString(value, {
|
|
127
|
+
maxLength,
|
|
128
|
+
pattern: ValidationPatterns.URL_SAFE,
|
|
129
|
+
patternErrorMessage: "Contains invalid URL characters",
|
|
130
|
+
trim: true,
|
|
131
|
+
}),
|
|
132
|
+
/**
|
|
133
|
+
* Validates safe identifiers (no injection risks)
|
|
134
|
+
*/
|
|
135
|
+
safeIdentifier: (value, required = false) => validateString(value, {
|
|
136
|
+
required,
|
|
137
|
+
maxLength: 255,
|
|
138
|
+
pattern: ValidationPatterns.SAFE_IDENTIFIER,
|
|
139
|
+
patternErrorMessage: "Invalid identifier format",
|
|
140
|
+
customValidator: val => {
|
|
141
|
+
// Additional security checks
|
|
142
|
+
const dangerous = /('|"|;|--|\/\*|\*\/|<|>|script)/i;
|
|
143
|
+
if (dangerous.test(val)) {
|
|
144
|
+
return {
|
|
145
|
+
valid: false,
|
|
146
|
+
error: "Contains potentially dangerous characters",
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return { valid: true };
|
|
150
|
+
},
|
|
151
|
+
trim: true,
|
|
152
|
+
}),
|
|
153
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AnySpend, AnySpendBondKit, AnySpendBuySpin, AnySpendNFT, AnyspendSignatureMint, AnySpendStakeB3, AnySpendStakeB3ExactIn, AnySpendTournament, OrderHistory, } from "../../../anyspend/react/index.js";
|
|
2
|
+
import { AnySpend, AnySpendBondKit, AnySpendBuySpin, AnySpendCollectorClubPurchase, AnySpendNFT, AnyspendSignatureMint, AnySpendStakeB3, AnySpendStakeB3ExactIn, AnySpendTournament, OrderHistory, } from "../../../anyspend/react/index.js";
|
|
3
3
|
import { AnySpendDepositHype } from "../../../anyspend/react/components/AnyspendDepositHype.js";
|
|
4
4
|
import { AnySpendStakeUpside } from "../../../anyspend/react/components/AnySpendStakeUpside.js";
|
|
5
5
|
import { AnySpendStakeUpsideExactIn } from "../../../anyspend/react/components/AnySpendStakeUpsideExactIn.js";
|
|
@@ -115,6 +115,8 @@ export function B3DynamicModal() {
|
|
|
115
115
|
return _jsx(LinkAccount, { ...contentType });
|
|
116
116
|
case "anySpendDepositHype":
|
|
117
117
|
return _jsx(AnySpendDepositHype, { ...contentType, mode: "modal" });
|
|
118
|
+
case "anySpendCollectorClubPurchase":
|
|
119
|
+
return _jsx(AnySpendCollectorClubPurchase, { ...contentType, mode: "modal" });
|
|
118
120
|
case "avatarEditor":
|
|
119
121
|
return _jsx(AvatarEditor, { onSetAvatar: contentType.onSuccess });
|
|
120
122
|
case "profileEditor":
|
|
@@ -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;
|
|
@@ -28,7 +28,7 @@ const queryClient = new QueryClient();
|
|
|
28
28
|
/**
|
|
29
29
|
* Main B3Provider component
|
|
30
30
|
*/
|
|
31
|
-
export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType = "rest", rpcUrls, partnerId, onConnect, connectors, overrideDefaultConnectors = false, }) {
|
|
31
|
+
export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType = "rest", rpcUrls, partnerId, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, }) {
|
|
32
32
|
// Initialize Google Analytics on mount
|
|
33
33
|
useEffect(() => {
|
|
34
34
|
loadGA4Script();
|
|
@@ -38,12 +38,12 @@ export function B3Provider({ theme = "light", children, accountOverride, environ
|
|
|
38
38
|
setClientType(clientType);
|
|
39
39
|
}, [clientType]);
|
|
40
40
|
const wagmiConfig = createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors });
|
|
41
|
-
return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, children: _jsx(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, partnerId: partnerId, children: _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" }), _jsx(Toaster, { theme: theme, position: toaster?.position, style: toaster?.style })] }) }) }) }) }) }) }));
|
|
41
|
+
return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, children: _jsx(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, partnerId: partnerId, createClientReferenceId: createClientReferenceId, children: _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" }), _jsx(Toaster, { theme: theme, position: toaster?.position, style: toaster?.style })] }) }) }) }) }) }) }));
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Inner provider component that provides the actual B3Context
|
|
45
45
|
*/
|
|
46
|
-
export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, }) {
|
|
46
|
+
export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, createClientReferenceId, }) {
|
|
47
47
|
const activeAccount = useActiveAccount();
|
|
48
48
|
const [manuallySelectedWallet, setManuallySelectedWallet] = useState(undefined);
|
|
49
49
|
const wallets = useConnectedWallets();
|
|
@@ -97,6 +97,7 @@ export function InnerProvider({ children, accountOverride, environment, defaultP
|
|
|
97
97
|
theme,
|
|
98
98
|
clientType,
|
|
99
99
|
partnerId: partnerId,
|
|
100
|
+
createClientReferenceId,
|
|
100
101
|
}, children: _jsx(InnerProvider2, { children: children }) }));
|
|
101
102
|
}
|
|
102
103
|
const InnerProvider2 = ({ children }) => {
|
|
@@ -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;
|
|
@@ -122,6 +122,8 @@ export interface AnySpendModalProps extends BaseModalProps {
|
|
|
122
122
|
destinationTokenChainId?: number;
|
|
123
123
|
/** Custom USD input values for quick amount buttons in fiat onramp */
|
|
124
124
|
customUsdInputValues?: string[];
|
|
125
|
+
/** Client-provided reference ID for tracking orders */
|
|
126
|
+
clientReferenceId?: string;
|
|
125
127
|
}
|
|
126
128
|
/**
|
|
127
129
|
* Props for the AnySpend NFT modal
|
|
@@ -136,6 +138,8 @@ export interface AnySpendNftProps extends BaseModalProps {
|
|
|
136
138
|
recipientAddress?: string;
|
|
137
139
|
/** Callback function called when the NFT is successfully transferred */
|
|
138
140
|
onSuccess?: (txHash?: string) => void;
|
|
141
|
+
/** Client-provided reference ID for tracking orders */
|
|
142
|
+
clientReferenceId?: string;
|
|
139
143
|
}
|
|
140
144
|
/**
|
|
141
145
|
* Props for the AnySpend tournament modal
|
|
@@ -377,10 +381,32 @@ export interface ProfileEditorModalProps extends BaseModalProps {
|
|
|
377
381
|
/** Callback function called when profile is successfully updated */
|
|
378
382
|
onSuccess?: () => void;
|
|
379
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
|
+
}
|
|
380
406
|
/**
|
|
381
407
|
* Union type of all possible modal content types
|
|
382
408
|
*/
|
|
383
|
-
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;
|
|
384
410
|
/**
|
|
385
411
|
* State interface for the modal store
|
|
386
412
|
*/
|
|
@@ -6,6 +6,7 @@ export * from "./utils/json";
|
|
|
6
6
|
export * from "./utils/number";
|
|
7
7
|
export * from "./utils/string";
|
|
8
8
|
export * from "./utils/token";
|
|
9
|
+
export * from "./utils/validation";
|
|
9
10
|
export * from "./constants";
|
|
10
11
|
export * from "./abis/abiUsdcBase";
|
|
11
12
|
export * from "./abis/erc20Staking";
|
|
@@ -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;
|
|
@@ -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";
|
|
@@ -16,6 +16,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
16
16
|
receivedDepositAt: number | null;
|
|
17
17
|
creatorAddress: string | null;
|
|
18
18
|
partnerId: string | null;
|
|
19
|
+
clientReferenceId?: string | null;
|
|
19
20
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
20
21
|
oneClickBuyUrl: string | null;
|
|
21
22
|
stripePaymentIntentId: string | null;
|
|
@@ -45,6 +46,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
45
46
|
receivedDepositAt: number | null;
|
|
46
47
|
creatorAddress: string | null;
|
|
47
48
|
partnerId: string | null;
|
|
49
|
+
clientReferenceId?: string | null;
|
|
48
50
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
49
51
|
oneClickBuyUrl: string | null;
|
|
50
52
|
stripePaymentIntentId: string | null;
|
|
@@ -74,6 +76,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
74
76
|
receivedDepositAt: number | null;
|
|
75
77
|
creatorAddress: string | null;
|
|
76
78
|
partnerId: string | null;
|
|
79
|
+
clientReferenceId?: string | null;
|
|
77
80
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
78
81
|
oneClickBuyUrl: string | null;
|
|
79
82
|
stripePaymentIntentId: string | null;
|
|
@@ -103,6 +106,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
103
106
|
receivedDepositAt: number | null;
|
|
104
107
|
creatorAddress: string | null;
|
|
105
108
|
partnerId: string | null;
|
|
109
|
+
clientReferenceId?: string | null;
|
|
106
110
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
107
111
|
oneClickBuyUrl: string | null;
|
|
108
112
|
stripePaymentIntentId: string | null;
|
|
@@ -132,6 +136,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
132
136
|
receivedDepositAt: number | null;
|
|
133
137
|
creatorAddress: string | null;
|
|
134
138
|
partnerId: string | null;
|
|
139
|
+
clientReferenceId?: string | null;
|
|
135
140
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
136
141
|
oneClickBuyUrl: string | null;
|
|
137
142
|
stripePaymentIntentId: string | null;
|
|
@@ -161,6 +166,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
161
166
|
receivedDepositAt: number | null;
|
|
162
167
|
creatorAddress: string | null;
|
|
163
168
|
partnerId: string | null;
|
|
169
|
+
clientReferenceId?: string | null;
|
|
164
170
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
165
171
|
oneClickBuyUrl: string | null;
|
|
166
172
|
stripePaymentIntentId: string | null;
|
|
@@ -190,6 +196,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
190
196
|
receivedDepositAt: number | null;
|
|
191
197
|
creatorAddress: string | null;
|
|
192
198
|
partnerId: string | null;
|
|
199
|
+
clientReferenceId?: string | null;
|
|
193
200
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
194
201
|
oneClickBuyUrl: string | null;
|
|
195
202
|
stripePaymentIntentId: string | null;
|
|
@@ -219,6 +226,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
219
226
|
receivedDepositAt: number | null;
|
|
220
227
|
creatorAddress: string | null;
|
|
221
228
|
partnerId: string | null;
|
|
229
|
+
clientReferenceId?: string | null;
|
|
222
230
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
223
231
|
oneClickBuyUrl: string | null;
|
|
224
232
|
stripePaymentIntentId: string | null;
|
|
@@ -251,6 +259,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
251
259
|
receivedDepositAt: number | null;
|
|
252
260
|
creatorAddress: string | null;
|
|
253
261
|
partnerId: string | null;
|
|
262
|
+
clientReferenceId?: string | null;
|
|
254
263
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
255
264
|
oneClickBuyUrl: string | null;
|
|
256
265
|
stripePaymentIntentId: string | null;
|
|
@@ -280,6 +289,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
280
289
|
receivedDepositAt: number | null;
|
|
281
290
|
creatorAddress: string | null;
|
|
282
291
|
partnerId: string | null;
|
|
292
|
+
clientReferenceId?: string | null;
|
|
283
293
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
284
294
|
oneClickBuyUrl: string | null;
|
|
285
295
|
stripePaymentIntentId: string | null;
|
|
@@ -309,6 +319,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
309
319
|
receivedDepositAt: number | null;
|
|
310
320
|
creatorAddress: string | null;
|
|
311
321
|
partnerId: string | null;
|
|
322
|
+
clientReferenceId?: string | null;
|
|
312
323
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
313
324
|
oneClickBuyUrl: string | null;
|
|
314
325
|
stripePaymentIntentId: string | null;
|
|
@@ -338,6 +349,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
338
349
|
receivedDepositAt: number | null;
|
|
339
350
|
creatorAddress: string | null;
|
|
340
351
|
partnerId: string | null;
|
|
352
|
+
clientReferenceId?: string | null;
|
|
341
353
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
342
354
|
oneClickBuyUrl: string | null;
|
|
343
355
|
stripePaymentIntentId: string | null;
|
|
@@ -367,6 +379,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
367
379
|
receivedDepositAt: number | null;
|
|
368
380
|
creatorAddress: string | null;
|
|
369
381
|
partnerId: string | null;
|
|
382
|
+
clientReferenceId?: string | null;
|
|
370
383
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
371
384
|
oneClickBuyUrl: string | null;
|
|
372
385
|
stripePaymentIntentId: string | null;
|
|
@@ -396,6 +409,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
396
409
|
receivedDepositAt: number | null;
|
|
397
410
|
creatorAddress: string | null;
|
|
398
411
|
partnerId: string | null;
|
|
412
|
+
clientReferenceId?: string | null;
|
|
399
413
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
400
414
|
oneClickBuyUrl: string | null;
|
|
401
415
|
stripePaymentIntentId: string | null;
|
|
@@ -425,6 +439,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
425
439
|
receivedDepositAt: number | null;
|
|
426
440
|
creatorAddress: string | null;
|
|
427
441
|
partnerId: string | null;
|
|
442
|
+
clientReferenceId?: string | null;
|
|
428
443
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
429
444
|
oneClickBuyUrl: string | null;
|
|
430
445
|
stripePaymentIntentId: string | null;
|
|
@@ -454,6 +469,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
454
469
|
receivedDepositAt: number | null;
|
|
455
470
|
creatorAddress: string | null;
|
|
456
471
|
partnerId: string | null;
|
|
472
|
+
clientReferenceId?: string | null;
|
|
457
473
|
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
458
474
|
oneClickBuyUrl: string | null;
|
|
459
475
|
stripePaymentIntentId: string | null;
|
|
@@ -6,7 +6,7 @@ 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
8
|
getQuote: (req: GetQuoteRequest) => Promise<GetQuoteResponse>;
|
|
9
|
-
createOrder: ({ recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, visitorData, }: {
|
|
9
|
+
createOrder: ({ recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, clientReferenceId, visitorData, }: {
|
|
10
10
|
recipientAddress: string;
|
|
11
11
|
type: string;
|
|
12
12
|
srcChain: number;
|
|
@@ -19,6 +19,7 @@ export declare const anyspendService: {
|
|
|
19
19
|
metadata: Record<string, any>;
|
|
20
20
|
creatorAddress?: string;
|
|
21
21
|
partnerId?: string;
|
|
22
|
+
clientReferenceId?: string;
|
|
22
23
|
visitorData?: VisitorData;
|
|
23
24
|
}) => Promise<{
|
|
24
25
|
success: boolean;
|