@b3dotfun/sdk 0.0.69 → 0.0.70-alpha.1

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 (126) hide show
  1. package/dist/cjs/anyspend/index.d.ts +1 -0
  2. package/dist/cjs/anyspend/index.js +1 -0
  3. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +6 -0
  4. package/dist/cjs/anyspend/react/components/AnySpend.js +13 -1
  5. package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +3 -1
  6. package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +2 -2
  7. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
  8. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -2
  9. package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +1 -0
  10. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +6 -2
  11. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -0
  12. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +3 -1
  13. package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.d.ts +2 -1
  14. package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.js +2 -2
  15. package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +2 -1
  16. package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
  17. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.d.ts +2 -1
  18. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -2
  19. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +2 -1
  20. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
  21. package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.d.ts +2 -1
  22. package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +2 -2
  23. package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
  24. package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
  25. package/dist/cjs/anyspend/react/components/AnySpendTournament.d.ts +2 -0
  26. package/dist/cjs/anyspend/react/components/AnySpendTournament.js +1 -1
  27. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
  28. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
  29. package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.d.ts +2 -1
  30. package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +2 -2
  31. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -1
  32. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +1 -0
  33. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -1
  34. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +16 -0
  35. package/dist/cjs/anyspend/services/anyspend.d.ts +2 -1
  36. package/dist/cjs/anyspend/services/anyspend.js +2 -1
  37. package/dist/cjs/anyspend/types/api.d.ts +295 -0
  38. package/dist/cjs/anyspend/utils/validation.d.ts +67 -0
  39. package/dist/cjs/anyspend/utils/validation.js +157 -0
  40. package/dist/cjs/global-account/react/components/ProfileEditor/ProfileEditor.js +14 -4
  41. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
  42. package/dist/esm/anyspend/index.d.ts +1 -0
  43. package/dist/esm/anyspend/index.js +1 -0
  44. package/dist/esm/anyspend/react/components/AnySpend.d.ts +6 -0
  45. package/dist/esm/anyspend/react/components/AnySpend.js +13 -1
  46. package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +3 -1
  47. package/dist/esm/anyspend/react/components/AnySpendBondKit.js +2 -2
  48. package/dist/esm/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
  49. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -2
  50. package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +1 -0
  51. package/dist/esm/anyspend/react/components/AnySpendCustom.js +6 -2
  52. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -0
  53. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +3 -1
  54. package/dist/esm/anyspend/react/components/AnySpendDepositUpside.d.ts +2 -1
  55. package/dist/esm/anyspend/react/components/AnySpendDepositUpside.js +2 -2
  56. package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +2 -1
  57. package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
  58. package/dist/esm/anyspend/react/components/AnySpendStakeB3.d.ts +2 -1
  59. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -2
  60. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +2 -1
  61. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
  62. package/dist/esm/anyspend/react/components/AnySpendStakeUpside.d.ts +2 -1
  63. package/dist/esm/anyspend/react/components/AnySpendStakeUpside.js +2 -2
  64. package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
  65. package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
  66. package/dist/esm/anyspend/react/components/AnySpendTournament.d.ts +2 -0
  67. package/dist/esm/anyspend/react/components/AnySpendTournament.js +1 -1
  68. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
  69. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
  70. package/dist/esm/anyspend/react/components/AnyspendSignatureMint.d.ts +2 -1
  71. package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +2 -2
  72. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -1
  73. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +1 -0
  74. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -1
  75. package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +16 -0
  76. package/dist/esm/anyspend/services/anyspend.d.ts +2 -1
  77. package/dist/esm/anyspend/services/anyspend.js +2 -1
  78. package/dist/esm/anyspend/types/api.d.ts +295 -0
  79. package/dist/esm/anyspend/utils/validation.d.ts +67 -0
  80. package/dist/esm/anyspend/utils/validation.js +153 -0
  81. package/dist/esm/global-account/react/components/ProfileEditor/ProfileEditor.js +14 -4
  82. package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
  83. package/dist/types/anyspend/index.d.ts +1 -0
  84. package/dist/types/anyspend/react/components/AnySpend.d.ts +6 -0
  85. package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +3 -1
  86. package/dist/types/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
  87. package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +1 -0
  88. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -0
  89. package/dist/types/anyspend/react/components/AnySpendDepositUpside.d.ts +2 -1
  90. package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +2 -1
  91. package/dist/types/anyspend/react/components/AnySpendStakeB3.d.ts +2 -1
  92. package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +2 -1
  93. package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +2 -1
  94. package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
  95. package/dist/types/anyspend/react/components/AnySpendTournament.d.ts +2 -0
  96. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
  97. package/dist/types/anyspend/react/components/AnyspendSignatureMint.d.ts +2 -1
  98. package/dist/types/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +1 -0
  99. package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +16 -0
  100. package/dist/types/anyspend/services/anyspend.d.ts +2 -1
  101. package/dist/types/anyspend/types/api.d.ts +295 -0
  102. package/dist/types/anyspend/utils/validation.d.ts +67 -0
  103. package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
  104. package/package.json +3 -2
  105. package/src/anyspend/index.ts +1 -0
  106. package/src/anyspend/react/components/AnySpend.tsx +23 -0
  107. package/src/anyspend/react/components/AnySpendBondKit.tsx +3 -1
  108. package/src/anyspend/react/components/AnySpendBuySpin.tsx +3 -0
  109. package/src/anyspend/react/components/AnySpendCustom.tsx +8 -1
  110. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +4 -0
  111. package/src/anyspend/react/components/AnySpendDepositUpside.tsx +3 -0
  112. package/src/anyspend/react/components/AnySpendNFT.tsx +3 -0
  113. package/src/anyspend/react/components/AnySpendStakeB3.tsx +3 -0
  114. package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +3 -0
  115. package/src/anyspend/react/components/AnySpendStakeUpside.tsx +3 -0
  116. package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +3 -0
  117. package/src/anyspend/react/components/AnySpendTournament.tsx +3 -0
  118. package/src/anyspend/react/components/AnyspendDepositHype.tsx +3 -0
  119. package/src/anyspend/react/components/AnyspendSignatureMint.tsx +3 -0
  120. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -0
  121. package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +13 -1
  122. package/src/anyspend/services/anyspend.ts +3 -0
  123. package/src/anyspend/types/api.ts +295 -0
  124. package/src/anyspend/utils/validation.ts +209 -0
  125. package/src/global-account/react/components/ProfileEditor/ProfileEditor.tsx +20 -6
  126. package/src/global-account/react/stores/useModalStore.ts +4 -0
