@b3dotfun/sdk 0.1.0 → 0.1.1-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 (171) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +1 -1
  2. package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +15 -10
  3. package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +22 -14
  4. package/dist/cjs/anyspend/react/components/QRDeposit.js +31 -5
  5. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +9 -2
  6. package/dist/cjs/anyspend/react/components/common/GasIndicator.d.ts +1 -1
  7. package/dist/cjs/anyspend/react/components/common/GasIndicator.js +6 -16
  8. package/dist/cjs/anyspend/react/components/common/TokenBalance.js +15 -4
  9. package/dist/cjs/anyspend/react/components/common/TransferResultScreen.d.ts +22 -0
  10. package/dist/cjs/anyspend/react/components/common/TransferResultScreen.js +25 -0
  11. package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
  12. package/dist/cjs/anyspend/react/hooks/index.js +1 -0
  13. package/dist/cjs/anyspend/react/hooks/useWatchTransfer.d.ts +41 -0
  14. package/dist/cjs/anyspend/react/hooks/useWatchTransfer.js +75 -0
  15. package/dist/cjs/anyspend/react/providers/AnyspendProvider.js +1 -2
  16. package/dist/cjs/anyspend/utils/address.d.ts +5 -0
  17. package/dist/cjs/anyspend/utils/address.js +8 -0
  18. package/dist/cjs/global-account/react/components/AccountAssets/AccountAssets.js +7 -3
  19. package/dist/cjs/global-account/react/components/B3DynamicModal.js +4 -14
  20. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
  21. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +37 -0
  22. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +4 -1
  23. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +3 -31
  24. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +4 -31
  25. package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +6 -1
  26. package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.js +5 -1
  27. package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +1 -12
  28. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +1 -17
  29. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +2 -21
  30. package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.js +2 -2
  31. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +24 -4
  32. package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.d.ts +64 -0
  33. package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +163 -0
  34. package/dist/cjs/global-account/react/components/SingleUserSearchSelector/index.d.ts +2 -0
  35. package/dist/cjs/global-account/react/components/SingleUserSearchSelector/index.js +5 -0
  36. package/dist/cjs/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
  37. package/dist/cjs/global-account/react/components/index.d.ts +2 -0
  38. package/dist/cjs/global-account/react/components/index.js +6 -3
  39. package/dist/cjs/global-account/react/hooks/index.d.ts +2 -1
  40. package/dist/cjs/global-account/react/hooks/index.js +5 -1
  41. package/dist/cjs/global-account/react/hooks/useAuthentication.js +5 -2
  42. package/dist/cjs/global-account/react/hooks/useProfile.js +4 -23
  43. package/dist/cjs/global-account/react/hooks/useSimBalance.d.ts +7 -0
  44. package/dist/cjs/global-account/react/hooks/useSimBalance.js +43 -11
  45. package/dist/cjs/global-account/react/hooks/useSimCollectibles.d.ts +45 -0
  46. package/dist/cjs/global-account/react/hooks/useSimCollectibles.js +190 -0
  47. package/dist/cjs/global-account/react/stores/index.d.ts +0 -1
  48. package/dist/cjs/global-account/react/stores/index.js +1 -3
  49. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +63 -1
  50. package/dist/cjs/global-account/react/stores/useModalStore.js +3 -0
  51. package/dist/cjs/global-account/react/utils/profileApi.d.ts +13 -0
  52. package/dist/cjs/global-account/react/utils/profileApi.js +29 -0
  53. package/dist/cjs/global-account/react/utils/simdune.d.ts +7 -0
  54. package/dist/cjs/global-account/react/utils/simdune.js +21 -0
  55. package/dist/esm/anyspend/react/components/AnySpend.js +1 -1
  56. package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +15 -10
  57. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +23 -15
  58. package/dist/esm/anyspend/react/components/QRDeposit.js +32 -6
  59. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +10 -3
  60. package/dist/esm/anyspend/react/components/common/GasIndicator.d.ts +1 -1
  61. package/dist/esm/anyspend/react/components/common/GasIndicator.js +7 -17
  62. package/dist/esm/anyspend/react/components/common/TokenBalance.js +16 -5
  63. package/dist/esm/anyspend/react/components/common/TransferResultScreen.d.ts +22 -0
  64. package/dist/esm/anyspend/react/components/common/TransferResultScreen.js +22 -0
  65. package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
  66. package/dist/esm/anyspend/react/hooks/index.js +1 -0
  67. package/dist/esm/anyspend/react/hooks/useWatchTransfer.d.ts +41 -0
  68. package/dist/esm/anyspend/react/hooks/useWatchTransfer.js +72 -0
  69. package/dist/esm/anyspend/react/providers/AnyspendProvider.js +1 -2
  70. package/dist/esm/anyspend/utils/address.d.ts +5 -0
  71. package/dist/esm/anyspend/utils/address.js +7 -0
  72. package/dist/esm/global-account/react/components/AccountAssets/AccountAssets.js +7 -3
  73. package/dist/esm/global-account/react/components/B3DynamicModal.js +5 -15
  74. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
  75. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +33 -0
  76. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +4 -1
  77. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +3 -31
  78. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +3 -30
  79. package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +6 -1
  80. package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +5 -1
  81. package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +1 -12
  82. package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +1 -17
  83. package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +1 -20
  84. package/dist/esm/global-account/react/components/ManageAccount/NFTContent.js +3 -3
  85. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +25 -5
  86. package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.d.ts +64 -0
  87. package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +160 -0
  88. package/dist/esm/global-account/react/components/SingleUserSearchSelector/index.d.ts +2 -0
  89. package/dist/esm/global-account/react/components/SingleUserSearchSelector/index.js +1 -0
  90. package/dist/esm/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
  91. package/dist/esm/global-account/react/components/index.d.ts +2 -0
  92. package/dist/esm/global-account/react/components/index.js +2 -0
  93. package/dist/esm/global-account/react/hooks/index.d.ts +2 -1
  94. package/dist/esm/global-account/react/hooks/index.js +2 -1
  95. package/dist/esm/global-account/react/hooks/useAuthentication.js +5 -2
  96. package/dist/esm/global-account/react/hooks/useProfile.js +1 -20
  97. package/dist/esm/global-account/react/hooks/useSimBalance.d.ts +7 -0
  98. package/dist/esm/global-account/react/hooks/useSimBalance.js +42 -11
  99. package/dist/esm/global-account/react/hooks/useSimCollectibles.d.ts +45 -0
  100. package/dist/esm/global-account/react/hooks/useSimCollectibles.js +187 -0
  101. package/dist/esm/global-account/react/stores/index.d.ts +0 -1
  102. package/dist/esm/global-account/react/stores/index.js +0 -1
  103. package/dist/esm/global-account/react/stores/useModalStore.d.ts +63 -1
  104. package/dist/esm/global-account/react/stores/useModalStore.js +3 -0
  105. package/dist/esm/global-account/react/utils/profileApi.d.ts +13 -0
  106. package/dist/esm/global-account/react/utils/profileApi.js +25 -0
  107. package/dist/esm/global-account/react/utils/simdune.d.ts +7 -0
  108. package/dist/esm/global-account/react/utils/simdune.js +17 -0
  109. package/dist/styles/index.css +1 -1
  110. package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +15 -10
  111. package/dist/types/anyspend/react/components/common/GasIndicator.d.ts +1 -1
  112. package/dist/types/anyspend/react/components/common/TransferResultScreen.d.ts +22 -0
  113. package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
  114. package/dist/types/anyspend/react/hooks/useWatchTransfer.d.ts +41 -0
  115. package/dist/types/anyspend/utils/address.d.ts +5 -0
  116. package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
  117. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +4 -1
  118. package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +6 -1
  119. package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +1 -12
  120. package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +1 -17
  121. package/dist/types/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.d.ts +64 -0
  122. package/dist/types/global-account/react/components/SingleUserSearchSelector/index.d.ts +2 -0
  123. package/dist/types/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
  124. package/dist/types/global-account/react/components/index.d.ts +2 -0
  125. package/dist/types/global-account/react/hooks/index.d.ts +2 -1
  126. package/dist/types/global-account/react/hooks/useSimBalance.d.ts +7 -0
  127. package/dist/types/global-account/react/hooks/useSimCollectibles.d.ts +45 -0
  128. package/dist/types/global-account/react/stores/index.d.ts +0 -1
  129. package/dist/types/global-account/react/stores/useModalStore.d.ts +63 -1
  130. package/dist/types/global-account/react/utils/profileApi.d.ts +13 -0
  131. package/dist/types/global-account/react/utils/simdune.d.ts +7 -0
  132. package/package.json +6 -1
  133. package/src/anyspend/react/components/AnySpend.tsx +1 -0
  134. package/src/anyspend/react/components/AnySpendDeposit.tsx +60 -42
  135. package/src/anyspend/react/components/QRDeposit.tsx +57 -5
  136. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +13 -3
  137. package/src/anyspend/react/components/common/GasIndicator.tsx +11 -30
  138. package/src/anyspend/react/components/common/TokenBalance.tsx +17 -5
  139. package/src/anyspend/react/components/common/TransferResultScreen.tsx +107 -0
  140. package/src/anyspend/react/hooks/index.ts +1 -0
  141. package/src/anyspend/react/hooks/useWatchTransfer.ts +114 -0
  142. package/src/anyspend/react/providers/AnyspendProvider.tsx +2 -5
  143. package/src/anyspend/utils/address.ts +13 -0
  144. package/src/global-account/react/components/AccountAssets/AccountAssets.tsx +25 -13
  145. package/src/global-account/react/components/B3DynamicModal.tsx +5 -17
  146. package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +84 -0
  147. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +28 -36
  148. package/src/global-account/react/components/B3Provider/B3Provider.tsx +31 -39
  149. package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +11 -0
  150. package/src/global-account/react/components/B3Provider/useB3Config.ts +1 -21
  151. package/src/global-account/react/components/ManageAccount/NFTContent.tsx +4 -4
  152. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +29 -6
  153. package/src/global-account/react/components/SingleUserSearchSelector/README.md +266 -0
  154. package/src/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.tsx +330 -0
  155. package/src/global-account/react/components/SingleUserSearchSelector/index.ts +2 -0
  156. package/src/global-account/react/components/index.ts +7 -0
  157. package/src/global-account/react/hooks/index.ts +2 -1
  158. package/src/global-account/react/hooks/useAuthentication.ts +6 -2
  159. package/src/global-account/react/hooks/useProfile.ts +1 -32
  160. package/src/global-account/react/hooks/useSimBalance.ts +49 -12
  161. package/src/global-account/react/hooks/useSimCollectibles.ts +238 -0
  162. package/src/global-account/react/stores/index.ts +0 -1
  163. package/src/global-account/react/stores/useModalStore.ts +67 -1
  164. package/src/global-account/react/utils/profileApi.ts +38 -0
  165. package/src/global-account/react/utils/simdune.ts +20 -0
  166. package/dist/cjs/global-account/react/stores/configStore.d.ts +0 -24
  167. package/dist/cjs/global-account/react/stores/configStore.js +0 -30
  168. package/dist/esm/global-account/react/stores/configStore.d.ts +0 -24
  169. package/dist/esm/global-account/react/stores/configStore.js +0 -27
  170. package/dist/types/global-account/react/stores/configStore.d.ts +0 -24
  171. package/src/global-account/react/stores/configStore.ts +0 -51
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSimCollectibles = useSimCollectibles;
4
+ const react_query_1 = require("@tanstack/react-query");
5
+ const simdune_1 = require("../utils/simdune");
6
+ /**
7
+ * Safely parse a balance string to a number, capping at MAX_SAFE_INTEGER
8
+ * to prevent overflow issues with large ERC1155 balances.
9
+ */
10
+ function safeParseBalance(balance) {
11
+ if (!balance)
12
+ return 1;
13
+ const parsed = parseInt(balance, 10);
14
+ if (Number.isNaN(parsed))
15
+ return 1;
16
+ return Math.min(parsed, Number.MAX_SAFE_INTEGER);
17
+ }
18
+ async function fetchSimCollectibles(address, chainIdsParam, options) {
19
+ if (!address)
20
+ throw new Error("Address is required");
21
+ const queryParams = new URLSearchParams();
22
+ if (chainIdsParam && chainIdsParam.length > 0) {
23
+ queryParams.append("chain_ids", chainIdsParam.join(","));
24
+ }
25
+ if (options?.limit) {
26
+ queryParams.append("limit", options.limit.toString());
27
+ }
28
+ if (options?.filterSpam !== undefined) {
29
+ queryParams.append("filter_spam", options.filterSpam.toString());
30
+ }
31
+ const url = (0, simdune_1.buildSimduneUrl)(`/v1/evm/collectibles/${address}`, queryParams);
32
+ const response = await fetch(url);
33
+ if (!response.ok) {
34
+ throw new Error(`Failed to fetch collectibles: ${response.statusText}`);
35
+ }
36
+ const data = await response.json();
37
+ return data;
38
+ }
39
+ /**
40
+ * Transforms Simdune collectibles response to SimpleHash NFT format
41
+ * for compatibility with existing AccountAssets component
42
+ */
43
+ function transformToSimpleHashFormat(data) {
44
+ const nfts = data.entries.map(entry => ({
45
+ nft_id: `${entry.chain}.${entry.contract_address}.${entry.token_id}`,
46
+ chain: entry.chain,
47
+ contract_address: entry.contract_address,
48
+ token_id: entry.token_id,
49
+ name: entry.name || "",
50
+ description: entry.description || "",
51
+ previews: {
52
+ image_small_url: entry.image_url || "",
53
+ image_medium_url: entry.image_url || "",
54
+ image_large_url: entry.image_url || "",
55
+ image_opengraph_url: entry.image_url || "",
56
+ blurhash: "",
57
+ predominant_color: "",
58
+ },
59
+ image_url: entry.image_url || "",
60
+ image_properties: {
61
+ width: 0,
62
+ height: 0,
63
+ size: 0,
64
+ mime_type: "",
65
+ exif_orientation: null,
66
+ },
67
+ video_url: null,
68
+ video_properties: null,
69
+ audio_url: null,
70
+ audio_properties: null,
71
+ model_url: null,
72
+ model_properties: null,
73
+ other_url: null,
74
+ other_properties: null,
75
+ background_color: null,
76
+ external_url: null,
77
+ created_date: "",
78
+ status: "minted",
79
+ token_count: 1,
80
+ owner_count: 1,
81
+ owners: [
82
+ {
83
+ owner_address: data.address,
84
+ quantity: safeParseBalance(entry.balance),
85
+ quantity_string: entry.balance || "1",
86
+ first_acquired_date: entry.last_acquired || "",
87
+ last_acquired_date: entry.last_acquired || "",
88
+ },
89
+ ],
90
+ contract: {
91
+ type: entry.token_standard,
92
+ name: entry.name || "",
93
+ symbol: entry.symbol || null,
94
+ deployed_by: "",
95
+ deployed_via_contract: "",
96
+ owned_by: "",
97
+ has_multiple_collections: false,
98
+ },
99
+ collection: {
100
+ collection_id: entry.contract_address,
101
+ name: entry.symbol || "Unknown Collection",
102
+ description: null,
103
+ image_url: entry.image_url || "",
104
+ image_properties: {
105
+ width: 0,
106
+ height: 0,
107
+ mime_type: "",
108
+ },
109
+ banner_image_url: null,
110
+ category: null,
111
+ is_nsfw: null,
112
+ external_url: null,
113
+ twitter_username: null,
114
+ discord_url: null,
115
+ instagram_username: null,
116
+ medium_username: null,
117
+ telegram_url: null,
118
+ marketplace_pages: [],
119
+ metaplex_mint: null,
120
+ metaplex_candy_machine: null,
121
+ metaplex_first_verified_creator: null,
122
+ floor_prices: [],
123
+ top_bids: [],
124
+ distinct_owner_count: 0,
125
+ distinct_nft_count: 0,
126
+ total_quantity: 0,
127
+ chains: [entry.chain],
128
+ top_contracts: [entry.contract_address],
129
+ collection_royalties: [],
130
+ },
131
+ last_sale: entry.last_sale_price
132
+ ? {
133
+ price: entry.last_sale_price,
134
+ }
135
+ : null,
136
+ primary_sale: null,
137
+ first_created: {
138
+ minted_to: data.address,
139
+ quantity: 1,
140
+ quantity_string: "1",
141
+ timestamp: "",
142
+ block_number: 0,
143
+ transaction: "",
144
+ transaction_initiator: "",
145
+ },
146
+ rarity: {
147
+ rank: null,
148
+ score: null,
149
+ unique_attributes: null,
150
+ },
151
+ royalty: [],
152
+ extra_metadata: {
153
+ attributes: (entry.metadata?.attributes || []).map(attr => ({
154
+ trait_type: attr.trait_type,
155
+ value: attr.value,
156
+ display_type: attr.display_type ?? null,
157
+ })),
158
+ image_original_url: entry.image_url || "",
159
+ animation_original_url: null,
160
+ metadata_original_url: entry.metadata?.uri || "",
161
+ },
162
+ }));
163
+ return {
164
+ next_cursor: data.next_offset || null,
165
+ next: null,
166
+ previous: null,
167
+ nfts,
168
+ };
169
+ }
170
+ /**
171
+ * Hook to fetch NFT collectibles from Simdune API.
172
+ * Returns data in SimpleHash format for compatibility with AccountAssets component.
173
+ * @param address - Wallet address to fetch collectibles for
174
+ * @param chainIdsParam - Optional array of chain IDs to filter by
175
+ * @param options - Optional parameters (limit, filterSpam)
176
+ */
177
+ function useSimCollectibles(address, chainIdsParam, options) {
178
+ return (0, react_query_1.useQuery)({
179
+ queryKey: ["simCollectibles", address, chainIdsParam, options],
180
+ queryFn: async () => {
181
+ if (!address)
182
+ throw new Error("Address is required");
183
+ const data = await fetchSimCollectibles(address, chainIdsParam, options);
184
+ return transformToSimpleHashFormat(data);
185
+ },
186
+ enabled: Boolean(address),
187
+ staleTime: 30 * 1000,
188
+ gcTime: 5 * 60 * 1000,
189
+ });
190
+ }
@@ -1,5 +1,4 @@
1
1
  export { useAuthStore } from "./useAuthStore";