@@ -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,157 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Validators = exports.ValidationPatterns = void 0;
4
+ exports.validateString = validateString;
5
+ /**
6
+ * Generic string validator with configurable rules
7
+ */
8
+ function validateString(value, options) {
9
+ const { required = false, defaultValue, minLength, maxLength, pattern, patternErrorMessage, trim = true, toLowerCase = false, toUpperCase = false, customValidator, } = options;
10
+ // Handle empty/undefined
11
+ if (!value || (trim && value.trim() === "")) {
12
+ if (required && !defaultValue) {
13
+ return { isValid: false, error: "This field is required" };
14
+ }
15
+ if (defaultValue) {
16
+ return { isValid: true, cleaned: defaultValue() };
17
+ }
18
+ return { isValid: true, cleaned: undefined };
19
+ }
20
+ // Pre-processing
21
+ let cleaned = value;
22
+ if (trim)
23
+ cleaned = cleaned.trim();
24
+ if (toLowerCase)
25
+ cleaned = cleaned.toLowerCase();
26
+ if (toUpperCase)
27
+ cleaned = cleaned.toUpperCase();
28
+ // Length validation
29
+ if (minLength !== undefined && cleaned.length < minLength) {
30
+ return {
31
+ isValid: false,
32
+ error: `Minimum length is ${minLength} characters`,
33
+ };
34
+ }
35
+ if (maxLength !== undefined && cleaned.length > maxLength) {
36
+ return {
37
+ isValid: false,
38
+ error: `Maximum length is ${maxLength} characters`,
39
+ };
40
+ }
41
+ // Pattern validation
42
+ if (pattern && !pattern.test(cleaned)) {
43
+ return {
44
+ isValid: false,
45
+ error: patternErrorMessage || "Invalid format",
46
+ };
47
+ }
48
+ // Custom validation
49
+ if (customValidator) {
50
+ const customResult = customValidator(cleaned);
51
+ if (!customResult.valid) {
52
+ return { isValid: false, error: customResult.error };
53
+ }
54
+ }
55
+ return { isValid: true, cleaned };
56
+ }
57
+ /**
58
+ * Common validation patterns
59
+ */
60
+ exports.ValidationPatterns = {
61
+ ALPHANUMERIC: /^[a-zA-Z0-9]+$/,
62
+ ALPHANUMERIC_WITH_DASH_UNDERSCORE: /^[a-zA-Z0-9_-]+$/,
63
+ ALPHANUMERIC_WITH_SAFE_CHARS: /^[a-zA-Z0-9_.\-]+$/,
64
+ SAFE_IDENTIFIER: /^[a-zA-Z0-9_.\-]+$/, // For IDs, references
65
+ NO_CONTROL_CHARS: /^[^\x00-\x1F\x7F]+$/,
66
+ URL_SAFE: /^[a-zA-Z0-9_.\-~]+$/,
67
+ NUMERIC: /^\d+$/,
68
+ HEX: /^[0-9a-fA-F]+$/,
69
+ };
70
+ /**
71
+ * Pre-configured validators for common use cases
72
+ */
73
+ exports.Validators = {
74
+ /**
75
+ * Validates client reference IDs (alphanumeric + safe chars)
76
+ * Returns undefined if not provided
77
+ */
78
+ clientReferenceId: (value) => validateString(value, {
79
+ required: false,
80
+ maxLength: 255,
81
+ pattern: exports.ValidationPatterns.SAFE_IDENTIFIER,
82
+ patternErrorMessage: "Only letters, numbers, hyphens, underscores, and dots allowed",
83
+ trim: true,
84
+ customValidator: val => {
85
+ // Additional security checks
86
+ const dangerous = /('|"|;|--|\/\*|\*\/|<|>|script)/i;
87
+ if (dangerous.test(val)) {
88
+ return {
89
+ valid: false,
90
+ error: "Contains potentially dangerous characters",
91
+ };
92
+ }
93
+ return { valid: true };
94
+ },
95
+ }),
96
+ /**
97
+ * Validates alphanumeric strings (letters and numbers only)
98
+ */
99
+ alphanumeric: (value, required = false) => validateString(value, {
100
+ required,
101
+ pattern: exports.ValidationPatterns.ALPHANUMERIC,
102
+ patternErrorMessage: "Only letters and numbers allowed",
103
+ trim: true,
104
+ }),
105
+ /**
106
+ * Validates wallet addresses (hex format)
107
+ */
108
+ walletAddress: (value, required = true) => validateString(value, {
109
+ required,
110
+ minLength: 42,
111
+ maxLength: 42,
112
+ pattern: /^0x[a-fA-F0-9]{40}$/,
113
+ patternErrorMessage: "Invalid wallet address format",
114
+ trim: true,
115
+ toLowerCase: true,
116
+ }),
117
+ /**
118
+ * Validates order IDs (UUID format)
119
+ */
120
+ orderId: (value) => validateString(value, {
121
+ required: false,
122
+ pattern: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
123
+ patternErrorMessage: "Invalid order ID format",
124
+ trim: true,
125
+ toLowerCase: true,
126
+ }),
127
+ /**
128
+ * Validates URL-safe strings
129
+ */
130
+ urlSafe: (value, maxLength = 255) => validateString(value, {
131
+ maxLength,
132
+ pattern: exports.ValidationPatterns.URL_SAFE,
133
+ patternErrorMessage: "Contains invalid URL characters",
134
+ trim: true,
135
+ }),
136
+ /**
137
+ * Validates safe identifiers (no injection risks)
138
+ */
139
+ safeIdentifier: (value, required = false) => validateString(value, {
140
+ required,
141
+ maxLength: 255,
142
+ pattern: exports.ValidationPatterns.SAFE_IDENTIFIER,
143
+ patternErrorMessage: "Invalid identifier format",
144
+ customValidator: val => {
145
+ // Additional security checks
146
+ const dangerous = /('|"|;|--|\/\*|\*\/|<|>|script)/i;
147
+ if (dangerous.test(val)) {
148
+ return {
149
+ valid: false,
150
+ error: "Contains potentially dangerous characters",
151
+ };
152
+ }
153
+ return { valid: true };
154
+ },
155
+ trim: true,
156
+ }),
157
+ };
@@ -6,6 +6,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.ProfileEditor = ProfileEditor;
8
8
  const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const ens_normalize_1 = require("@adraffy/ens-normalize");
9
10
  const app_1 = __importDefault(require("../../../../global-account/app"));
10
11
  const react_1 = require("../../../../global-account/react");
11
12
  const profileDisplay_1 = require("../../../../global-account/react/utils/profileDisplay");
@@ -102,10 +103,19 @@ function ProfileEditor({ onSuccess, className }) {
102
103
  }
103
104
  // Update username if changed (this will use the updated user from avatar change if both were updated)
104
105
  if (hasUsernameChange && user?._id) {
105
- // @ts-expect-error this resolved fine, look into why expect-error needed
106
- updatedUser = await app_1.default.service("users").registerUsername({ username: username },
107
- // @ts-expect-error - our typed client is expecting context even though it's set elsewhere
108
- {});
106
+ const sanitizedUsername = (0, ens_normalize_1.ens_normalize)(username);
107
+ const b3Username = `${sanitizedUsername}.b3.fun`;
108
+ const usernameSignMessage = `Register "${b3Username}"`;
109
+ const usernameSignature = await account?.signMessage({ message: usernameSignMessage });
110
+ if (!usernameSignature) {
111
+ throw new Error("Failed to sign username registration message");
112
+ }
113
+ console.log("@@usernameSignature", usernameSignature);
114
+ // Register username with ENS
115
+ // Note: Type assertion needed until @b3dotfun/b3-api package is updated with RegisterUsername type
116
+ updatedUser = (await app_1.default
117
+ .service("users")
118
+ .registerUsername({ username, message: usernameSignMessage, hash: usernameSignature }, {}));
109
119
  }
110
120
  // Update user state
111
121
  setUser(updatedUser);
@@ -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
@@ -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";
@@ -8,6 +8,7 @@ export * from "./utils/json.js";
8
8
  export * from "./utils/number.js";
9
9
  export * from "./utils/string.js";
10
10
  export * from "./utils/token.js";
11
+ export * from "./utils/validation.js";
11
12
  // Constants
12
13
  export * from "./constants/index.js";
13
14
  // Abis
@@ -34,4 +34,10 @@ export declare function AnySpend(props: {
34
34
  }) => void;
35
35
  onSuccess?: (txHash?: string) => void;
36
36
  customUsdInputValues?: string[];
37
+ /**
38
+ * Client-provided reference ID for tracking orders.
39
+ * Must be alphanumeric with optional hyphens, underscores, and dots (max 255 chars).
40
+ * Auto-generates UUID if not provided.
41
+ */
42
+ clientReferenceId?: string;
37
43
  }): import("react/jsx-runtime").JSX.Element;