2
- export { useB3ConfigStore } from "./configStore";
3
2
  export { useModalStore } from "./useModalStore";
4
3
  export { useRecentAddressesStore } from "./useRecentAddressesStore";
5
4
  export type { AnySpendBuySpinProps, AnySpendFundTournamentProps, AnySpendJoinTournamentProps, AnySpendModalProps, AnySpendNftProps, AnySpendOrderHistoryProps, AnySpendStakeB3Props, AnyspendOrderDetailsProps, ManageAccountModalProps, ModalContentType, RequestPermissionsModalProps, SignInWithB3ModalProps, } from "./useModalStore";
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useRecentAddressesStore = exports.useModalStore = exports.useB3ConfigStore = exports.useAuthStore = void 0;
3
+ exports.useRecentAddressesStore = exports.useModalStore = exports.useAuthStore = void 0;
4
4
  var useAuthStore_1 = require("./useAuthStore");
5
5
  Object.defineProperty(exports, "useAuthStore", { enumerable: true, get: function () { return useAuthStore_1.useAuthStore; } });
6
- var configStore_1 = require("./configStore");
7
- Object.defineProperty(exports, "useB3ConfigStore", { enumerable: true, get: function () { return configStore_1.useB3ConfigStore; } });
8
6
  var useModalStore_1 = require("./useModalStore");