@@ -2,6 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { getDefaultToken, USDC_BASE } from "../../../anyspend/index.js";
4
4
  import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
5
+ import { Validators } from "../../../anyspend/utils/validation.js";
5
6
  import { Button, ShinyButton, StyleRoot, TransitionPanel, useAccountWallet, useProfile, useRouter, useSearchParamsSSR, useTokenBalanceDirect, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
6
7
  import { cn } from "../../../shared/utils/cn.js";
7
8
  import { formatTokenAmount } from "../../../shared/utils/number.js";
@@ -48,9 +49,18 @@ export function AnySpend(props) {
48
49
  const fingerprintConfig = getFingerprintConfig();
49
50
  return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendInner, { ...props }) }));
50
51
  }
51
- function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, }) {
52
+ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, clientReferenceId: clientReferenceIdFromProps, }) {
52
53
  const searchParams = useSearchParamsSSR();
53
54
  const router = useRouter();
55
+ // Validate and clean clientReferenceId
56
+ const validatedClientReferenceId = useMemo(() => {
57
+ const validation = Validators.clientReferenceId(clientReferenceIdFromProps);
58
+ if (!validation.isValid) {
59
+ console.error(`[AnySpend] Invalid clientReferenceId: ${validation.error || "Validation failed"}. Will be set to undefined.`);
60
+ return undefined;
61
+ }
62
+ return validation.cleaned;
63
+ }, [clientReferenceIdFromProps]);
54
64
  // Determine if we're in "buy mode" based on whether destination token props are provided
55
65
  const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
56
66
  // Add refs to track URL state
@@ -638,6 +648,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
638
648
  srcAmount: srcAmountBigInt.toString(),
639
649
  expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount || "0",
640
650
  creatorAddress: globalAddress,
651
+ clientReferenceId: validatedClientReferenceId,
641
652
  });