9
7
  Object.defineProperty(exports, "useModalStore", { enumerable: true, get: function () { return useModalStore_1.useModalStore; } });
10
8
  var useRecentAddressesStore_1 = require("./useRecentAddressesStore");
@@ -482,10 +482,70 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
482
482
  /** Force fiat payment */
483
483
  forceFiatPayment?: boolean;
484
484
  }
485
+ /**
486
+ * Props for the AnySpend Deposit modal
487
+ * Flexible deposit component with optional chain selection
488
+ */
489
+ export interface AnySpendDepositModalProps extends BaseModalProps {
490
+ /** Modal type identifier */
491
+ type: "anySpendDeposit";
492
+ /** Order ID to load an existing order */
493
+ loadOrder?: string;
494
+ /** The recipient address for the deposit */
495
+ recipientAddress: string;
496
+ /** Payment type - crypto or fiat. If not set, shows chain selection first */
497
+ paymentType?: "crypto" | "fiat";
498
+ /** Source token address to pre-select */
499
+ sourceTokenAddress?: string;
500
+ /** Source chain ID to pre-select. If not provided, shows chain selection */
501
+ sourceTokenChainId?: number;
502
+ /** The destination token address */
503
+ destinationTokenAddress: string;
504
+ /** The destination chain ID */
505
+ destinationTokenChainId: number;
506
+ /** Callback when deposit succeeds */
507
+ onSuccess?: (amount: string) => void;
508
+ /** Callback for opening a custom modal (e.g., for special token handling) */
509
+ onOpenCustomModal?: () => void;
510
+ /** Custom footer content */
511
+ mainFooter?: React.ReactNode;
512
+ /** Called when a token is selected. Call event.preventDefault() to prevent default behavior */
513
+ onTokenSelect?: (token: components["schemas"]["Token"], event: {
514
+ preventDefault: () => void;
515
+ }) => void;
516
+ /** Custom USD input value presets for fiat payment */
517
+ customUsdInputValues?: string[];
518
+ /** Whether to prefer using connected EOA wallet */
519
+ preferEoa?: boolean;
520
+ /** Minimum destination amount required */
521
+ minDestinationAmount?: number;
522
+ /** Order type for the deposit */
523
+ orderType?: "hype_duel" | "custom_exact_in" | "swap";
524
+ /** Custom action label displayed on buttons */
525
+ actionLabel?: string;
526
+ /** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
527
+ showChainSelection?: boolean;
528
+ /** Minimum pool size for filtering tokens (default: 1,000,000) */
529
+ minPoolSize?: number;
530
+ /** Custom title for chain selection step */
531
+ chainSelectionTitle?: string;
532
+ /** Custom description for chain selection step */
533
+ chainSelectionDescription?: string;
534
+ /** Number of top chains to show (default: 3) */
535
+ topChainsCount?: number;
536
+ /** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
537
+ returnToHomeUrl?: string;
538
+ /** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
539
+ customRecipientLabel?: string;
540
+ /** Custom label for the return home button (overrides "Return to Home" / "Close") */
541
+ returnHomeLabel?: string;
542
+ /** Whether the deposit requires a custom function (uses AnySpendCustomExactIn). Defaults to false. */
543
+ isCustomDeposit?: boolean;
544
+ }
485
545
  /**
486
546
  * Union type of all possible modal content types
487
547
  */