642
653
  }
643
654
  catch (err) {
@@ -702,6 +713,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
702
713
  },
703
714
  expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
704
715
  creatorAddress: globalAddress,
716
+ clientReferenceId: validatedClientReferenceId,
705
717
  });
706
718
  }
707
719
  catch (err) {
@@ -1,2 +1,4 @@
1
1
  import { AnySpendBondKitProps } from "../../../global-account/react/stores/useModalStore";
2
- export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, b3Amount: initialB3Amount, onSuccess, }: AnySpendBondKitProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, b3Amount: initialB3Amount, onSuccess, clientReferenceId, }: AnySpendBondKitProps & {
3
+ clientReferenceId?: string;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -20,7 +20,7 @@ function formatNumberWithCommas(x) {
20
20
  parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
21
21
  return parts.join(".");
22
22
  }
23
- export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, b3Amount: initialB3Amount, onSuccess, }) {
23
+ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, b3Amount: initialB3Amount, onSuccess, clientReferenceId, }) {
24
24
  const hasMounted = useHasMounted();
25
25
  const [showAmountPrompt, setShowAmountPrompt] = useState(!initialB3Amount);
26
26
  const [b3Amount, setB3Amount] = useState(initialB3Amount || "");
@@ -200,5 +200,5 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
200
200
  });
201
201
  return (_jsx(AnySpendCustom, { mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: baseMainnet.id, dstToken: dstToken, dstAmount: parseEther(b3Amount).toString(), contractAddress: contractAddress, encodedData: encodedData, metadata: {
202
202
  action: "BondKit Buy",
203
- }, header: header, onSuccess: onSuccess, showRecipient: true }));
203
+ }, header: header, onSuccess: onSuccess, showRecipient: true, clientReferenceId: clientReferenceId }));
204
204
  }
@@ -1,4 +1,4 @@
1
- export declare function AnySpendBuySpin({ loadOrder, mode, spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess, }: {
1
+ export declare function AnySpendBuySpin({ loadOrder, mode, spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess, clientReferenceId, }: {
2
2
  loadOrder?: string;
3
3
  mode?: "modal" | "page";
4
4
  spinwheelContractAddress: string;
@@ -6,4 +6,5 @@ export declare function AnySpendBuySpin({ loadOrder, mode, spinwheelContractAddr
6
6
  recipientAddress: string;
7
7
  prefillQuantity?: string;
8
8
  onSuccess?: (txHash?: string) => void;
9
+ clientReferenceId?: string;
9
10
  }): import("react/jsx-runtime").JSX.Element;
@@ -85,7 +85,7 @@ const basePublicClient = createPublicClient({
85
85
  chain: baseMainnet,
86
86
  transport: http(PUBLIC_BASE_RPC_URL),
87
87
  });
88
- export function AnySpendBuySpin({ loadOrder, mode = "modal", spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess, }) {
88
+ export function AnySpendBuySpin({ loadOrder, mode = "modal", spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess, clientReferenceId, }) {
89
89
  const hasMounted = useHasMounted();
90
90
  const { setB3ModalOpen } = useModalStore();
91
91
  // Payment config state
@@ -391,5 +391,5 @@ export function AnySpendBuySpin({ loadOrder, mode = "modal", spinwheelContractAd
391
391
  const encodedData = generateEncodedDataForBuyEntriesAndSpin(address || "", userSpinQuantity);
392
392
  return (_jsx(AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: chainId, dstToken: B3_TOKEN, dstAmount: totalCost.toString(), contractAddress: spinwheelContractAddress, spenderAddress: paymentConfig.entryModule, encodedData: encodedData, metadata: {
393
393
  action: `buy ${userSpinQuantity} spin${userSpinQuantity !== "1" ? "s" : ""}`,
394
- }, header: header, onSuccess: txHash => onSuccess?.(txHash), showRecipient: false }));
394
+ }, header: header, onSuccess: txHash => onSuccess?.(txHash), showRecipient: false, clientReferenceId: clientReferenceId }));
395
395
  }
@@ -21,4 +21,5 @@ export declare function AnySpendCustom(props: {
21
21
  onSuccess?: (txHash?: string) => void;
22
22
  showRecipient?: boolean;
23
23
  onShowPointsDetail?: () => void;
24
+ clientReferenceId?: string;
24
25
  }): import("react/jsx-runtime").JSX.Element;
@@ -108,7 +108,7 @@ export function AnySpendCustom(props) {
108
108
  const fingerprintConfig = getFingerprintConfig();
109
109
  return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendCustomInner, { ...props }) }));
110
110
  }