488
- export type ModalContentType = SignInWithB3ModalProps | TurnkeyAuthModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendDepositUpsideProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | LinkNewAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps | DepositModalProps | SendModalProps | NotificationsModalProps | AnySpendCollectorClubPurchaseProps;
548
+ export type ModalContentType = SignInWithB3ModalProps | TurnkeyAuthModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendDepositUpsideProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | LinkNewAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps | DepositModalProps | SendModalProps | NotificationsModalProps | AnySpendCollectorClubPurchaseProps | AnySpendDepositModalProps;
489
549
  /**
490
550
  * State interface for the modal store
491
551
  */
@@ -514,6 +574,8 @@ interface ModalState {
514
574
  linkingMethod: string | null;
515
575
  /** Function to set the linking state */
516
576
  setLinkingState: (isLinking: boolean, method?: string | null) => void;
577
+ /** Function to update closable property of current content without adding to history */
578
+ setClosable: (closable: boolean) => void;
517
579
  }
518
580
  /**
519
581
  * Zustand store for managing modal state
@@ -36,4 +36,7 @@ exports.useModalStore = (0, zustand_1.create)(set => ({
36
36
  isLinking: false,
37
37
  linkingMethod: null,
38
38
  setLinkingState: (isLinking, method = null) => set({ isLinking, linkingMethod: isLinking ? method : null }),
39
+ setClosable: (closable) => set(state => ({
40
+ contentType: state.contentType ? { ...state.contentType, closable } : null,
41
+ })),
39
42
  }));
@@ -0,0 +1,13 @@
1
+ import type { CombinedProfile } from "../hooks/useProfile";
2
+ export declare const PROFILES_API_URL = "https://profiles.b3.fun";
3
+ /**
4
+ * Fetch a user profile from the B3 Profiles API
5
+ * @param params - Search parameters (address, name, or b3GlobalId)
6
+ * @returns Promise resolving to CombinedProfile or null if not found
7
+ */
8
+ export declare function fetchProfile({ address, name, b3GlobalId, fresh, }: {
9
+ address?: string;
10
+ name?: string;
11
+ b3GlobalId?: string;
12
+ fresh?: boolean;
13
+ }): Promise<CombinedProfile>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PROFILES_API_URL = void 0;
4
+ exports.fetchProfile = fetchProfile;
5
+ exports.PROFILES_API_URL = "https://profiles.b3.fun";
6
+ /**
7
+ * Fetch a user profile from the B3 Profiles API
8
+ * @param params - Search parameters (address, name, or b3GlobalId)
9
+ * @returns Promise resolving to CombinedProfile or null if not found
10
+ */
11
+ async function fetchProfile({ address, name, b3GlobalId, fresh = false, }) {
12
+ if (!address && !name && !b3GlobalId) {
13
+ throw new Error("Either address or name or b3GlobalId must be provided");
14
+ }
15
+ const params = new URLSearchParams();
16
+ if (address)
17
+ params.append("address", address);
18
+ if (name)
19
+ params.append("name", name);
20
+ if (b3GlobalId)
21
+ params.append("b3GlobalId", b3GlobalId);
22
+ if (fresh)
23
+ params.append("fresh", "true");
24
+ const response = await fetch(`${exports.PROFILES_API_URL}?${params.toString()}`);
25
+ if (!response.ok) {
26
+ throw new Error(`Failed to fetch profile: ${response.statusText}`);
27
+ }
28
+ return response.json();
29
+ }
@@ -0,0 +1,7 @@
1
+ export declare const SIMDUNE_API_HOST = "https://simdune-api.sean-430.workers.dev";
2
+ /**
3
+ * Builds a Simdune API URL with the proxy wrapper and optional dev mode key.
4
+ * @param endpoint - The Simdune API endpoint (e.g., "/v1/evm/balances/0x...")
5
+ * @param queryParams - Optional URLSearchParams to append
6
+ */
7
+ export declare function buildSimduneUrl(endpoint: string, queryParams?: URLSearchParams): string;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SIMDUNE_API_HOST = void 0;
4
+ exports.buildSimduneUrl = buildSimduneUrl;
5
+ exports.SIMDUNE_API_HOST = "https://simdune-api.sean-430.workers.dev";
6
+ /**
7
+ * Builds a Simdune API URL with the proxy wrapper and optional dev mode key.
8
+ * @param endpoint - The Simdune API endpoint (e.g., "/v1/evm/balances/0x...")
9
+ * @param queryParams - Optional URLSearchParams to append
10
+ */
11
+ function buildSimduneUrl(endpoint, queryParams) {
12
+ const baseUrl = `${exports.SIMDUNE_API_HOST}/?url=https://api.sim.dune.com${endpoint}`;
13
+ let url = baseUrl;
14
+ if (queryParams && queryParams.toString()) {
15
+ url += `?${queryParams.toString()}`;
16
+ }
17
+ if (process.env.NEXT_PUBLIC_DEVMODE_SHARED_SECRET) {
18
+ url += `${queryParams?.toString() ? "&" : "?"}localkey=${process.env.NEXT_PUBLIC_DEVMODE_SHARED_SECRET}`;
19
+ }
20
+ return url;
21
+ }
@@ -824,7 +824,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
824
824
  navigateBack();