111
- function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabProps = "crypto", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true, onShowPointsDetail, }) {
111
+ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabProps = "crypto", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true, onShowPointsDetail, clientReferenceId, }) {
112
112
  const hasMounted = useHasMounted();
113
113
  const featureFlags = useFeatureFlags();
114
114
  const searchParams = useSearchParamsSSR();
@@ -351,10 +351,14 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
351
351
  : window.location.origin,
352
352
  },
353
353
  expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
354
+ clientReferenceId: clientReferenceId,
354
355
  });
355
356
  }
356
357
  else {
357
- void createRegularOrder(createOrderParams);
358
+ void createRegularOrder({
359
+ ...createOrderParams,
360
+ clientReferenceId: clientReferenceId,
361
+ });
358
362
  }
359
363
  }
360
364
  catch (err) {
@@ -31,6 +31,7 @@ export interface AnySpendCustomExactInProps {
31
31
  anyspendPrice: GetQuoteResponse | undefined;
32
32
  isLoadingAnyspendPrice: boolean;
33
33
  }) => React.JSX.Element;
34
+ clientReferenceId?: string;
34
35
  }
35
36
  export declare function AnySpendCustomExactIn(props: AnySpendCustomExactInProps): import("react/jsx-runtime").JSX.Element;
36
37
  export {};
@@ -25,7 +25,7 @@ export function AnySpendCustomExactIn(props) {
25
25
  const fingerprintConfig = getFingerprintConfig();
26
26
  return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendCustomExactInInner, { ...props }) }));
27
27
  }
28
- function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, destinationToken, destinationChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, customExactInConfig, orderType = "custom_exact_in", minDestinationAmount, header, }) {
28
+ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, destinationToken, destinationChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, customExactInConfig, orderType = "custom_exact_in", minDestinationAmount, header, clientReferenceId, }) {
29
29
  const actionLabel = customExactInConfig?.action ?? "Custom Execution";
30
30
  const DESTINATION_TOKEN_DETAILS = {
31
31
  SYMBOL: destinationToken.symbol ?? "TOKEN",
@@ -189,6 +189,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
189
189
  expectedDstAmount: expectedDstAmountRaw,
190
190
  creatorAddress: globalAddress,
191
191
  payload,
192
+ clientReferenceId: clientReferenceId,
192
193
  });
193
194
  }
194
195
  catch (err) {
@@ -241,6 +242,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
241
242
  expectedDstAmount: expectedDstAmountRaw,
242
243
  creatorAddress: globalAddress,
243
244
  payload,
245
+ clientReferenceId: clientReferenceId,
244
246
  });
245
247
  }
246
248
  catch (err) {
@@ -1,5 +1,5 @@
1
1
  import { components } from "../../../anyspend/types/api";
2
- export declare function AnySpendDepositUpside({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, depositContractAddress, token, onSuccess, }: {
2
+ export declare function AnySpendDepositUpside({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, depositContractAddress, token, onSuccess, clientReferenceId, }: {
3
3
  loadOrder?: string;
4
4
  mode?: "modal" | "page";
5
5
  recipientAddress: string;
@@ -8,4 +8,5 @@ export declare function AnySpendDepositUpside({ loadOrder, mode, recipientAddres
8
8
  depositContractAddress: string;
9
9
  token: components["schemas"]["Token"];
10
10
  onSuccess?: (amount: string) => void;
11
+ clientReferenceId?: string;
11
12
  }): import("react/jsx-runtime").JSX.Element | null;
@@ -22,7 +22,7 @@ const DEPOSIT_FOR_FUNCTION_ABI = JSON.stringify([
22
22
  type: "function",
23
23
  },
24
24
  ]);
25
- export function AnySpendDepositUpside({ loadOrder, mode = "modal", recipientAddress, sourceTokenAddress, sourceTokenChainId, depositContractAddress, token, onSuccess, }) {
25
+ export function AnySpendDepositUpside({ loadOrder, mode = "modal", recipientAddress, sourceTokenAddress, sourceTokenChainId, depositContractAddress, token, onSuccess, clientReferenceId, }) {
26
26
  if (!recipientAddress)
27
27
  return null;
28
28
  const header = () => (_jsx(_Fragment, { children: _jsx("div", { className: "from-b3-react-background to-as-on-surface-1 w-full rounded-t-lg bg-gradient-to-t", children: _jsx("div", { className: "mb-1 flex w-full flex-col items-center gap-2", children: _jsxs("span", { className: "font-sf-rounded text-2xl font-semibold", children: ["Swap & Deposit ", token.symbol] }) }) }) }));
@@ -34,5 +34,5 @@ export function AnySpendDepositUpside({ loadOrder, mode = "modal", recipientAddr
34
34
  spenderAddress: depositContractAddress,
35
35
  action: `deposit ${token.symbol}`,
36
36
  };
37
- return (_jsx(AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: token, destinationChainId: base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
37
+ return (_jsx(AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: token, destinationChainId: base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess, clientReferenceId: clientReferenceId }));
38
38
  }
@@ -1,9 +1,10 @@
1
1
  import { components } from "../../../anyspend/types/api";
2
- export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail, }: {
2
+ export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail, clientReferenceId, }: {
3
3
  loadOrder?: string;
4
4
  mode?: "modal" | "page";
5
5
  recipientAddress?: string;
6
6
  nftContract: components["schemas"]["NftContract"];
7
7
  onSuccess?: (txHash?: string) => void;
8
8
  onShowPointsDetail?: () => void;
9
+ clientReferenceId?: string;
9
10
  }): import("react/jsx-runtime").JSX.Element;
@@ -26,7 +26,7 @@ const CONTRACT_URI_ABI = [
26
26
  type: "function",
27
27
  },
28
28
  ];
29
- export function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract, onSuccess, onShowPointsDetail, }) {
29
+ export function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract, onSuccess, onShowPointsDetail, clientReferenceId, }) {
30
30
  const [imageUrlWithFallback, setFallbackImageUrl] = useState(nftContract.imageUrl);
31
31
  const [isLoadingFallback, setIsLoadingFallback] = useState(false);
32
32
  // Fetch contract metadata when imageUrl is empty
@@ -86,7 +86,7 @@ export function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftCo
86
86
  return (_jsx(AnySpendCustom, { loadOrder: loadOrder, mode: mode, activeTab: "fiat", recipientAddress: recipientAddress, orderType: "mint_nft", dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: {
87
87
  type: "mint_nft",
88
88
  nftContract: nftContract,
89
- }, header: header, onSuccess: onSuccess, onShowPointsDetail: onShowPointsDetail }));
89
+ }, header: header, onSuccess: onSuccess, onShowPointsDetail: onShowPointsDetail, clientReferenceId: clientReferenceId }));
90
90
  }
91
91
  function DropdownMenu({ nftContract }) {
92
92
  const [open, setOpen] = useState(false);
@@ -1,7 +1,8 @@
1
- export declare function AnySpendStakeB3({ loadOrder, mode, recipientAddress, stakeAmount, onSuccess, }: {
1
+ export declare function AnySpendStakeB3({ loadOrder, mode, recipientAddress, stakeAmount, onSuccess, clientReferenceId, }: {
2
2
  loadOrder?: string;
3
3
  mode?: "modal" | "page";
4
4
  recipientAddress: string;
5
5
  stakeAmount?: string;
6
6
  onSuccess?: () => void;
7
+ clientReferenceId?: string;
7
8
  }): import("react/jsx-runtime").JSX.Element;
@@ -29,7 +29,7 @@ function generateEncodedDataForStakingB3(amount, beneficiary) {
29
29
  });
30
30
  return encodedData;
31
31
  }
32
- export function AnySpendStakeB3({ loadOrder, mode = "modal", recipientAddress, stakeAmount, onSuccess, }) {
32
+ export function AnySpendStakeB3({ loadOrder, mode = "modal", recipientAddress, stakeAmount, onSuccess, clientReferenceId, }) {
33
33
  const hasMounted = useHasMounted();
34
34
  const { setB3ModalOpen } = useModalStore();
35
35
  // Wagmi hooks for direct staking
@@ -271,5 +271,5 @@ export function AnySpendStakeB3({ loadOrder, mode = "modal", recipientAddress, s
271
271
  const encodedData = generateEncodedDataForStakingB3(userStakeAmount, recipientAddress);
272
272
  return (_jsx(AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: base.id, dstToken: B3_TOKEN, dstAmount: userStakeAmount, contractAddress: ERC20Staking, encodedData: encodedData, metadata: {
273
273
  action: "stake B3",
274
- }, header: header, onSuccess: onSuccess, showRecipient: true }));
274
+ }, header: header, onSuccess: onSuccess, showRecipient: true, clientReferenceId: clientReferenceId }));
275
275
  }