825
825
  // Reset payment methods when going back
826
826
  resetPaymentMethods();
827
- }, returnToHomeUrl: returnToHomeUrl, returnHomeLabel: returnHomeLabel })) }) }));
827
+ }, returnToHomeUrl: returnToHomeUrl, returnHomeLabel: returnHomeLabel, disableUrlParamManagement: disableUrlParamManagement })) }) }));
828
828
  const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2 pt-5", children: [_jsxs("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", children: [isBuyMode && !hideHeader && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: tab => {
829
829
  setActiveTab(tab);
830
830
  // Reset payment methods when switching tabs
@@ -35,10 +35,10 @@ export interface AnySpendDepositProps {
35
35
  sourceTokenAddress?: string;
36
36
  /** Source chain ID to pre-select. If not provided, shows chain selection */
37
37
  sourceTokenChainId?: number;
38
- /** The destination token to receive */
39
- destinationToken: components["schemas"]["Token"];
38
+ /** The destination token address */
39
+ destinationTokenAddress: string;
40
40
  /** The destination chain ID */
41
- destinationChainId: number;
41
+ destinationTokenChainId: number;
42
42
  /** Callback when deposit succeeds */
43
43
  onSuccess?: (amount: string) => void;
44
44
  /** Callback for opening a custom modal (e.g., for special token handling) */
@@ -89,6 +89,11 @@ export interface AnySpendDepositProps {
89
89
  customRecipientLabel?: string;
90
90
  /** Custom label for the return home button (overrides "Return to Home" / "Close") */
91
91
  returnHomeLabel?: string;
92
+ /** Whether the deposit requires a custom function (uses AnySpendCustomExactIn).
93
+ * When false, uses simple swap flow (AnySpend).
94
+ * Defaults to false.
95
+ */
96
+ isCustomDeposit?: boolean;
92
97
  }
93
98
  /**
94
99
  * A flexible deposit component that wraps AnySpendCustomExactIn with optional chain selection.
@@ -97,8 +102,8 @@ export interface AnySpendDepositProps {
97
102
  * // Simple deposit with chain selection
98
103
  * <AnySpendDeposit
99
104
  * recipientAddress={userAddress}
100
- * destinationToken={myToken}
101
- * destinationChainId={base.id}
105
+ * destinationTokenAddress="0x..."
106
+ * destinationTokenChainId={base.id}
102
107
  * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
103
108
  * />
104
109
  *
@@ -106,8 +111,8 @@ export interface AnySpendDepositProps {
106
111
  * // Skip chain selection by providing sourceTokenChainId
107
112
  * <AnySpendDeposit
108
113
  * recipientAddress={userAddress}
109
- * destinationToken={myToken}
110
- * destinationChainId={base.id}
114
+ * destinationTokenAddress="0x..."
115
+ * destinationTokenChainId={base.id}
111
116
  * sourceTokenChainId={base.id}
112
117
  * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
113
118
  * />
@@ -116,8 +121,8 @@ export interface AnySpendDepositProps {
116
121
  * // Deposit with custom contract
117
122
  * <AnySpendDeposit
118
123
  * recipientAddress={userAddress}
119
- * destinationToken={myToken}
120
- * destinationChainId={base.id}
124
+ * destinationTokenAddress="0x..."
125
+ * destinationTokenChainId={base.id}
121
126
  * depositContractConfig={{
122
127
  * contractAddress: "0x...",
123
128
  * functionName: "depositFor",
@@ -125,4 +130,4 @@ export interface AnySpendDepositProps {
125
130
  * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
126
131
  * />
127
132
  */
128
- export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
133
+ export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { HYPERLIQUID_CHAIN_ID } from "../../../anyspend/index.js";
3
- import { Skeleton, useAccountWallet, useSimBalance } from "../../../global-account/react/index.js";
2
+ import { Skeleton, useAccountWallet, useSimBalance, useTokenData } from "../../../global-account/react/index.js";
4
3
  import { cn } from "../../../shared/utils/cn.js";
5
4
  import { NetworkArbitrumOne, NetworkBase, NetworkBinanceSmartChain, NetworkEthereum, NetworkOptimism, NetworkPolygonPos, } from "@web3icons/react";
6
5
  import { ChevronRight } from "lucide-react";
@@ -67,8 +66,8 @@ function ChainIcon({ chainId, className }) {
67
66
  * // Simple deposit with chain selection
68
67
  * <AnySpendDeposit
69
68
  * recipientAddress={userAddress}
70
- * destinationToken={myToken}
71
- * destinationChainId={base.id}
69
+ * destinationTokenAddress="0x..."
70
+ * destinationTokenChainId={base.id}
72
71
  * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
73
72
  * />
74
73
  *
@@ -76,8 +75,8 @@ function ChainIcon({ chainId, className }) {
76
75
  * // Skip chain selection by providing sourceTokenChainId
77
76
  * <AnySpendDeposit
78
77
  * recipientAddress={userAddress}
79
- * destinationToken={myToken}
80
- * destinationChainId={base.id}
78
+ * destinationTokenAddress="0x..."
79
+ * destinationTokenChainId={base.id}
81
80
  * sourceTokenChainId={base.id}
82
81
  * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
83
82
  * />
@@ -86,8 +85,8 @@ function ChainIcon({ chainId, className }) {
86
85
  * // Deposit with custom contract
87
86
  * <AnySpendDeposit
88
87
  * recipientAddress={userAddress}
89
- * destinationToken={myToken}
90
- * destinationChainId={base.id}
88
+ * destinationTokenAddress="0x..."
89
+ * destinationTokenChainId={base.id}
91
90
  * depositContractConfig={{
92
91
  * contractAddress: "0x...",
93
92
  * functionName: "depositFor",
@@ -95,7 +94,7 @@ function ChainIcon({ chainId, className }) {
95
94
  * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
96
95
  * />
97
96
  */
98
- export function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains = DEFAULT_SUPPORTED_CHAINS, minPoolSize = DEFAULT_MIN_POOL_SIZE, topChainsCount = 3, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, }) {
97
+ export function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains = DEFAULT_SUPPORTED_CHAINS, minPoolSize = DEFAULT_MIN_POOL_SIZE, topChainsCount = 3, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit = false, }) {
99
98
  const { connectedEOAWallet } = useAccountWallet();
100
99
  const eoaAddress = connectedEOAWallet?.getAccount()?.address;
101
100
  // Determine if we should show chain selection
@@ -103,6 +102,17 @@ export function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, p
103
102
  const [step, setStep] = useState(shouldShowChainSelection ? "select-chain" : "deposit");
104
103
  const [selectedChainId, setSelectedChainId] = useState(initialSourceChainId);
105
104
  const [paymentType, setPaymentType] = useState(initialPaymentType ?? "crypto");
105
+ // Fetch destination token data
106
+ const { data: destinationTokenData } = useTokenData(destinationTokenChainId, destinationTokenAddress);
107
+ // Construct full destination token object
108
+ const destinationToken = useMemo(() => ({
109
+ address: destinationTokenAddress,
110
+ chainId: destinationTokenChainId,
111
+ symbol: destinationTokenData?.symbol ?? "",
112
+ name: destinationTokenData?.name ?? "",
113
+ decimals: destinationTokenData?.decimals ?? 18,
114
+ metadata: { logoURI: destinationTokenData?.logoURI },
115
+ }), [destinationTokenAddress, destinationTokenChainId, destinationTokenData]);
106
116
  // Fetch balances for EOA wallet
107
117
  const { data: balanceData, isLoading: isBalanceLoading } = useSimBalance(shouldShowChainSelection ? eoaAddress : undefined, supportedChains.map(c => c.id));
108
118
  // Group balances by chain and calculate total USD value per chain
@@ -145,7 +155,7 @@ export function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, p
145
155
  }, [chainBalances]);
146
156
  if (!recipientAddress)
147
157
  return null;
148
- const tokenSymbol = destinationToken.symbol ?? "TOKEN";
158
+ const tokenSymbol = destinationToken.symbol || "TOKEN";
149
159
  // Determine order type based on config
150
160
  const effectiveOrderType = orderType ?? (depositContractConfig ? "custom_exact_in" : "swap");
151
161
  // Default header if not provided
@@ -174,14 +184,12 @@ export function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, p
174
184
  };
175
185
  // Chain selection view
176
186
  if (step === "select-chain") {
177
- return (_jsxs("div", { className: cn("anyspend-deposit anyspend-deposit-chain-selection font-inter bg-as-surface-primary relative mx-auto w-full max-w-[460px]", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: [onClose && (_jsx("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: _jsx("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), !isBalanceLoading && totalBalance > 0 && (_jsxs("div", { className: "anyspend-deposit-balance border-theme-border-secondary border-b p-5", children: [_jsx("p", { className: "anyspend-deposit-balance-label text-as-secondary text-sm", children: "Your Balance" }), _jsxs("p", { className: "anyspend-deposit-balance-value text-as-primary text-3xl font-semibold", children: [formatDecimal(totalBalance), " ", _jsx("span", { className: "text-sm", children: "USD" })] })] })), _jsxs("div", { className: "anyspend-deposit-options flex flex-col gap-2 p-6", children: [isBalanceLoading && (_jsx("div", { className: "anyspend-deposit-chains-skeleton flex flex-col gap-2", children: [1, 2].map((_, i) => (_jsxs("div", { className: "border-border-primary flex items-center justify-between rounded-xl border p-4", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Skeleton, { className: "h-6 w-6 rounded-full" }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx(Skeleton, { className: "h-4 w-32" }), _jsx(Skeleton, { className: "h-3 w-20" })] })] }), _jsx(Skeleton, { className: "h-5 w-5" })] }, i))) })), topChainsWithBalance.length > 0 && (_jsx("div", { className: "anyspend-deposit-chains flex flex-col gap-2", children: topChainsWithBalance.map(chain => (_jsxs("button", { onClick: () => handleSelectChain(chain.id), className: "anyspend-deposit-chain-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [_jsx("div", { className: "anyspend-deposit-chain-content", children: _jsxs("div", { className: "anyspend-deposit-chain-info", children: [_jsxs("span", { className: "anyspend-deposit-chain-name text-as-primary flex items-center gap-1.5 font-medium", children: ["Deposit from ", chain.name, _jsx(ChainIcon, { chainId: chain.id, className: "h-5 w-5" })] }), _jsxs("p", { className: "anyspend-deposit-chain-balance text-as-secondary text-xs", children: [formatUsd(chain.balance), " available"] })] }) }), _jsx(ChevronRight, { className: "anyspend-deposit-chain-chevron text-as-secondary h-5 w-5" })] }, chain.id))) })), _jsxs("div", { className: "anyspend-deposit-general-options flex flex-col gap-2", children: [_jsxs("button", { onClick: handleSelectCrypto, className: "anyspend-deposit-option-button anyspend-deposit-crypto-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [_jsx("div", { className: "anyspend-deposit-option-content", children: _jsxs("div", { className: "anyspend-deposit-option-info", children: [_jsx("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit Crypto" }), _jsx("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Swap from any token on any chain" })] }) }), _jsx(ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), _jsxs("div", { className: "anyspend-deposit-divider flex items-center gap-3", children: [_jsx("div", { className: "bg-as-stroke h-px flex-1" }), _jsx("span", { className: "anyspend-deposit-divider-text text-as-secondary text-sm", children: "More options" }), _jsx("div", { className: "bg-as-stroke h-px flex-1" })] }), _jsxs("button", { onClick: handleSelectQrDeposit, className: "anyspend-deposit-option-button anyspend-deposit-qr-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [_jsxs("div", { className: "anyspend-deposit-option-content flex items-center gap-3", children: [_jsx(QrCodeIcon, { className: "anyspend-deposit-option-icon h-10 w-10" }), _jsxs("div", { className: "anyspend-deposit-option-info", children: [_jsx("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit with QR Code" }), _jsx("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Send tokens directly to deposit address" })] })] }), _jsx(ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), _jsxs("button", { onClick: handleSelectFiat, className: "anyspend-deposit-option-button anyspend-deposit-fiat-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left transition-all", children: [_jsxs("div", { className: "anyspend-deposit-option-content flex items-center gap-3", children: [_jsx(CreditCardIcon, { className: "anyspend-deposit-option-icon h-10 w-10" }), _jsxs("div", { className: "anyspend-deposit-option-info", children: [_jsx("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Fund with Fiat" }), _jsx("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Pay with card or bank transfer" })] })] }), _jsx(ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] })] }), _jsx(ChainWarningText, { chainId: destinationChainId, className: "mt-2" })] })] }));
187
+ return (_jsxs("div", { className: cn("anyspend-deposit anyspend-deposit-chain-selection font-inter bg-as-surface-primary relative mx-auto w-full max-w-[460px]", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: [onClose && (_jsx("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: _jsx("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), !isBalanceLoading && totalBalance > 0 && (_jsxs("div", { className: "anyspend-deposit-balance border-theme-border-secondary border-b p-5", children: [_jsx("p", { className: "anyspend-deposit-balance-label text-as-secondary text-sm", children: "Your Balance" }), _jsxs("p", { className: "anyspend-deposit-balance-value text-as-primary text-3xl font-semibold", children: [formatDecimal(totalBalance), " ", _jsx("span", { className: "text-sm", children: "USD" })] })] })), _jsxs("div", { className: "anyspend-deposit-options flex flex-col gap-2 p-6", children: [isBalanceLoading && (_jsx("div", { className: "anyspend-deposit-chains-skeleton flex flex-col gap-2", children: [1, 2].map((_, i) => (_jsxs("div", { className: "border-border-primary flex items-center justify-between rounded-xl border p-4", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Skeleton, { className: "h-6 w-6 rounded-full" }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx(Skeleton, { className: "h-4 w-32" }), _jsx(Skeleton, { className: "h-3 w-20" })] })] }), _jsx(Skeleton, { className: "h-5 w-5" })] }, i))) })), topChainsWithBalance.length > 0 && (_jsx("div", { className: "anyspend-deposit-chains flex flex-col gap-2", children: topChainsWithBalance.map(chain => (_jsxs("button", { onClick: () => handleSelectChain(chain.id), className: "anyspend-deposit-chain-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [_jsx("div", { className: "anyspend-deposit-chain-content", children: _jsxs("div", { className: "anyspend-deposit-chain-info", children: [_jsxs("span", { className: "anyspend-deposit-chain-name text-as-primary flex items-center gap-1.5 font-medium", children: ["Deposit from ", chain.name, _jsx(ChainIcon, { chainId: chain.id, className: "h-5 w-5" })] }), _jsxs("p", { className: "anyspend-deposit-chain-balance text-as-secondary text-xs", children: [formatUsd(chain.balance), " available"] })] }) }), _jsx(ChevronRight, { className: "anyspend-deposit-chain-chevron text-as-secondary h-5 w-5" })] }, chain.id))) })), _jsxs("div", { className: "anyspend-deposit-general-options flex flex-col gap-2", children: [_jsxs("button", { onClick: handleSelectCrypto, className: "anyspend-deposit-option-button anyspend-deposit-crypto-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [_jsx("div", { className: "anyspend-deposit-option-content", children: _jsxs("div", { className: "anyspend-deposit-option-info", children: [_jsx("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit Crypto" }), _jsx("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Swap from any token on any chain" })] }) }), _jsx(ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), _jsxs("div", { className: "anyspend-deposit-divider flex items-center gap-3", children: [_jsx("div", { className: "bg-as-stroke h-px flex-1" }), _jsx("span", { className: "anyspend-deposit-divider-text text-as-secondary text-sm", children: "More options" }), _jsx("div", { className: "bg-as-stroke h-px flex-1" })] }), _jsxs("button", { onClick: handleSelectQrDeposit, className: "anyspend-deposit-option-button anyspend-deposit-qr-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [_jsxs("div", { className: "anyspend-deposit-option-content flex items-center gap-3", children: [_jsx(QrCodeIcon, { className: "anyspend-deposit-option-icon h-10 w-10" }), _jsxs("div", { className: "anyspend-deposit-option-info", children: [_jsx("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit with QR Code" }), _jsx("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Send tokens directly to deposit address" })] })] }), _jsx(ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), _jsxs("button", { onClick: handleSelectFiat, className: "anyspend-deposit-option-button anyspend-deposit-fiat-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left transition-all", children: [_jsxs("div", { className: "anyspend-deposit-option-content flex items-center gap-3", children: [_jsx(CreditCardIcon, { className: "anyspend-deposit-option-icon h-10 w-10" }), _jsxs("div", { className: "anyspend-deposit-option-info", children: [_jsx("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Fund with Fiat" }), _jsx("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Pay with card or bank transfer" })] })] }), _jsx(ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] })] }), _jsx(ChainWarningText, { chainId: destinationTokenChainId, className: "mt-2" })] })] }));
178
188
  }
179
189
  // QR Deposit view
180
190
  if (step === "qr-deposit") {
181
- return (_jsx(QRDeposit, { mode: mode, recipientAddress: recipientAddress, destinationToken: destinationToken, destinationChainId: destinationChainId, depositContractConfig: depositContractConfig, onBack: handleBack, onClose: onClose ?? handleBack }));
191
+ return (_jsx(QRDeposit, { mode: mode, recipientAddress: recipientAddress, destinationToken: destinationToken, destinationChainId: destinationTokenChainId, depositContractConfig: depositContractConfig, onBack: handleBack, onClose: onClose ?? handleBack }));
182
192
  }
183
- // Check if destination is Hyperliquid
184
- const isHyperliquidDeposit = destinationChainId === HYPERLIQUID_CHAIN_ID;
185
193
  // Deposit view
186
- return (_jsxs("div", { className: "anyspend-deposit anyspend-deposit-form relative", children: [shouldShowChainSelection && (_jsxs("button", { onClick: handleBack, className: "anyspend-deposit-back-button text-as-secondary hover:text-as-primary absolute left-4 top-4 z-10 flex items-center gap-1", children: [_jsx("svg", { className: "anyspend-deposit-back-icon h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }), _jsx("span", { className: "anyspend-deposit-back-text text-sm", children: "Back" })] })), onClose && (_jsx("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: _jsx("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), _jsx("div", { className: cn("anyspend-deposit-form-content", shouldShowChainSelection && "pt-8"), children: isHyperliquidDeposit ? (_jsx(AnySpend, { loadOrder: loadOrder, mode: mode, defaultActiveTab: paymentType, recipientAddress: recipientAddress, sourceChainId: selectedChainId, destinationTokenAddress: destinationToken.address, destinationTokenChainId: destinationChainId, onSuccess: txHash => onSuccess?.(txHash ?? ""), onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, hideHeader: true, hideBottomNavigation: true, disableUrlParamManagement: true, returnToHomeUrl: returnToHomeUrl, customRecipientLabel: customRecipientLabel, returnHomeLabel: returnHomeLabel }, selectedChainId)) : (_jsx(AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: selectedChainId, destinationToken: destinationToken, destinationChainId: destinationChainId, orderType: effectiveOrderType, minDestinationAmount: minDestinationAmount, header: header ?? defaultHeader, onSuccess: onSuccess, onOpenCustomModal: onOpenCustomModal, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa, customExactInConfig: depositContractConfig, returnToHomeUrl: returnToHomeUrl, customRecipientLabel: customRecipientLabel, returnHomeLabel: returnHomeLabel }, selectedChainId)) }), _jsx(ChainWarningText, { chainId: destinationChainId, className: "px-4 pb-4" })] }));
194
+ return (_jsxs("div", { className: "anyspend-deposit anyspend-deposit-form relative", children: [shouldShowChainSelection && (_jsxs("button", { onClick: handleBack, className: "anyspend-deposit-back-button text-as-secondary hover:text-as-primary absolute left-4 top-4 z-10 flex items-center gap-1", children: [_jsx("svg", { className: "anyspend-deposit-back-icon h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }), _jsx("span", { className: "anyspend-deposit-back-text text-sm", children: "Back" })] })), onClose && (_jsx("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: _jsx("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), _jsx("div", { className: cn("anyspend-deposit-form-content", shouldShowChainSelection && "pt-8"), children: isCustomDeposit ? (_jsx(AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: selectedChainId, destinationToken: destinationToken, destinationChainId: destinationTokenChainId, orderType: effectiveOrderType, minDestinationAmount: minDestinationAmount, header: header ?? defaultHeader, onSuccess: onSuccess, onOpenCustomModal: onOpenCustomModal, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa, customExactInConfig: depositContractConfig, returnToHomeUrl: returnToHomeUrl, customRecipientLabel: customRecipientLabel, returnHomeLabel: returnHomeLabel }, selectedChainId)) : (_jsx(AnySpend, { loadOrder: loadOrder, mode: mode, defaultActiveTab: paymentType, recipientAddress: recipientAddress, sourceChainId: selectedChainId, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, onSuccess: txHash => onSuccess?.(txHash ?? ""), onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, hideHeader: true, hideBottomNavigation: true, disableUrlParamManagement: true, returnToHomeUrl: returnToHomeUrl, customRecipientLabel: customRecipientLabel, returnHomeLabel: returnHomeLabel }, selectedChainId)) }), _jsx(ChainWarningText, { chainId: destinationTokenChainId, className: "px-4 pb-4" })] }));
187
195
  }