@@ -1,4 +1,4 @@
1
- export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess, }: {
1
+ export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess, clientReferenceId, }: {
2
2
  loadOrder?: string;
3
3
  mode?: "modal" | "page";
4
4
  sourceTokenAddress?: string;
@@ -6,4 +6,5 @@ export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, sourceTokenAdd
6
6
  recipientAddress: string;
7
7
  stakeAmount?: string;
8
8
  onSuccess?: (amount: string) => void;
9
+ clientReferenceId?: string;
9
10
  }): import("react/jsx-runtime").JSX.Element | null;
@@ -32,7 +32,7 @@ const STAKE_FUNCTION_ABI = JSON.stringify([
32
32
  outputs: [],
33
33
  },
34
34
  ]);
35
- export function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess, }) {
35
+ export function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess, clientReferenceId, }) {
36
36
  const hasMounted = useHasMounted();
37
37
  const { setB3ModalOpen } = useModalStore();
38
38
  // Wagmi hooks for direct staking
@@ -281,5 +281,5 @@ export function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", sourceTokenA
281
281
  onSuccess?.(formatTokenAmount(BigInt(userStakeAmount), 18) ?? "");
282
282
  }, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary h-14 w-full rounded-xl text-lg font-medium", children: "Done" })] })] }) }));
283
283
  }
284
- return (_jsx(AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: B3_TOKEN, destinationChainId: base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
284
+ return (_jsx(AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: B3_TOKEN, destinationChainId: base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess, clientReferenceId: clientReferenceId }));
285
285
  }
@@ -1,5 +1,5 @@
1
1
  import { components } from "../../../anyspend/types/api";
2
- export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, }: {
2
+ export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, clientReferenceId, }: {
3
3
  loadOrder?: string;
4
4
  mode?: "modal" | "page";
5
5
  beneficiaryAddress: string;
@@ -8,4 +8,5 @@ export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddres
8
8
  token: components["schemas"]["Token"];
9
9
  onSuccess?: () => void;
10
10
  activeTab?: "crypto" | "fiat";
11
+ clientReferenceId?: string;
11
12
  }): import("react/jsx-runtime").JSX.Element;
@@ -14,7 +14,7 @@ function generateEncodedDataForStaking(amount, beneficiary) {
14
14
  args: [beneficiary, BigInt(amount)],
15
15
  });
16
16
  }
17
- export function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, }) {
17
+ export function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, clientReferenceId, }) {
18
18
  const header = () => (_jsx(_Fragment, { children: _jsxs("div", { className: "from-b3-react-background to-as-on-surface-1 mt-[-60px] w-full rounded-t-lg bg-gradient-to-t", children: [_jsx("div", { className: "h-[60px] w-full" }), _jsx("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: _jsxs("span", { className: "font-sf-rounded text-2xl font-semibold", children: ["Swap & Stake ", stakeAmount ? formatTokenAmount(BigInt(stakeAmount), token.decimals) : "", " ", token.symbol] }) })] }) }));
19
19
  // Only generate encoded data if we have a valid beneficiary address
20
20
  // This is used for the AnySpendCustom swap & stake flow
@@ -24,5 +24,5 @@ export function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddr
24
24
  const encodedData = generateEncodedDataForStaking(stakeAmount, beneficiaryAddress);
25
25
  return (_jsx(AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: beneficiaryAddress, orderType: "custom", dstChainId: base.id, dstToken: token, dstAmount: stakeAmount, contractAddress: stakingContractAddress, encodedData: encodedData, metadata: {
26
26
  action: `stake ${token.symbol}`,
27
- }, header: header, onSuccess: onSuccess, showRecipient: true, activeTab: activeTab }));
27
+ }, header: header, onSuccess: onSuccess, showRecipient: true, activeTab: activeTab, clientReferenceId: clientReferenceId }));
28
28
  }
@@ -1,5 +1,5 @@
1
1
  import { components } from "../../../anyspend/types/api";
2
- export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess, }: {
2
+ export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess, clientReferenceId, }: {
3
3
  loadOrder?: string;
4
4
  mode?: "modal" | "page";
5
5
  recipientAddress: string;
@@ -8,4 +8,5 @@ export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientA
8
8
  stakingContractAddress: string;
9
9
  token: components["schemas"]["Token"];
10
10
  onSuccess?: (amount: string) => void;
11
+ clientReferenceId?: string;
11
12
  }): import("react/jsx-runtime").JSX.Element | null;