@0xsequence/marketplace-sdk 0.3.0 → 0.3.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 (166) hide show
  1. package/dist/chunk-22NLQ3AS.js +3078 -0
  2. package/dist/chunk-22NLQ3AS.js.map +1 -0
  3. package/dist/chunk-3OHM45R3.js +1294 -0
  4. package/dist/chunk-3OHM45R3.js.map +1 -0
  5. package/dist/{chunk-MQR6SHXZ.js → chunk-4YU2UPYH.js} +58 -103
  6. package/dist/chunk-4YU2UPYH.js.map +1 -0
  7. package/dist/chunk-7NJETFMF.js +21 -0
  8. package/dist/chunk-7NJETFMF.js.map +1 -0
  9. package/dist/{chunk-UYRQ5MJQ.js → chunk-FUM4OGOQ.js} +4 -4
  10. package/dist/chunk-FUM4OGOQ.js.map +1 -0
  11. package/dist/{chunk-7OO74L2K.js → chunk-GJAKQ5Q3.js} +40 -1
  12. package/dist/chunk-GJAKQ5Q3.js.map +1 -0
  13. package/dist/chunk-MCI3KOSQ.js +2 -0
  14. package/dist/{chunk-BJE7AG6V.js → chunk-O7UQGT43.js} +698 -23
  15. package/dist/chunk-O7UQGT43.js.map +1 -0
  16. package/dist/{chunk-CSN7YD5Q.js → chunk-Q57TEA3Z.js} +20 -2
  17. package/dist/chunk-Q57TEA3Z.js.map +1 -0
  18. package/dist/{chunk-VEX7FDL6.js → chunk-SBVLWSRZ.js} +2 -2
  19. package/dist/{chunk-VEX7FDL6.js.map → chunk-SBVLWSRZ.js.map} +1 -1
  20. package/dist/{chunk-6S4FYXP6.js → chunk-SPW24Y7I.js} +40 -1
  21. package/dist/chunk-SPW24Y7I.js.map +1 -0
  22. package/dist/chunk-UISBTKFF.js +1 -0
  23. package/dist/{chunk-OUWB3FHZ.js → chunk-WA433WAJ.js} +9 -33
  24. package/dist/chunk-WA433WAJ.js.map +1 -0
  25. package/dist/{chunk-O5JXKTWP.js → chunk-WFE6OCYF.js} +4 -4
  26. package/dist/chunk-WFE6OCYF.js.map +1 -0
  27. package/dist/chunk-XX4EVWBF.js +1292 -0
  28. package/dist/chunk-XX4EVWBF.js.map +1 -0
  29. package/dist/chunk-Y7YO5TLE.js +53 -0
  30. package/dist/chunk-Y7YO5TLE.js.map +1 -0
  31. package/dist/index.css +1 -50
  32. package/dist/index.d.ts +3 -5
  33. package/dist/index.js +158 -73
  34. package/dist/index.js.map +1 -1
  35. package/dist/react/hooks/index.css +82 -0
  36. package/dist/react/hooks/index.css.map +1 -0
  37. package/dist/react/hooks/index.d.ts +401 -462
  38. package/dist/react/hooks/index.js +26 -6
  39. package/dist/react/index.css +56 -91
  40. package/dist/react/index.css.map +1 -1
  41. package/dist/react/index.d.ts +2 -2
  42. package/dist/react/index.js +32 -13
  43. package/dist/react/ui/components/index.css +86 -121
  44. package/dist/react/ui/components/index.css.map +1 -1
  45. package/dist/react/ui/components/index.d.ts +10 -4
  46. package/dist/react/ui/components/index.js +12 -11
  47. package/dist/react/ui/icons/index.js +3 -2
  48. package/dist/react/ui/icons/index.js.map +1 -1
  49. package/dist/react/ui/index.css +56 -91
  50. package/dist/react/ui/index.css.map +1 -1
  51. package/dist/react/ui/index.d.ts +29 -31
  52. package/dist/react/ui/index.js +14 -11
  53. package/dist/react/ui/modals/_internal/components/actionModal/index.js +5 -16
  54. package/dist/react/ui/modals/_internal/components/actionModal/index.js.map +1 -1
  55. package/dist/react/ui/styles/index.d.ts +1 -1
  56. package/dist/styles/index.css +1 -50
  57. package/dist/styles/index.css.map +1 -1
  58. package/dist/styles/index.d.ts +1 -5
  59. package/dist/styles/index.js +8 -10
  60. package/dist/utils/abi/index.d.ts +2 -0
  61. package/dist/utils/abi/index.js +21 -0
  62. package/dist/utils/abi/marketplace/index.d.ts +805 -0
  63. package/dist/utils/abi/marketplace/index.js +12 -0
  64. package/dist/utils/abi/{abi/token → token}/index.js +1 -2
  65. package/dist/utils/index.d.ts +5 -5
  66. package/dist/utils/index.js +12 -14
  67. package/package.json +17 -15
  68. package/src/react/_internal/transaction-machine/execute-transaction.ts +592 -0
  69. package/src/react/_internal/transaction-machine/useTransactionMachine.ts +66 -0
  70. package/src/react/hooks/index.ts +4 -0
  71. package/src/react/hooks/useBuyCollectable.tsx +38 -0
  72. package/src/react/hooks/useCancelOrder.tsx +38 -0
  73. package/src/react/hooks/useCheckoutOptions.tsx +9 -6
  74. package/src/react/hooks/useCreateListing.tsx +65 -0
  75. package/src/react/hooks/useGenerateBuyTransaction.tsx +71 -0
  76. package/src/react/hooks/useListListingsForCollectible.tsx +1 -1
  77. package/src/react/hooks/useMakeOffer.tsx +62 -0
  78. package/src/react/hooks/useRoyaltyPercentage.tsx +1 -1
  79. package/src/react/hooks/useSell.tsx +62 -0
  80. package/src/react/ui/components/_internals/action-button/ActionButton.tsx +107 -115
  81. package/src/react/ui/components/_internals/custom-select/CustomSelect.tsx +63 -0
  82. package/src/react/ui/components/_internals/custom-select/styles.css.ts +64 -0
  83. package/src/react/ui/components/collectible-card/CollectibleCard.tsx +127 -130
  84. package/src/react/ui/components/collectible-card/Footer.tsx +65 -58
  85. package/src/react/ui/icons/Bell.tsx +2 -2
  86. package/src/react/ui/index.ts +1 -0
  87. package/src/react/ui/modals/BuyModal/_store.ts +53 -0
  88. package/src/react/ui/modals/BuyModal/index.tsx +119 -0
  89. package/src/react/ui/modals/CreateListingModal/_store.ts +35 -312
  90. package/src/react/ui/modals/CreateListingModal/index.tsx +185 -126
  91. package/src/react/ui/modals/MakeOfferModal/_store.ts +34 -276
  92. package/src/react/ui/modals/MakeOfferModal/index.tsx +195 -136
  93. package/src/react/ui/modals/SellModal/_store.ts +29 -262
  94. package/src/react/ui/modals/SellModal/index.tsx +156 -121
  95. package/src/react/ui/modals/SuccessfulPurchaseModal/_store.ts +17 -3
  96. package/src/react/ui/modals/SuccessfulPurchaseModal/index.tsx +3 -2
  97. package/src/react/ui/modals/TransferModal/index.tsx +9 -16
  98. package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +1 -0
  99. package/src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx +18 -0
  100. package/src/react/ui/modals/_internal/components/actionModal/LoadingModal.tsx +18 -0
  101. package/src/react/ui/modals/_internal/components/calendarPopover/index.tsx +1 -0
  102. package/src/react/ui/modals/_internal/components/calendarPopover/overrides.css +8 -0
  103. package/src/react/ui/modals/_internal/components/calendarPopover/styles.css.ts +10 -4
  104. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +10 -13
  105. package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +23 -9
  106. package/src/react/ui/modals/_internal/components/priceInput/index.tsx +7 -18
  107. package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +17 -44
  108. package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +10 -8
  109. package/src/react/ui/modals/_internal/components/tokenPreview/index.tsx +14 -3
  110. package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +4 -2
  111. package/src/react/ui/modals/_internal/components/transactionHeader/index.tsx +4 -4
  112. package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +4 -2
  113. package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +13 -10
  114. package/src/react/ui/modals/_internal/types.ts +13 -0
  115. package/src/react/ui/modals/modal-provider.tsx +4 -2
  116. package/src/styles/index.ts +0 -2
  117. package/src/utils/abi/index.ts +2 -0
  118. package/src/utils/abi/marketplace/index.ts +3 -0
  119. package/src/utils/abi/marketplace/sequence-marketplace-v1.ts +463 -0
  120. package/src/utils/abi/marketplace/sequence-marketplace-v2.ts +802 -0
  121. package/src/utils/index.ts +2 -3
  122. package/src/utils/network.ts +4 -2
  123. package/tsconfig.tsbuildinfo +1 -1
  124. package/dist/chunk-6JWGELXL.js +0 -214
  125. package/dist/chunk-6JWGELXL.js.map +0 -1
  126. package/dist/chunk-6S4FYXP6.js.map +0 -1
  127. package/dist/chunk-7OO74L2K.js.map +0 -1
  128. package/dist/chunk-BCNFYVAL.js +0 -1
  129. package/dist/chunk-BJE7AG6V.js.map +0 -1
  130. package/dist/chunk-CSN7YD5Q.js.map +0 -1
  131. package/dist/chunk-D7QQP6MS.js +0 -2
  132. package/dist/chunk-DBFOPEV6.js +0 -23
  133. package/dist/chunk-DBFOPEV6.js.map +0 -1
  134. package/dist/chunk-MQR6SHXZ.js.map +0 -1
  135. package/dist/chunk-O5JXKTWP.js.map +0 -1
  136. package/dist/chunk-OUWB3FHZ.js.map +0 -1
  137. package/dist/chunk-PE2LLUTJ.js +0 -213
  138. package/dist/chunk-PE2LLUTJ.js.map +0 -1
  139. package/dist/chunk-QVFMD6S2.js +0 -21
  140. package/dist/chunk-QVFMD6S2.js.map +0 -1
  141. package/dist/chunk-QXLZPSSR.js +0 -3316
  142. package/dist/chunk-QXLZPSSR.js.map +0 -1
  143. package/dist/chunk-UYRQ5MJQ.js.map +0 -1
  144. package/dist/utils/abi/abi/standard/index.d.ts +0 -25
  145. package/dist/utils/abi/abi/standard/index.js +0 -8
  146. package/dist/utils/abi/clients/index.d.ts +0 -27
  147. package/dist/utils/abi/clients/index.js +0 -13
  148. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/styles.css.ts +0 -33
  149. package/src/react/ui/modals/_internal/components/expirationDateSelect/styles.css.ts +0 -25
  150. package/src/utils/abi/abi/standard/index.ts +0 -1
  151. package/src/utils/abi/clients/ERC1155.ts +0 -82
  152. package/src/utils/abi/clients/ERC20.ts +0 -101
  153. package/src/utils/abi/clients/ERC721.ts +0 -97
  154. package/src/utils/abi/clients/index.ts +0 -3
  155. /package/dist/{chunk-BCNFYVAL.js.map → chunk-MCI3KOSQ.js.map} +0 -0
  156. /package/dist/{chunk-D7QQP6MS.js.map → chunk-UISBTKFF.js.map} +0 -0
  157. /package/dist/utils/abi/{abi/standard/index.js.map → index.js.map} +0 -0
  158. /package/dist/utils/abi/{abi/token → marketplace}/index.js.map +0 -0
  159. /package/dist/utils/abi/{abi/token → token}/index.d.ts +0 -0
  160. /package/dist/utils/abi/{clients → token}/index.js.map +0 -0
  161. /package/src/react/hooks/{useGenerateCancleTransaction.tsx → useGenerateCancelTransaction.tsx} +0 -0
  162. /package/src/utils/abi/{abi/standard → marketplace}/EIP2981.ts +0 -0
  163. /package/src/utils/abi/{abi/token → token}/ERC1155.ts +0 -0
  164. /package/src/utils/abi/{abi/token → token}/ERC20.ts +0 -0
  165. /package/src/utils/abi/{abi/token → token}/ERC721.ts +0 -0
  166. /package/src/utils/abi/{abi/token → token}/index.ts +0 -0
@@ -1,3316 +0,0 @@
1
- "use client"
2
- import {
3
- ActionModal
4
- } from "./chunk-CSN7YD5Q.js";
5
- import {
6
- CalendarIcon_default,
7
- InfoIcon_default,
8
- MinusIcon_default,
9
- PlusIcon_default,
10
- PositiveCircleIcon_default
11
- } from "./chunk-MQR6SHXZ.js";
12
- import {
13
- alertMessageBox,
14
- alertMessageBoxVariants,
15
- closeButton,
16
- closeButton2,
17
- closeButton3,
18
- collectiblesGrid,
19
- collectiblesGridImage,
20
- collectiblesGridImagePale,
21
- collectiblesGridItem,
22
- currencySelect,
23
- dateSelectButton,
24
- dateSelectPopoverContent,
25
- dialogContent,
26
- dialogOverlay,
27
- dialogOverlay2,
28
- dialogOverlay3,
29
- priceInputCurrencyImage,
30
- priceInputWrapper,
31
- quantityInputWrapper,
32
- rangeSelect,
33
- switchChainCta,
34
- switchChainModalContent,
35
- tokenPreview,
36
- transferModalContent
37
- } from "./chunk-OUWB3FHZ.js";
38
- import {
39
- iconVariants
40
- } from "./chunk-VEX7FDL6.js";
41
- import {
42
- useBalanceOfCollectible,
43
- useCollectible,
44
- useCollection,
45
- useCurrencies,
46
- useGenerateListingTransaction,
47
- useGenerateOfferTransaction,
48
- useGenerateSellTransaction,
49
- useHighestOffer,
50
- useListBalances,
51
- useLowestListing,
52
- useMarketplaceConfig,
53
- useRoyaltyPercentage,
54
- useTransferTokens
55
- } from "./chunk-BJE7AG6V.js";
56
- import {
57
- calculatePriceDifferencePercentage,
58
- truncateMiddle
59
- } from "./chunk-6S4FYXP6.js";
60
- import {
61
- balanceQueries,
62
- collectableKeys,
63
- getQueryClient
64
- } from "./chunk-GZG2QO64.js";
65
-
66
- // src/react/ui/modals/modal-provider.tsx
67
- import { observer as observer14 } from "@legendapp/state/react";
68
-
69
- // src/react/ui/modals/Account/index.tsx
70
- import { Box, Button, Modal, Text } from "@0xsequence/design-system";
71
- import { observable } from "@legendapp/state";
72
- import { observer } from "@legendapp/state/react";
73
- import { useAccount } from "wagmi";
74
- import { jsx, jsxs } from "react/jsx-runtime";
75
- var accountModalOpen$ = observable(false);
76
- var AccountModal = observer(function AccountModal2() {
77
- const { address } = useAccount();
78
- return accountModalOpen$.get() && /* @__PURE__ */ jsxs(Modal, { children: [
79
- /* @__PURE__ */ jsxs(Box, { children: [
80
- /* @__PURE__ */ jsx(Text, { children: "Wallet address" }),
81
- /* @__PURE__ */ jsx(Text, { children: address })
82
- ] }),
83
- /* @__PURE__ */ jsx(Button, { label: "Sign out" })
84
- ] });
85
- });
86
-
87
- // src/react/ui/modals/CreateListingModal/index.tsx
88
- import { Box as Box12 } from "@0xsequence/design-system";
89
- import { Show, observer as observer8 } from "@legendapp/state/react";
90
- import { useAccount as useAccount4 } from "wagmi";
91
-
92
- // src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
93
- import { useState } from "react";
94
- import { Box as Box2, Select, Text as Text2 } from "@0xsequence/design-system";
95
- import { observer as observer2 } from "@legendapp/state/react";
96
- import { addDays, isSameDay } from "date-fns";
97
-
98
- // src/react/ui/modals/_internal/components/calendarPopover/index.tsx
99
- import { Button as Button2 } from "@0xsequence/design-system";
100
- import { Content, Portal, Root, Trigger } from "@radix-ui/react-popover";
101
- import { format } from "date-fns";
102
-
103
- // src/react/ui/modals/_internal/components/calendar/index.tsx
104
- import { DayPicker } from "react-day-picker";
105
- import "react-day-picker/style.css";
106
- import { jsx as jsx2 } from "react/jsx-runtime";
107
- function Calendar({ ...props }) {
108
- const { selectedDate, setSelectedDate } = props;
109
- return /* @__PURE__ */ jsx2(
110
- DayPicker,
111
- {
112
- disabled: {
113
- before: /* @__PURE__ */ new Date()
114
- },
115
- selected: selectedDate,
116
- onDayClick: setSelectedDate,
117
- defaultMonth: selectedDate,
118
- modifiersStyles: {
119
- selected: {
120
- color: "hsl(var(--foreground))",
121
- background: "hsl(var(--primary))",
122
- border: "none"
123
- }
124
- },
125
- styles: {
126
- root: {
127
- width: "max-content",
128
- margin: 0,
129
- color: "hsl(var(--foreground))",
130
- background: "hsl(var(--background))",
131
- border: `1px solid hsl(var(--border))`,
132
- borderRadius: "var(--radius)",
133
- padding: "0.5rem",
134
- position: "relative"
135
- },
136
- day: {
137
- margin: 0,
138
- width: "1rem",
139
- height: "1rem"
140
- },
141
- day_button: {
142
- margin: 0,
143
- width: "1.8rem",
144
- height: "1.5rem",
145
- padding: 0,
146
- border: "none"
147
- }
148
- },
149
- ...props
150
- }
151
- );
152
- }
153
- Calendar.displayName = "Calendar";
154
- var calendar_default = Calendar;
155
-
156
- // src/react/ui/modals/_internal/components/calendarPopover/index.tsx
157
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
158
- function CalendarPopover({
159
- selectedDate,
160
- setSelectedDate
161
- }) {
162
- return /* @__PURE__ */ jsxs2(Root, { children: [
163
- /* @__PURE__ */ jsx3(Trigger, { asChild: true, children: /* @__PURE__ */ jsx3(
164
- Button2,
165
- {
166
- leftIcon: CalendarIcon_default,
167
- className: dateSelectButton,
168
- variant: "ghost",
169
- label: format(selectedDate, "dd/MM/yyyy HH:mm"),
170
- shape: "square"
171
- }
172
- ) }),
173
- /* @__PURE__ */ jsx3(Portal, { children: /* @__PURE__ */ jsx3(Content, { className: dateSelectPopoverContent, sideOffset: 5, children: /* @__PURE__ */ jsx3(
174
- calendar_default,
175
- {
176
- selectedDate,
177
- setSelectedDate,
178
- mode: "single"
179
- }
180
- ) }) })
181
- ] });
182
- }
183
-
184
- // src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
185
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
186
- var PRESET_RANGES = {
187
- TODAY: {
188
- label: "Today",
189
- value: "today",
190
- offset: 0
191
- },
192
- TOMORROW: {
193
- label: "Tomorrow",
194
- value: "tomorrow",
195
- offset: 1
196
- },
197
- IN_3_DAYS: {
198
- label: "In 3 days",
199
- value: "3_days",
200
- offset: 3
201
- },
202
- ONE_WEEK: {
203
- label: "1 week",
204
- value: "1_week",
205
- offset: 7
206
- },
207
- ONE_MONTH: {
208
- label: "1 month",
209
- value: "1_month",
210
- offset: 30
211
- }
212
- };
213
- var ExpirationDateSelect = observer2(function ExpirationDateSelect2({
214
- className,
215
- $date
216
- }) {
217
- const [_, setRange] = useState("1_week");
218
- function handleSelectPresetRange(range) {
219
- setRange(range);
220
- const presetRange = Object.values(PRESET_RANGES).find(
221
- (preset) => preset.value === range
222
- );
223
- if (!presetRange) {
224
- return;
225
- }
226
- const newDate = addDays(/* @__PURE__ */ new Date(), presetRange.offset);
227
- $date.set(newDate);
228
- }
229
- function handleDateValueChange(date) {
230
- const presetRange = Object.values(PRESET_RANGES).find(
231
- (preset) => isSameDay(new Date(date), addDays(/* @__PURE__ */ new Date(), preset.offset))
232
- );
233
- if (presetRange) {
234
- setRange(presetRange.value);
235
- }
236
- $date.set(date);
237
- }
238
- return /* @__PURE__ */ jsxs3(Box2, { width: "full", position: "relative", children: [
239
- /* @__PURE__ */ jsx4(
240
- Text2,
241
- {
242
- fontSize: "small",
243
- fontWeight: "medium",
244
- textAlign: "left",
245
- width: "full",
246
- color: "text100",
247
- children: "Set expiry"
248
- }
249
- ),
250
- /* @__PURE__ */ jsxs3(
251
- Box2,
252
- {
253
- className,
254
- width: "full",
255
- display: "flex",
256
- alignItems: "center",
257
- gap: "2",
258
- marginTop: "0.5",
259
- children: [
260
- /* @__PURE__ */ jsx4(Box2, { className: rangeSelect, position: "absolute", right: "2", children: /* @__PURE__ */ jsx4(
261
- Select,
262
- {
263
- name: "expirationDate",
264
- options: Object.values(PRESET_RANGES),
265
- defaultValue: void 0,
266
- value: Object.values(PRESET_RANGES).find(
267
- (preset) => isSameDay(
268
- new Date($date.get()),
269
- addDays(/* @__PURE__ */ new Date(), preset.offset)
270
- )
271
- )?.value,
272
- onValueChange: (value) => handleSelectPresetRange(value)
273
- }
274
- ) }),
275
- /* @__PURE__ */ jsx4(
276
- CalendarPopover,
277
- {
278
- selectedDate: $date.get(),
279
- setSelectedDate: (date) => handleDateValueChange(date)
280
- }
281
- )
282
- ]
283
- }
284
- )
285
- ] });
286
- });
287
- var expirationDateSelect_default = ExpirationDateSelect;
288
-
289
- // src/react/ui/modals/_internal/components/floorPriceText/index.tsx
290
- import { Text as Text3 } from "@0xsequence/design-system";
291
- import { jsx as jsx5 } from "react/jsx-runtime";
292
- function FloorPriceText({
293
- chainId,
294
- collectionAddress,
295
- tokenId,
296
- price
297
- }) {
298
- const { data: listing, isLoading: listingLoading } = useLowestListing({
299
- tokenId,
300
- chainId,
301
- collectionAddress,
302
- filters: {
303
- currencies: [price.currency.contractAddress]
304
- }
305
- });
306
- const floorPriceRaw = listing?.order?.priceAmount;
307
- if (!floorPriceRaw || listingLoading || price.amountRaw === "0") {
308
- return null;
309
- }
310
- const floorPriceDifference = calculatePriceDifferencePercentage({
311
- inputPriceRaw: BigInt(price.amountRaw),
312
- basePriceRaw: BigInt(floorPriceRaw),
313
- decimals: price.currency.decimals
314
- });
315
- const floorPriceDifferenceText = floorPriceRaw === price.amountRaw ? "Same as floor price" : `${floorPriceDifference}% ${floorPriceRaw > price.amountRaw ? "below" : "above"} floor price`;
316
- return /* @__PURE__ */ jsx5(
317
- Text3,
318
- {
319
- fontSize: "small",
320
- fontWeight: "medium",
321
- textAlign: "left",
322
- width: "full",
323
- color: "text50",
324
- children: floorPriceDifferenceText
325
- }
326
- );
327
- }
328
-
329
- // src/react/ui/modals/_internal/components/priceInput/index.tsx
330
- import { Box as Box4, NumericInput, TokenImage } from "@0xsequence/design-system";
331
- import { observer as observer4 } from "@legendapp/state/react";
332
- import { useState as useState3 } from "react";
333
- import { erc20Abi, formatUnits, parseUnits } from "viem";
334
- import { useAccount as useAccount2, useReadContract } from "wagmi";
335
-
336
- // src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx
337
- import { Box as Box3, Select as Select2, Skeleton } from "@0xsequence/design-system";
338
- import { observer as observer3 } from "@legendapp/state/react";
339
- import { useEffect, useState as useState2 } from "react";
340
- import { jsx as jsx6 } from "react/jsx-runtime";
341
- var CurrencyOptionsSelect = observer3(function CurrencyOptionsSelect2({
342
- chainId,
343
- collectionAddress,
344
- $selectedCurrency
345
- }) {
346
- const [value, setValue] = useState2(null);
347
- const { data: currencies, isLoading: currenciesLoading } = useCurrencies({
348
- collectionAddress,
349
- chainId
350
- });
351
- useEffect(() => {
352
- if (currencies && currencies.length > 0 && !$selectedCurrency.contractAddress.get()) {
353
- $selectedCurrency.set(currencies[0]);
354
- }
355
- }, [currencies]);
356
- if (!currencies || currenciesLoading) {
357
- return /* @__PURE__ */ jsx6(Skeleton, { borderRadius: "lg", width: "20", height: "7", marginRight: "3" });
358
- }
359
- const options = currencies.map(
360
- (currency) => ({
361
- label: currency.name,
362
- value: currency.contractAddress
363
- })
364
- );
365
- const onChange = (value2) => {
366
- const c = currencies.find(
367
- (currency) => currency.contractAddress === value2
368
- );
369
- setValue(value2);
370
- $selectedCurrency.set(c);
371
- };
372
- return /* @__PURE__ */ jsx6(Box3, { className: currencySelect, children: /* @__PURE__ */ jsx6(
373
- Select2,
374
- {
375
- name: "currencies",
376
- value: value || options?.[0]?.value,
377
- onValueChange: (value2) => onChange(value2),
378
- options
379
- }
380
- ) });
381
- });
382
- var currencyOptionsSelect_default = CurrencyOptionsSelect;
383
-
384
- // src/react/ui/modals/_internal/components/priceInput/index.tsx
385
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
386
- var PriceInput = observer4(function PriceInput2({
387
- chainId,
388
- collectionAddress,
389
- $listingPrice,
390
- checkBalance
391
- }) {
392
- const [balanceError, setBalanceError] = useState3("");
393
- const { address: accountAddress } = useAccount2();
394
- const { data: balance, isSuccess: isBalanceSuccess } = useReadContract({
395
- address: $listingPrice.currency.contractAddress.get(),
396
- abi: erc20Abi,
397
- functionName: "balanceOf",
398
- args: [accountAddress],
399
- query: {
400
- enabled: checkBalance?.enabled
401
- }
402
- });
403
- const listingPriceAmountRaw = $listingPrice.amountRaw.get();
404
- const currencyDecimals = $listingPrice.currency.decimals.get();
405
- const checkInsufficientBalance = (priceAmountRaw) => {
406
- const hasInsufficientBalance = isBalanceSuccess && priceAmountRaw && currencyDecimals && BigInt(priceAmountRaw) > (balance || 0);
407
- if (!checkBalance) return;
408
- if (hasInsufficientBalance) {
409
- setBalanceError("Insufficient balance");
410
- checkBalance.callback(true);
411
- } else {
412
- setBalanceError("");
413
- checkBalance.callback(false);
414
- }
415
- };
416
- const changeListingPrice = (value) => {
417
- const parsedAmount = parseUnits(
418
- value,
419
- Number($listingPrice.currency.decimals.get())
420
- );
421
- $listingPrice.amountRaw.set(parsedAmount.toString());
422
- checkBalance && checkInsufficientBalance(parsedAmount.toString());
423
- };
424
- return /* @__PURE__ */ jsxs4(Box4, { className: priceInputWrapper, position: "relative", children: [
425
- /* @__PURE__ */ jsx7(
426
- Box4,
427
- {
428
- className: priceInputCurrencyImage,
429
- position: "absolute",
430
- left: "2",
431
- display: "flex",
432
- alignItems: "center",
433
- children: /* @__PURE__ */ jsx7(TokenImage, { src: $listingPrice.currency.imageUrl.get(), size: "xs" })
434
- }
435
- ),
436
- /* @__PURE__ */ jsx7(
437
- NumericInput,
438
- {
439
- name: "listingPrice",
440
- decimals: $listingPrice?.currency.decimals.get(),
441
- label: "Enter price",
442
- labelLocation: "top",
443
- placeholder: "0.00",
444
- controls: /* @__PURE__ */ jsx7(
445
- currencyOptionsSelect_default,
446
- {
447
- $selectedCurrency: $listingPrice?.currency,
448
- collectionAddress,
449
- chainId
450
- }
451
- ),
452
- numeric: true,
453
- value: listingPriceAmountRaw ? formatUnits(
454
- BigInt(listingPriceAmountRaw),
455
- Number(currencyDecimals)
456
- ) : "",
457
- onChange: (event) => changeListingPrice(event.target.value),
458
- width: "full"
459
- }
460
- ),
461
- balanceError && /* @__PURE__ */ jsx7(Box4, { color: "negative", fontSize: "small", children: balanceError })
462
- ] });
463
- });
464
- var priceInput_default = PriceInput;
465
-
466
- // src/react/ui/modals/_internal/components/quantityInput/index.tsx
467
- import { Box as Box5, IconButton, NumericInput as NumericInput2 } from "@0xsequence/design-system";
468
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
469
- function QuantityInput({
470
- $quantity,
471
- chainId,
472
- collectionAddress,
473
- collectibleId
474
- }) {
475
- const { data: collectable, isLoading: collectableLoading } = useCollectible({
476
- chainId,
477
- collectionAddress,
478
- collectibleId
479
- });
480
- const quantityDecimals = collectable && (collectable.decimals || 0);
481
- function handleChangeQuantity(value) {
482
- if (!isValidInput(value)) return;
483
- const formattedValue = formatQuantity(value);
484
- if (formattedValue !== null) {
485
- $quantity.set(formattedValue);
486
- }
487
- }
488
- function handleIncrement() {
489
- if (!isValidInput()) return;
490
- const newQuantity = incrementQuantity();
491
- if (newQuantity !== null) {
492
- $quantity.set(newQuantity);
493
- }
494
- }
495
- function handleDecrement() {
496
- if (!isValidInput()) return;
497
- const newQuantity = decrementQuantity();
498
- if (newQuantity !== null) {
499
- $quantity.set(newQuantity);
500
- }
501
- }
502
- function isValidInput(value) {
503
- return collectable !== void 0 && quantityDecimals !== void 0 && (value === void 0 || value !== "");
504
- }
505
- function formatQuantity(value) {
506
- if (quantityDecimals === 0 && value.includes(".")) {
507
- return null;
508
- }
509
- if (quantityDecimals && quantityDecimals > 0) {
510
- const decimalIndex = value.indexOf(".");
511
- if (decimalIndex !== -1 && value.length - decimalIndex > quantityDecimals + 1) {
512
- return null;
513
- }
514
- }
515
- return value;
516
- }
517
- const quantity = $quantity.get();
518
- function incrementQuantity() {
519
- if (!isValidInput()) return null;
520
- if (!quantity) {
521
- return quantityDecimals === 0 ? "1" : `1.${"0".repeat(quantityDecimals)}`;
522
- }
523
- const newValue = quantityDecimals === 0 ? (Number.parseInt(quantity) + 1).toString() : (Number.parseFloat(quantity) + 1).toFixed(quantityDecimals);
524
- return newValue;
525
- }
526
- function decrementQuantity() {
527
- if (!quantity) {
528
- return "1";
529
- }
530
- const newValue = Number.parseFloat(quantity) - 1;
531
- if (newValue < 0) {
532
- return null;
533
- }
534
- return quantityDecimals === 0 ? newValue.toString() : newValue.toFixed(quantityDecimals);
535
- }
536
- function getPlaceholder(decimals) {
537
- if (decimals === 0) {
538
- return "0";
539
- } else {
540
- return "0." + "0".repeat(decimals);
541
- }
542
- }
543
- if (collectableLoading) {
544
- return null;
545
- }
546
- return /* @__PURE__ */ jsx8(Box5, { className: quantityInputWrapper, children: /* @__PURE__ */ jsx8(
547
- NumericInput2,
548
- {
549
- name: "quantity",
550
- decimals: quantityDecimals || 0,
551
- paddingLeft: "1",
552
- label: "Enter quantity",
553
- labelLocation: "top",
554
- placeholder: getPlaceholder(quantityDecimals || 0),
555
- controls: /* @__PURE__ */ jsxs5(
556
- Box5,
557
- {
558
- display: "flex",
559
- alignItems: "center",
560
- gap: "1",
561
- marginRight: "2",
562
- children: [
563
- /* @__PURE__ */ jsx8(
564
- IconButton,
565
- {
566
- disabled: Number.parseFloat(quantity) === 0 || !quantity,
567
- onClick: handleDecrement,
568
- background: "buttonGlass",
569
- size: "xs",
570
- icon: MinusIcon_default
571
- }
572
- ),
573
- /* @__PURE__ */ jsx8(
574
- IconButton,
575
- {
576
- onClick: handleIncrement,
577
- background: "buttonGlass",
578
- size: "xs",
579
- icon: PlusIcon_default
580
- }
581
- )
582
- ]
583
- }
584
- ),
585
- numeric: true,
586
- value: $quantity.get(),
587
- onChange: (e) => handleChangeQuantity(e.target.value),
588
- width: "full"
589
- }
590
- ) });
591
- }
592
-
593
- // src/react/ui/modals/_internal/components/switchChainModal/index.tsx
594
- import { Close, Content as Content2, Overlay, Portal as Portal2, Root as Root2 } from "@radix-ui/react-dialog";
595
-
596
- // src/react/ui/modals/_internal/components/switchChainModal/store.ts
597
- import { observable as observable2 } from "@legendapp/state";
598
- var initialState = {
599
- isOpen: false,
600
- open: ({ chainIdToSwitchTo, onSwitchChain, callbacks }) => {
601
- switchChainModal$.state.set({
602
- ...switchChainModal$.state.get(),
603
- chainIdToSwitchTo,
604
- onSwitchChain,
605
- callbacks
606
- });
607
- switchChainModal$.isOpen.set(true);
608
- },
609
- close: () => {
610
- switchChainModal$.isOpen.set(false);
611
- switchChainModal$.state.set({
612
- ...initialState.state
613
- });
614
- },
615
- state: {
616
- chainIdToSwitchTo: void 0,
617
- onSwitchChain: () => {
618
- },
619
- isSwitching: false
620
- }
621
- };
622
- var switchChainModal$ = observable2(initialState);
623
-
624
- // src/react/ui/modals/_internal/components/switchChainModal/index.tsx
625
- import {
626
- Button as Button3,
627
- CloseIcon,
628
- IconButton as IconButton2,
629
- Spinner,
630
- Text as Text5
631
- } from "@0xsequence/design-system";
632
-
633
- // src/react/ui/modals/_internal/components/alertMessage/index.tsx
634
- import { Box as Box6, Text as Text4, WarningIcon } from "@0xsequence/design-system";
635
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
636
- function AlertMessage({ message, type }) {
637
- return /* @__PURE__ */ jsxs6(Box6, { className: `${alertMessageBox} ${alertMessageBoxVariants[type]}`, children: [
638
- /* @__PURE__ */ jsx9(Text4, { color: "white", fontSize: "normal", fontWeight: "medium", children: message }),
639
- type === "warning" && /* @__PURE__ */ jsx9(WarningIcon, { size: "sm", color: "white" }),
640
- type === "info" && /* @__PURE__ */ jsx9(InfoIcon_default, { size: "sm", color: "white" })
641
- ] });
642
- }
643
-
644
- // src/react/ui/modals/_internal/components/switchChainModal/index.tsx
645
- import { observer as observer5 } from "@legendapp/state/react";
646
- import { useSwitchChain } from "wagmi";
647
- import { BaseError } from "viem";
648
-
649
- // src/utils/network.ts
650
- import { networks } from "@0xsequence/network";
651
- var getPresentableChainName = (chainId) => {
652
- return networks[chainId]?.name;
653
- };
654
-
655
- // src/react/ui/modals/_internal/components/switchChainModal/index.tsx
656
- import { UserRejectedRequestError } from "viem";
657
- import { SwitchChainNotSupportedError } from "wagmi";
658
- import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
659
- var useSwitchChainModal = () => {
660
- return {
661
- show: (args) => switchChainModal$.open(args),
662
- close: () => switchChainModal$.close(),
663
- isSwitching$: switchChainModal$.state.isSwitching
664
- };
665
- };
666
- var SwitchChainModal = observer5(() => {
667
- const chainIdToSwitchTo = switchChainModal$.state.chainIdToSwitchTo.get();
668
- const isSwitching$ = switchChainModal$.state.isSwitching;
669
- const chainName = getPresentableChainName(chainIdToSwitchTo);
670
- const { switchChainAsync } = useSwitchChain();
671
- const {
672
- onSwitchingNotSupported,
673
- onUserRejectedRequest,
674
- onUnknownError,
675
- onSuccess
676
- } = switchChainModal$.state.callbacks.get() || {};
677
- async function handleSwitchChain() {
678
- isSwitching$.set(true);
679
- try {
680
- await switchChainAsync({ chainId: chainIdToSwitchTo });
681
- switchChainModal$.state.onSwitchChain();
682
- onSuccess && onSuccess();
683
- switchChainModal$.close();
684
- } catch (error) {
685
- if (error instanceof BaseError) {
686
- const name = error.name;
687
- switch (name) {
688
- case SwitchChainNotSupportedError.name:
689
- onSwitchingNotSupported && onSwitchingNotSupported();
690
- break;
691
- case UserRejectedRequestError.name:
692
- onUserRejectedRequest && onUserRejectedRequest();
693
- break;
694
- default:
695
- onUnknownError && onUnknownError(error);
696
- break;
697
- }
698
- } else {
699
- onUnknownError && onUnknownError(error);
700
- }
701
- } finally {
702
- isSwitching$.set(false);
703
- }
704
- }
705
- return /* @__PURE__ */ jsx10(Root2, { open: switchChainModal$.isOpen.get(), children: /* @__PURE__ */ jsxs7(Portal2, { children: [
706
- /* @__PURE__ */ jsx10(Overlay, { className: dialogOverlay }),
707
- /* @__PURE__ */ jsxs7(Content2, { className: switchChainModalContent, children: [
708
- /* @__PURE__ */ jsx10(Text5, { fontSize: "large", fontWeight: "bold", color: "text100", children: "Wrong network" }),
709
- /* @__PURE__ */ jsx10(
710
- AlertMessage,
711
- {
712
- type: "warning",
713
- message: `You need to switch to ${chainName} network before completing the transaction`
714
- }
715
- ),
716
- /* @__PURE__ */ jsx10(
717
- Button3,
718
- {
719
- name: "switch-chain",
720
- size: "sm",
721
- label: isSwitching$.get() ? /* @__PURE__ */ jsx10(Spinner, {}) : "Switch Network",
722
- variant: "primary",
723
- pending: isSwitching$.get(),
724
- shape: "square",
725
- className: isSwitching$.get() ? switchChainCta.pending : switchChainCta.default,
726
- justifySelf: "flex-end",
727
- onClick: handleSwitchChain
728
- }
729
- ),
730
- /* @__PURE__ */ jsx10(
731
- Close,
732
- {
733
- onClick: () => {
734
- switchChainModal$.delete();
735
- },
736
- className: closeButton,
737
- asChild: true,
738
- children: /* @__PURE__ */ jsx10(IconButton2, { size: "xs", "aria-label": "Close modal", icon: CloseIcon })
739
- }
740
- )
741
- ] })
742
- ] }) });
743
- });
744
- var switchChainModal_default = SwitchChainModal;
745
-
746
- // src/react/ui/modals/_internal/components/tokenPreview/index.tsx
747
- import { Box as Box7, Image, Skeleton as Skeleton2, Text as Text6 } from "@0xsequence/design-system";
748
- import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
749
- function TokenPreview({
750
- collectionName,
751
- collectionAddress,
752
- collectibleId,
753
- chainId
754
- }) {
755
- const { data: collectable, isLoading: collectibleLoading } = useCollectible({
756
- chainId,
757
- collectionAddress,
758
- collectibleId
759
- });
760
- if (collectibleLoading) {
761
- return /* @__PURE__ */ jsxs8(Box7, { display: "flex", alignItems: "center", gap: "3", width: "full", children: [
762
- /* @__PURE__ */ jsx11(Skeleton2, { width: "9", height: "9", borderRadius: "xs" }),
763
- /* @__PURE__ */ jsxs8(Box7, { display: "flex", flexGrow: "1", gap: "1", flexDirection: "column", children: [
764
- /* @__PURE__ */ jsx11(Skeleton2, { width: "1/3", height: "3" }),
765
- /* @__PURE__ */ jsx11(Skeleton2, { width: "1/2", height: "3" })
766
- ] })
767
- ] });
768
- }
769
- return /* @__PURE__ */ jsxs8(Box7, { className: tokenPreview, children: [
770
- /* @__PURE__ */ jsx11(
771
- Image,
772
- {
773
- src: collectable?.image,
774
- alt: collectable?.name,
775
- width: "9",
776
- height: "9",
777
- borderRadius: "xs"
778
- }
779
- ),
780
- /* @__PURE__ */ jsxs8(Box7, { display: "flex", flexDirection: "column", marginLeft: "3", children: [
781
- /* @__PURE__ */ jsx11(Text6, { fontSize: "small", color: "text80", fontWeight: "medium", children: collectionName }),
782
- /* @__PURE__ */ jsx11(Text6, { fontSize: "small", fontWeight: "bold", color: "text100", children: collectable?.name })
783
- ] })
784
- ] });
785
- }
786
-
787
- // src/react/ui/modals/_internal/components/transactionDetails/index.tsx
788
- import { Box as Box8, NetworkImage, Skeleton as Skeleton3, Text as Text7 } from "@0xsequence/design-system";
789
- import { formatUnits as formatUnits2 } from "viem";
790
- import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
791
- var DEFAULT_MARKETPLACE_FEE_PERCENTAGE = 2.5;
792
- function TransactionDetails({
793
- collectibleId,
794
- collectionAddress,
795
- chainId,
796
- price
797
- }) {
798
- const { data, isLoading: marketplaceConfigLoading } = useMarketplaceConfig();
799
- const marketplaceFeePercentage = data?.collections.find(
800
- (collection) => collection.collectionAddress === collectionAddress
801
- )?.marketplaceFeePercentage || DEFAULT_MARKETPLACE_FEE_PERCENTAGE;
802
- const { data: royaltyPercentage, isLoading: royaltyPercentageLoading } = useRoyaltyPercentage({
803
- chainId,
804
- collectionAddress,
805
- collectibleId
806
- });
807
- const priceLoading = !price || marketplaceConfigLoading || royaltyPercentageLoading;
808
- let formattedAmount = price && formatUnits2(BigInt(price.amountRaw), price.currency.decimals);
809
- if (royaltyPercentage !== void 0 && formattedAmount) {
810
- formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * Number(royaltyPercentage) / 100).toString();
811
- }
812
- if (marketplaceFeePercentage !== void 0 && formattedAmount) {
813
- formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * marketplaceFeePercentage / 100).toString();
814
- }
815
- return /* @__PURE__ */ jsxs9(
816
- Box8,
817
- {
818
- width: "full",
819
- display: "flex",
820
- justifyContent: "space-between",
821
- alignItems: "center",
822
- children: [
823
- /* @__PURE__ */ jsx12(Text7, { fontSize: "small", color: "text50", children: "Total earnings" }),
824
- /* @__PURE__ */ jsxs9(Box8, { display: "flex", alignItems: "center", gap: "2", children: [
825
- /* @__PURE__ */ jsx12(NetworkImage, { chainId: Number(chainId), size: "xs" }),
826
- priceLoading ? /* @__PURE__ */ jsx12(Skeleton3, { width: "16", height: "4" }) : /* @__PURE__ */ jsxs9(Text7, { fontSize: "small", color: "text100", children: [
827
- formattedAmount,
828
- " ",
829
- price.currency.symbol
830
- ] })
831
- ] })
832
- ]
833
- }
834
- );
835
- }
836
-
837
- // src/react/ui/modals/CreateListingModal/_store.ts
838
- import { observable as observable4, when } from "@legendapp/state";
839
- import { useMount, useSelector } from "@legendapp/state/react";
840
- import { addDays as addDays2 } from "date-fns/addDays";
841
- import { useAccount as useAccount3, useSendTransaction } from "wagmi";
842
-
843
- // src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
844
- import {
845
- CloseIcon as CloseIcon2,
846
- IconButton as IconButton3,
847
- Skeleton as Skeleton4,
848
- Text as Text11
849
- } from "@0xsequence/design-system";
850
- import { observer as observer7 } from "@legendapp/state/react";
851
- import { Close as Close2, Content as Content3, Overlay as Overlay2, Portal as Portal3, Root as Root3 } from "@radix-ui/react-dialog";
852
- import { useEffect as useEffect3 } from "react";
853
- import { useTransactionReceipt } from "wagmi";
854
-
855
- // src/react/ui/modals/_internal/components/transaction-footer/index.tsx
856
- import { Box as Box9, Spinner as Spinner2, Text as Text8 } from "@0xsequence/design-system";
857
- import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
858
- function TransactionFooter({
859
- transactionHash,
860
- isConfirming,
861
- isConfirmed,
862
- isFailed
863
- }) {
864
- const icon = isConfirming && /* @__PURE__ */ jsx13(Spinner2, { size: "md" }) || isConfirmed && /* @__PURE__ */ jsx13(PositiveCircleIcon_default, { size: "md" });
865
- const title = isConfirming && "Processing transaction" || isConfirmed && "Transaction complete" || isFailed && "Transaction failed";
866
- return /* @__PURE__ */ jsxs10(Box9, { display: "flex", alignItems: "center", children: [
867
- icon,
868
- /* @__PURE__ */ jsx13(Text8, { color: "text50", fontSize: "normal", fontWeight: "medium", marginLeft: "2", children: title }),
869
- /* @__PURE__ */ jsx13(
870
- Text8,
871
- {
872
- color: "polygonLight",
873
- flexGrow: "1",
874
- textAlign: "right",
875
- fontSize: "normal",
876
- fontWeight: "medium",
877
- marginLeft: "2",
878
- children: truncateMiddle(transactionHash, 4, 4)
879
- }
880
- )
881
- ] });
882
- }
883
-
884
- // src/react/ui/modals/_internal/components/transactionPreview/index.tsx
885
- import { Box as Box11, Image as Image2, NetworkImage as NetworkImage2, Text as Text10 } from "@0xsequence/design-system";
886
- import { observer as observer6 } from "@legendapp/state/react";
887
- import { formatUnits as formatUnits3 } from "viem";
888
-
889
- // src/react/ui/modals/_internal/components/timeAgo/index.tsx
890
- import { Box as Box10, Text as Text9 } from "@0xsequence/design-system";
891
- import { formatDistanceToNow } from "date-fns";
892
- import { useState as useState4, useEffect as useEffect2 } from "react";
893
- import { jsx as jsx14 } from "react/jsx-runtime";
894
- function TimeAgo({ date }) {
895
- const [timeAgo, setTimeAgo] = useState4("");
896
- useEffect2(() => {
897
- const interval = setInterval(() => {
898
- setTimeAgo(formatDistanceToNow(date));
899
- }, 1e3);
900
- return () => clearInterval(interval);
901
- }, [date]);
902
- return /* @__PURE__ */ jsx14(
903
- Box10,
904
- {
905
- flexGrow: "1",
906
- display: "flex",
907
- alignItems: "center",
908
- justifyContent: "flex-end",
909
- children: /* @__PURE__ */ jsx14(Text9, { color: "text50", fontSize: "small", children: timeAgo })
910
- }
911
- );
912
- }
913
-
914
- // src/react/ui/modals/_internal/components/transactionStatusModal/store.ts
915
- import { observable as observable3 } from "@legendapp/state";
916
- var initialState2 = {
917
- isOpen: false,
918
- open: ({
919
- hash,
920
- price,
921
- collectionAddress,
922
- chainId,
923
- tokenId,
924
- getTitle,
925
- getMessage: getMessage2,
926
- type,
927
- callbacks,
928
- queriesToInvalidate
929
- }) => {
930
- transactionStatusModal$.state.set({
931
- ...transactionStatusModal$.state.get(),
932
- hash,
933
- price,
934
- collectionAddress,
935
- chainId,
936
- tokenId,
937
- getTitle,
938
- getMessage: getMessage2,
939
- type,
940
- callbacks,
941
- queriesToInvalidate
942
- });
943
- transactionStatusModal$.isOpen.set(true);
944
- },
945
- close: () => {
946
- transactionStatusModal$.isOpen.set(false);
947
- transactionStatusModal$.state.set({
948
- ...initialState2.state
949
- });
950
- },
951
- state: {
952
- hash: void 0,
953
- status: "PENDING",
954
- price: void 0,
955
- collectionAddress: "",
956
- chainId: "",
957
- tokenId: "",
958
- getTitle: void 0,
959
- getMessage: void 0,
960
- type: void 0
961
- }
962
- };
963
- var transactionStatusModal$ = observable3(initialState2);
964
-
965
- // src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx
966
- import { useMemo } from "react";
967
-
968
- // src/react/ui/modals/_internal/components/transactionPreview/consts.ts
969
- var TRANSACTION_TITLES = {
970
- sell: {
971
- confirming: "Selling",
972
- confirmed: "Sold",
973
- failed: "Sale failed"
974
- },
975
- createListing: {
976
- confirming: "Creating listing",
977
- confirmed: "Listed",
978
- failed: "Listing failed"
979
- },
980
- createOffer: {
981
- confirming: "Creating offer",
982
- confirmed: "Offer created",
983
- failed: "Offer failed"
984
- },
985
- buy: {
986
- confirming: "Buying",
987
- confirmed: "Bought",
988
- failed: "Purchase failed"
989
- },
990
- transfer: {
991
- confirming: "Transferring",
992
- confirmed: "Transferred",
993
- failed: "Transfer failed"
994
- }
995
- };
996
-
997
- // src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx
998
- function useTransactionPreviewTitle(status, type) {
999
- return useMemo(() => {
1000
- if (!type) return "";
1001
- const { isConfirming, isConfirmed, isFailed } = status;
1002
- const titles = TRANSACTION_TITLES[type];
1003
- if (isConfirming) return titles.confirming;
1004
- if (isConfirmed) return titles.confirmed;
1005
- if (isFailed) return titles.failed;
1006
- return "";
1007
- }, [status, type]);
1008
- }
1009
-
1010
- // src/react/ui/modals/_internal/components/transactionPreview/index.tsx
1011
- import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
1012
- var TransactionPreview = observer6(
1013
- ({
1014
- price,
1015
- collectionAddress,
1016
- chainId,
1017
- collectible,
1018
- isConfirming,
1019
- isConfirmed,
1020
- isFailed
1021
- }) => {
1022
- const { type } = transactionStatusModal$.state.get();
1023
- const title = useTransactionPreviewTitle(
1024
- { isConfirmed, isConfirming, isFailed },
1025
- type
1026
- );
1027
- const { data: collection } = useCollection({
1028
- collectionAddress,
1029
- chainId
1030
- });
1031
- const collectibleImage2 = collectible.image;
1032
- const collectibleName = collectible.name;
1033
- const collectionName = collection?.name;
1034
- const priceFormatted = price ? formatUnits3(BigInt(price.amountRaw), price.currency.decimals) : void 0;
1035
- return /* @__PURE__ */ jsxs11(Box11, { padding: "3", background: "backgroundSecondary", borderRadius: "md", children: [
1036
- /* @__PURE__ */ jsxs11(Box11, { display: "flex", alignItems: "center", children: [
1037
- /* @__PURE__ */ jsx15(
1038
- Text10,
1039
- {
1040
- color: "text50",
1041
- fontSize: "small",
1042
- fontWeight: "medium",
1043
- marginRight: "1",
1044
- children: title
1045
- }
1046
- ),
1047
- /* @__PURE__ */ jsx15(NetworkImage2, { chainId: Number(chainId), size: "xs" }),
1048
- isConfirming && /* @__PURE__ */ jsx15(TimeAgo, { date: /* @__PURE__ */ new Date() })
1049
- ] }),
1050
- /* @__PURE__ */ jsxs11(Box11, { display: "flex", alignItems: "center", marginTop: "2", children: [
1051
- /* @__PURE__ */ jsx15(
1052
- Image2,
1053
- {
1054
- src: collectibleImage2,
1055
- alt: collectibleName,
1056
- width: "9",
1057
- height: "9",
1058
- borderRadius: "xs",
1059
- marginRight: "3"
1060
- }
1061
- ),
1062
- /* @__PURE__ */ jsxs11(
1063
- Box11,
1064
- {
1065
- display: "flex",
1066
- flexDirection: "column",
1067
- alignItems: "flex-start",
1068
- gap: "0.5",
1069
- children: [
1070
- /* @__PURE__ */ jsx15(Text10, { color: "text80", fontSize: "small", fontWeight: "medium", children: collectibleName }),
1071
- /* @__PURE__ */ jsx15(Text10, { color: "text100", fontSize: "small", children: collectionName })
1072
- ]
1073
- }
1074
- ),
1075
- price && /* @__PURE__ */ jsxs11(
1076
- Box11,
1077
- {
1078
- flexGrow: "1",
1079
- display: "flex",
1080
- alignItems: "center",
1081
- justifyContent: "flex-end",
1082
- gap: "1",
1083
- children: [
1084
- /* @__PURE__ */ jsx15(NetworkImage2, { chainId: Number(chainId), size: "xs" }),
1085
- /* @__PURE__ */ jsxs11(Text10, { color: "text80", fontSize: "small", fontWeight: "medium", children: [
1086
- priceFormatted,
1087
- " ",
1088
- price.currency.symbol
1089
- ] })
1090
- ]
1091
- }
1092
- )
1093
- ] })
1094
- ] });
1095
- }
1096
- );
1097
- var transactionPreview_default = TransactionPreview;
1098
-
1099
- // src/react/ui/modals/_internal/components/transactionStatusModal/styles.css.ts
1100
- var closeButton4 = "fyvr11lw fyvr1tc fyvr1mo";
1101
- var dialogOverlay4 = "fyvr1m0 fyvr1o8 fyvr1qg fyvr1so fyvr11xl fyvr11m0 fyvr11rs";
1102
- var transactionStatusModalContent = "modal_dialogContent_wide__1ypl6nt3 modal_dialogContentBase__1ypl6nt1 fyvr11hg fyvr11i4 fyvr11g4 fyvr11gs fyvr11l8 fyvr11wl fyvr11m0 fyvr11rs fyvr1vo fyvr1xs fyvr1zw fyvr1120 fyvr11lc fyvr11mc fyvr11cw";
1103
-
1104
- // src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
1105
- import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
1106
- var useTransactionStatusModal = () => {
1107
- return {
1108
- show: (args) => transactionStatusModal$.open(args),
1109
- close: () => transactionStatusModal$.close()
1110
- };
1111
- };
1112
- var TransactionStatusModal = observer7(() => {
1113
- const {
1114
- hash,
1115
- price,
1116
- collectionAddress,
1117
- chainId,
1118
- tokenId,
1119
- getTitle,
1120
- getMessage: getMessage2,
1121
- callbacks,
1122
- queriesToInvalidate
1123
- } = transactionStatusModal$.state.get();
1124
- const { data: collectible } = useCollectible({
1125
- collectionAddress,
1126
- chainId,
1127
- collectibleId: tokenId
1128
- });
1129
- const {
1130
- isLoading: isConfirming,
1131
- isSuccess: isConfirmed,
1132
- isError: isFailed,
1133
- error
1134
- } = useTransactionReceipt({ hash });
1135
- const title = getTitle && getTitle({ isConfirmed, isConfirming, isFailed });
1136
- const message = getMessage2 && getMessage2({ isConfirmed, isConfirming, isFailed });
1137
- const { onUnknownError, onSuccess } = callbacks || {};
1138
- const queryClient = getQueryClient();
1139
- useEffect3(() => {
1140
- if (!transactionStatusModal$.isOpen.get()) return;
1141
- let isSubscribed = true;
1142
- if (isConfirmed && isSubscribed && onSuccess) {
1143
- onSuccess();
1144
- }
1145
- if (isFailed && isSubscribed && onUnknownError) {
1146
- onUnknownError(error);
1147
- }
1148
- if (isSubscribed && queriesToInvalidate) {
1149
- queryClient.invalidateQueries({ queryKey: [...queriesToInvalidate] });
1150
- }
1151
- return () => {
1152
- isSubscribed = false;
1153
- };
1154
- }, [isConfirmed, isFailed, onSuccess, onUnknownError, error]);
1155
- return /* @__PURE__ */ jsx16(Root3, { open: transactionStatusModal$.isOpen.get(), children: /* @__PURE__ */ jsxs12(Portal3, { children: [
1156
- /* @__PURE__ */ jsx16(Overlay2, { className: dialogOverlay4 }),
1157
- /* @__PURE__ */ jsxs12(Content3, { className: transactionStatusModalContent, children: [
1158
- title ? /* @__PURE__ */ jsx16(Text11, { fontSize: "large", fontWeight: "bold", color: "text100", children: title }) : /* @__PURE__ */ jsx16(Skeleton4, { width: "16", height: "6" }),
1159
- message ? /* @__PURE__ */ jsx16(Text11, { fontSize: "small", color: "text80", children: message }) : /* @__PURE__ */ jsx16(Skeleton4, { width: "20", height: "4" }),
1160
- /* @__PURE__ */ jsx16(
1161
- transactionPreview_default,
1162
- {
1163
- price,
1164
- collectionAddress,
1165
- chainId,
1166
- collectible,
1167
- isConfirming,
1168
- isConfirmed,
1169
- isFailed
1170
- }
1171
- ),
1172
- /* @__PURE__ */ jsx16(
1173
- TransactionFooter,
1174
- {
1175
- transactionHash: hash,
1176
- isConfirming,
1177
- isConfirmed,
1178
- isFailed
1179
- }
1180
- ),
1181
- /* @__PURE__ */ jsx16(
1182
- Close2,
1183
- {
1184
- onClick: () => {
1185
- transactionStatusModal$.close();
1186
- },
1187
- className: closeButton4,
1188
- asChild: true,
1189
- children: /* @__PURE__ */ jsx16(IconButton3, { size: "xs", "aria-label": "Close modal", icon: CloseIcon2 })
1190
- }
1191
- )
1192
- ] })
1193
- ] }) });
1194
- });
1195
- var transactionStatusModal_default = TransactionStatusModal;
1196
-
1197
- // src/react/ui/modals/CreateListingModal/_utils/getCreateListingTransactionTitleMessage.ts
1198
- var getCreateListingTransactionTitle = (params) => {
1199
- if (params.isConfirmed) {
1200
- return "Listing has processed";
1201
- }
1202
- if (params.isFailed) {
1203
- return "Listing has failed";
1204
- }
1205
- return "Listing is processing";
1206
- };
1207
- var getCreateListingTransactionMessage = (params, collectibleName) => {
1208
- if (params.isConfirmed) {
1209
- return `You just listed ${collectibleName}. It\u2019s been confirmed on the blockchain!`;
1210
- }
1211
- if (params.isFailed) {
1212
- return `Your listing of ${collectibleName} has failed. Please try again.`;
1213
- }
1214
- return `You just listed ${collectibleName}. It should be confirmed on the blockchain shortly.`;
1215
- };
1216
-
1217
- // src/react/ui/modals/CreateListingModal/_store.ts
1218
- var initialState3 = {
1219
- isOpen: false,
1220
- open: ({
1221
- collectionAddress,
1222
- chainId,
1223
- collectibleId
1224
- }) => {
1225
- createListingModal$.state.set({
1226
- ...createListingModal$.state.get(),
1227
- collectionAddress,
1228
- chainId,
1229
- collectibleId
1230
- });
1231
- createListingModal$.isOpen.set(true);
1232
- },
1233
- close: () => {
1234
- createListingModal$.isOpen.set(false);
1235
- },
1236
- state: {
1237
- collectionName: "",
1238
- listingPrice: {
1239
- amountRaw: "0",
1240
- currency: {}
1241
- },
1242
- quantity: "1",
1243
- expiry: new Date(addDays2(/* @__PURE__ */ new Date(), 7).toJSON()),
1244
- collectionType: void 0,
1245
- collectionAddress: "",
1246
- chainId: "",
1247
- collectibleId: ""
1248
- },
1249
- steps: {
1250
- isLoading: () => !!createListingModal$.steps.stepsData.get(),
1251
- stepsData: void 0,
1252
- _currentStep: null,
1253
- tokenApproval: {},
1254
- createListing: {}
1255
- },
1256
- hash: void 0
1257
- };
1258
- var createListingModal$ = observable4(initialState3);
1259
- var exp = new Date(addDays2(/* @__PURE__ */ new Date(), 7).toJSON());
1260
- var useHydrate = () => {
1261
- const chainId = useSelector(createListingModal$.state.chainId);
1262
- const collectionAddress = useSelector(
1263
- createListingModal$.state.collectionAddress
1264
- );
1265
- const collectionType = useSelector(createListingModal$.state.collectionType);
1266
- const { data: collection, isSuccess: isSuccessCollection } = useCollection({
1267
- chainId,
1268
- collectionAddress
1269
- });
1270
- when(isSuccessCollection, () => {
1271
- createListingModal$.state.collectionName.set(collection.name);
1272
- createListingModal$.state.collectionType.set(
1273
- collection.type
1274
- );
1275
- });
1276
- useTokenApprovalHandler(chainId);
1277
- useCreateListingHandler(chainId);
1278
- useShowTransactionStatusModal();
1279
- const onListingSuccess = (data) => {
1280
- createListingModal$.steps.stepsData.set(data);
1281
- };
1282
- const { generateListingTransactionAsync } = useGenerateListingTransaction({
1283
- chainId,
1284
- onSuccess: onListingSuccess
1285
- });
1286
- const { connector, address: userAddress } = useAccount3();
1287
- useMount(() => {
1288
- const setSteps = async () => {
1289
- const createListingTransactionSteps = await generateListingTransactionAsync({
1290
- collectionAddress,
1291
- orderbook: "sequence_marketplace_v1" /* sequence_marketplace_v1 */,
1292
- listing: {
1293
- tokenId: "1",
1294
- quantity: "1",
1295
- expiry: exp,
1296
- currencyAddress: createListingModal$.state.listingPrice.currency.contractAddress.get(),
1297
- pricePerToken: createListingModal$.state.listingPrice.amountRaw.get() || "1"
1298
- },
1299
- contractType: collectionType,
1300
- walletType: connector?.id,
1301
- owner: userAddress
1302
- });
1303
- createListingModal$.steps.stepsData.set(createListingTransactionSteps);
1304
- };
1305
- when(isSuccessCollection && collectionType, setSteps);
1306
- });
1307
- };
1308
- var useTokenApprovalHandler = (chainId) => {
1309
- const { sendTransactionAsync, isPending, isSuccess } = useSendTransaction();
1310
- const onError = createListingModal$.state.get().errorCallbacks?.onApproveTokenError;
1311
- const onSuccess = createListingModal$.state.get().successCallbacks?.onApproveTokenSuccess;
1312
- createListingModal$.steps.tokenApproval.set({
1313
- isNeeded: () => !!createListingModal$.steps.tokenApproval.getStep(),
1314
- getStep: () => createListingModal$.steps.stepsData?.get()?.find((s) => s.id === "tokenApproval" /* tokenApproval */),
1315
- pending: createListingModal$.steps._currentStep.get() === "tokenApproval" && isPending,
1316
- execute: async () => {
1317
- const step = createListingModal$.steps.tokenApproval.getStep();
1318
- if (!step) return;
1319
- createListingModal$.steps._currentStep.set("tokenApproval");
1320
- try {
1321
- await sendTransactionAsync({
1322
- to: step.to,
1323
- chainId: Number(chainId),
1324
- data: step.data,
1325
- value: BigInt(step.value || "0")
1326
- });
1327
- onSuccess && onSuccess();
1328
- } catch (error) {
1329
- onError && onError(error);
1330
- }
1331
- }
1332
- });
1333
- if (isSuccess && createListingModal$.steps._currentStep.get() === "tokenApproval") {
1334
- createListingModal$.steps._currentStep.set(null);
1335
- }
1336
- };
1337
- var useCreateListingHandler = (chainId) => {
1338
- const { collectibleId, collectionAddress, errorCallbacks, successCallbacks } = createListingModal$.state.get();
1339
- const { connector, address } = useAccount3();
1340
- const {
1341
- generateListingTransactionAsync,
1342
- isPending: generateListingTransactionPending
1343
- } = useGenerateListingTransaction({ chainId });
1344
- const { data: collectible } = useCollectible({
1345
- chainId,
1346
- collectionAddress,
1347
- collectibleId
1348
- });
1349
- const { sendTransactionAsync, isPending: sendTransactionPending } = useSendTransaction();
1350
- const { show: showTransactionStatusModal } = useTransactionStatusModal();
1351
- createListingModal$.steps.createListing.set({
1352
- pending: createListingModal$.steps._currentStep.get() === "createListing" && (generateListingTransactionPending || sendTransactionPending),
1353
- execute: () => {
1354
- createListingModal$.steps._currentStep.set("createListing");
1355
- generateListingTransactionAsync({
1356
- collectionAddress: createListingModal$.state.collectionAddress.get(),
1357
- contractType: createListingModal$.state.collectionType.get(),
1358
- orderbook: "sequence_marketplace_v1" /* sequence_marketplace_v1 */,
1359
- walletType: connector?.id,
1360
- listing: {
1361
- tokenId: createListingModal$.state.collectibleId.get(),
1362
- quantity: createListingModal$.state.quantity.get(),
1363
- expiry: createListingModal$.state.expiry.get(),
1364
- currencyAddress: createListingModal$.state.listingPrice.currency.contractAddress.get(),
1365
- pricePerToken: createListingModal$.state.listingPrice.amountRaw.get() || "1"
1366
- },
1367
- owner: address
1368
- }).then(async (steps) => {
1369
- const step = steps.find((s) => s.id === "createListing" /* createListing */);
1370
- if (!step) throw new Error("No steps found");
1371
- const hash = await sendTransactionAsync({
1372
- to: step.to,
1373
- chainId: Number(chainId),
1374
- data: step.data,
1375
- value: BigInt(step.value || "0")
1376
- });
1377
- createListingModal$.hash.set(hash);
1378
- createListingModal$.steps._currentStep.set(null);
1379
- createListingModal$.close();
1380
- showTransactionStatusModal({
1381
- hash,
1382
- price: createListingModal$.state.listingPrice.get(),
1383
- collectionAddress,
1384
- chainId,
1385
- tokenId: collectibleId,
1386
- getTitle: getCreateListingTransactionTitle,
1387
- getMessage: (params) => getCreateListingTransactionMessage(
1388
- params,
1389
- collectible?.name || ""
1390
- ),
1391
- type: "transfer",
1392
- callbacks: {
1393
- onSuccess: successCallbacks?.onCreateListingSuccess,
1394
- onUnknownError: errorCallbacks?.onCreateListingError
1395
- },
1396
- queriesToInvalidate: collectableKeys.all
1397
- });
1398
- }).catch((error) => {
1399
- errorCallbacks?.onCreateListingError?.(error);
1400
- });
1401
- }
1402
- });
1403
- };
1404
- var useShowTransactionStatusModal = () => {
1405
- const { hash } = createListingModal$.get();
1406
- const { collectibleId, chainId, collectionAddress } = createListingModal$.state.get();
1407
- const { data: collectible } = useCollectible({
1408
- collectionAddress,
1409
- chainId,
1410
- collectibleId
1411
- });
1412
- const { show: showTransactionStatusModal } = useTransactionStatusModal();
1413
- when(!!hash, () => {
1414
- showTransactionStatusModal({
1415
- hash,
1416
- collectionAddress,
1417
- chainId,
1418
- price: createListingModal$.state.listingPrice.get(),
1419
- tokenId: collectibleId,
1420
- getTitle: getCreateListingTransactionTitle,
1421
- getMessage: (params) => getCreateListingTransactionMessage(params, collectible?.name || ""),
1422
- type: "createListing" /* createListing */
1423
- });
1424
- });
1425
- };
1426
-
1427
- // src/react/ui/modals/CreateListingModal/index.tsx
1428
- import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
1429
- var useCreateListingModal = () => {
1430
- const { chainId: accountChainId } = useAccount4();
1431
- const { show: showSwitchNetworkModal } = useSwitchChainModal();
1432
- const { errorCallbacks, successCallbacks } = createListingModal$.state.get();
1433
- const openModal = (args) => {
1434
- createListingModal$.open(args);
1435
- };
1436
- const handleShowModal = (args) => {
1437
- const isSameChain = accountChainId === Number(args.chainId);
1438
- if (!isSameChain) {
1439
- showSwitchNetworkModal({
1440
- chainIdToSwitchTo: Number(args.chainId),
1441
- onSwitchChain: () => openModal(args),
1442
- callbacks: {
1443
- onSuccess: successCallbacks?.onSwitchChainSuccess,
1444
- onUnknownError: errorCallbacks?.onSwitchChainError,
1445
- onSwitchingNotSupported: errorCallbacks?.onSwitchingNotSupportedError,
1446
- onUserRejectedRequest: errorCallbacks?.onUserRejectedSwitchingChainRequestError
1447
- }
1448
- });
1449
- return;
1450
- }
1451
- openModal(args);
1452
- };
1453
- return {
1454
- show: handleShowModal,
1455
- close: () => createListingModal$.close(),
1456
- onError: (callbacks) => {
1457
- createListingModal$.state.set({
1458
- ...createListingModal$.state.get(),
1459
- errorCallbacks: callbacks
1460
- });
1461
- },
1462
- onSuccess: (callbacks) => {
1463
- createListingModal$.state.set({
1464
- ...createListingModal$.state.get(),
1465
- successCallbacks: callbacks
1466
- });
1467
- }
1468
- };
1469
- };
1470
- var CreateListingModal = () => {
1471
- return /* @__PURE__ */ jsx17(Show, { if: createListingModal$.isOpen, children: /* @__PURE__ */ jsx17(Modal2, {}) });
1472
- };
1473
- var Modal2 = () => {
1474
- useHydrate();
1475
- return /* @__PURE__ */ jsx17(ModalContent, {});
1476
- };
1477
- var ModalContent = observer8(() => {
1478
- const {
1479
- chainId,
1480
- collectionAddress,
1481
- collectibleId,
1482
- collectionName,
1483
- collectionType,
1484
- listingPrice
1485
- } = createListingModal$.state.get();
1486
- const { steps } = createListingModal$.get();
1487
- const ctas = [
1488
- {
1489
- label: "Approve TOKEN",
1490
- onClick: steps.tokenApproval.execute,
1491
- hidden: !steps.tokenApproval.isNeeded(),
1492
- pending: steps.tokenApproval.pending,
1493
- variant: "glass"
1494
- },
1495
- {
1496
- label: "List item for sale",
1497
- onClick: steps.createListing.execute,
1498
- pending: steps.createListing.pending,
1499
- disabled: steps.tokenApproval.isNeeded() || listingPrice.amountRaw === "0"
1500
- }
1501
- ];
1502
- return /* @__PURE__ */ jsxs13(
1503
- ActionModal,
1504
- {
1505
- store: createListingModal$,
1506
- onClose: () => createListingModal$.close(),
1507
- title: "List item for sale",
1508
- ctas,
1509
- children: [
1510
- /* @__PURE__ */ jsx17(
1511
- TokenPreview,
1512
- {
1513
- collectionName,
1514
- collectionAddress,
1515
- collectibleId,
1516
- chainId
1517
- }
1518
- ),
1519
- /* @__PURE__ */ jsxs13(Box12, { display: "flex", flexDirection: "column", width: "full", gap: "1", children: [
1520
- /* @__PURE__ */ jsx17(
1521
- priceInput_default,
1522
- {
1523
- chainId,
1524
- collectionAddress,
1525
- $listingPrice: createListingModal$.state.listingPrice
1526
- }
1527
- ),
1528
- !!listingPrice && /* @__PURE__ */ jsx17(
1529
- FloorPriceText,
1530
- {
1531
- tokenId: collectibleId,
1532
- chainId,
1533
- collectionAddress,
1534
- price: listingPrice
1535
- }
1536
- )
1537
- ] }),
1538
- collectionType === "ERC1155" /* ERC1155 */ && /* @__PURE__ */ jsx17(
1539
- QuantityInput,
1540
- {
1541
- chainId,
1542
- collectionAddress,
1543
- collectibleId,
1544
- $quantity: createListingModal$.state.quantity
1545
- }
1546
- ),
1547
- /* @__PURE__ */ jsx17(expirationDateSelect_default, { $date: createListingModal$.state.expiry }),
1548
- /* @__PURE__ */ jsx17(
1549
- TransactionDetails,
1550
- {
1551
- collectibleId,
1552
- collectionAddress,
1553
- chainId,
1554
- price: createListingModal$.state.listingPrice.get()
1555
- }
1556
- )
1557
- ]
1558
- }
1559
- );
1560
- });
1561
-
1562
- // src/react/ui/modals/MakeOfferModal/index.tsx
1563
- import { Show as Show2, observer as observer9 } from "@legendapp/state/react";
1564
- import { useState as useState5 } from "react";
1565
- import { useAccount as useAccount6 } from "wagmi";
1566
-
1567
- // src/react/ui/modals/MakeOfferModal/_store.ts
1568
- import { observable as observable5, when as when2 } from "@legendapp/state";
1569
- import { useMount as useMount2, useSelector as useSelector2 } from "@legendapp/state/react";
1570
- import { addDays as addDays3 } from "date-fns/addDays";
1571
- import { useAccount as useAccount5, useSendTransaction as useSendTransaction2 } from "wagmi";
1572
-
1573
- // src/react/ui/modals/MakeOfferModal/_utils/getMakeOfferTransactionTitleMessage.ts
1574
- var getMakeOfferTransactionTitle = (params) => {
1575
- if (params.isConfirmed) {
1576
- return "Your offer has processed";
1577
- }
1578
- if (params.isFailed) {
1579
- return "Your offer has failed";
1580
- }
1581
- return "Your offer is processing";
1582
- };
1583
- var getMakeOfferTransactionMessage = (params, collectibleName) => {
1584
- if (params.isConfirmed) {
1585
- return `You just made offer for ${collectibleName}. It\u2019s been confirmed on the blockchain!`;
1586
- }
1587
- if (params.isFailed) {
1588
- return `Your offer for ${collectibleName} has failed. Please try again.`;
1589
- }
1590
- return `You just made offer for ${collectibleName}. It should be confirmed on the blockchain shortly.`;
1591
- };
1592
-
1593
- // src/react/ui/modals/MakeOfferModal/_store.ts
1594
- var initialState4 = {
1595
- isOpen: false,
1596
- open: ({
1597
- collectionAddress,
1598
- chainId,
1599
- collectibleId
1600
- }) => {
1601
- makeOfferModal$.state.set({
1602
- ...makeOfferModal$.state.get(),
1603
- collectionAddress,
1604
- chainId,
1605
- collectibleId
1606
- });
1607
- makeOfferModal$.isOpen.set(true);
1608
- },
1609
- close: () => {
1610
- makeOfferModal$.isOpen.set(false);
1611
- },
1612
- state: {
1613
- collectionName: "",
1614
- offerPrice: {
1615
- amountRaw: "0",
1616
- currency: {}
1617
- },
1618
- quantity: "1",
1619
- expiry: new Date(addDays3(/* @__PURE__ */ new Date(), 7).toJSON()),
1620
- collectionType: void 0,
1621
- collectionAddress: "",
1622
- chainId: "",
1623
- collectibleId: ""
1624
- },
1625
- steps: {
1626
- isLoading: () => !!makeOfferModal$.steps.stepsData.get(),
1627
- stepsData: void 0,
1628
- _currentStep: null,
1629
- tokenApproval: {},
1630
- createOffer: {}
1631
- },
1632
- hash: void 0
1633
- };
1634
- var makeOfferModal$ = observable5(initialState4);
1635
- var exp2 = new Date(addDays3(/* @__PURE__ */ new Date(), 7).toJSON());
1636
- var useHydrate2 = () => {
1637
- const chainId = useSelector2(makeOfferModal$.state.chainId);
1638
- const collectionAddress = useSelector2(
1639
- makeOfferModal$.state.collectionAddress
1640
- );
1641
- const currencyAddress = useSelector2(
1642
- makeOfferModal$.state.offerPrice.currency.contractAddress
1643
- );
1644
- const collectionType = useSelector2(makeOfferModal$.state.collectionType);
1645
- const { data: collection, isSuccess: isSuccessCollection } = useCollection({
1646
- chainId,
1647
- collectionAddress
1648
- });
1649
- when2(isSuccessCollection, () => {
1650
- makeOfferModal$.state.collectionName.set(collection.name);
1651
- makeOfferModal$.state.collectionType.set(
1652
- collection.type
1653
- );
1654
- });
1655
- useTokenApprovalHandler2(chainId);
1656
- useCreateOfferHandler(chainId);
1657
- const onOfferSuccess = (data) => {
1658
- makeOfferModal$.steps.stepsData.set(data);
1659
- };
1660
- const { generateOfferTransactionAsync } = useGenerateOfferTransaction({
1661
- chainId,
1662
- onSuccess: onOfferSuccess
1663
- });
1664
- const { connector, address: userAddress } = useAccount5();
1665
- useMount2(() => {
1666
- const setSteps = async () => {
1667
- const makeOfferTransactionData = await generateOfferTransactionAsync({
1668
- collectionAddress,
1669
- orderbook: "sequence_marketplace_v1" /* sequence_marketplace_v1 */,
1670
- offer: {
1671
- tokenId: "1",
1672
- quantity: "1",
1673
- expiry: exp2,
1674
- currencyAddress,
1675
- pricePerToken: makeOfferModal$.state.offerPrice.amountRaw.get() || "1"
1676
- },
1677
- maker: userAddress,
1678
- contractType: collectionType,
1679
- walletType: connector?.id
1680
- });
1681
- makeOfferModal$.steps.stepsData.set(makeOfferTransactionData);
1682
- };
1683
- when2(isSuccessCollection && collectionType && currencyAddress, setSteps);
1684
- });
1685
- };
1686
- var useTokenApprovalHandler2 = (chainId) => {
1687
- const { sendTransactionAsync, isPending, isSuccess } = useSendTransaction2();
1688
- const onError = makeOfferModal$.state.get().errorCallbacks?.onApproveTokenError;
1689
- const onSuccess = makeOfferModal$.state.get().successCallbacks?.onApproveTokenSuccess;
1690
- makeOfferModal$.steps.tokenApproval.set({
1691
- isNeeded: () => !!makeOfferModal$.steps.tokenApproval.getStep(),
1692
- getStep: () => makeOfferModal$.steps.stepsData?.get()?.find((s) => s.id === "tokenApproval" /* tokenApproval */),
1693
- pending: makeOfferModal$.steps._currentStep.get() === "tokenApproval" && isPending,
1694
- execute: () => {
1695
- const step = makeOfferModal$.steps.tokenApproval.getStep();
1696
- if (!step) return;
1697
- makeOfferModal$.steps._currentStep.set("tokenApproval");
1698
- try {
1699
- sendTransactionAsync({
1700
- to: step.to,
1701
- chainId: Number(chainId),
1702
- data: step.data,
1703
- value: BigInt(step.value || "0")
1704
- });
1705
- onSuccess && onSuccess();
1706
- } catch (error) {
1707
- onError && onError(error);
1708
- }
1709
- }
1710
- });
1711
- if (isSuccess && makeOfferModal$.steps._currentStep.get() === "tokenApproval") {
1712
- makeOfferModal$.steps._currentStep.set(null);
1713
- }
1714
- };
1715
- var useCreateOfferHandler = (chainId) => {
1716
- const { collectibleId, collectionAddress, errorCallbacks, successCallbacks } = makeOfferModal$.state.get();
1717
- const { connector, address } = useAccount5();
1718
- const {
1719
- generateOfferTransactionAsync,
1720
- isPending: generateOfferTransactionPending
1721
- } = useGenerateOfferTransaction({ chainId });
1722
- const { data: collectible } = useCollectible({
1723
- chainId,
1724
- collectionAddress,
1725
- collectibleId
1726
- });
1727
- const { sendTransactionAsync, isPending: sendTransactionPending } = useSendTransaction2();
1728
- const { show: showTransactionStatusModal } = useTransactionStatusModal();
1729
- makeOfferModal$.steps.createOffer.set({
1730
- pending: makeOfferModal$.steps._currentStep.get() === "createOffer" && (generateOfferTransactionPending || sendTransactionPending),
1731
- execute: () => {
1732
- makeOfferModal$.steps._currentStep.set("createOffer");
1733
- generateOfferTransactionAsync({
1734
- collectionAddress: makeOfferModal$.state.collectionAddress.get(),
1735
- maker: address,
1736
- contractType: makeOfferModal$.state.collectionType.get(),
1737
- orderbook: "sequence_marketplace_v1" /* sequence_marketplace_v1 */,
1738
- walletType: connector?.id,
1739
- offer: {
1740
- tokenId: makeOfferModal$.state.collectibleId.get(),
1741
- quantity: makeOfferModal$.state.quantity.get(),
1742
- expiry: makeOfferModal$.state.expiry.get(),
1743
- currencyAddress: makeOfferModal$.state.offerPrice.currency.contractAddress.get(),
1744
- pricePerToken: makeOfferModal$.state.offerPrice.amountRaw.get()
1745
- }
1746
- }).then(async (steps) => {
1747
- const step = steps.find((s) => s.id === "createOffer" /* createOffer */);
1748
- if (!step) throw new Error("No steps found");
1749
- const hash = await sendTransactionAsync({
1750
- to: step.to,
1751
- chainId: Number(chainId),
1752
- data: step.data,
1753
- value: BigInt(step.value || "0")
1754
- });
1755
- makeOfferModal$.hash.set(hash);
1756
- makeOfferModal$.steps._currentStep.set(null);
1757
- makeOfferModal$.close();
1758
- showTransactionStatusModal({
1759
- hash,
1760
- price: makeOfferModal$.state.offerPrice.get(),
1761
- collectionAddress,
1762
- chainId,
1763
- tokenId: collectibleId,
1764
- getTitle: getMakeOfferTransactionTitle,
1765
- getMessage: (params) => getMakeOfferTransactionMessage(params, collectible?.name || ""),
1766
- type: "createOffer" /* createOffer */,
1767
- callbacks: {
1768
- onSuccess: successCallbacks?.onMakeOfferSuccess,
1769
- onUnknownError: errorCallbacks?.onMakeOfferError
1770
- },
1771
- queriesToInvalidate: collectableKeys.all
1772
- });
1773
- }).catch((error) => {
1774
- errorCallbacks?.onMakeOfferError?.(error);
1775
- });
1776
- }
1777
- });
1778
- };
1779
-
1780
- // src/react/ui/modals/MakeOfferModal/index.tsx
1781
- import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
1782
- var useMakeOfferModal = () => {
1783
- const { chainId: accountChainId } = useAccount6();
1784
- const { show: showSwitchNetworkModal } = useSwitchChainModal();
1785
- const { errorCallbacks, successCallbacks } = makeOfferModal$.state.get();
1786
- const openModal = (args) => {
1787
- makeOfferModal$.open(args);
1788
- };
1789
- const handleShowModal = (args) => {
1790
- const isSameChain = accountChainId === Number(args.chainId);
1791
- if (!isSameChain) {
1792
- showSwitchNetworkModal({
1793
- chainIdToSwitchTo: Number(args.chainId),
1794
- onSwitchChain: () => openModal(args),
1795
- callbacks: {
1796
- onSuccess: successCallbacks?.onSwitchChainSuccess,
1797
- onUnknownError: errorCallbacks?.onSwitchChainError,
1798
- onSwitchingNotSupported: errorCallbacks?.onSwitchingNotSupportedError,
1799
- onUserRejectedRequest: errorCallbacks?.onUserRejectedSwitchingChainRequestError
1800
- }
1801
- });
1802
- return;
1803
- }
1804
- openModal(args);
1805
- };
1806
- return {
1807
- show: handleShowModal,
1808
- close: () => makeOfferModal$.close(),
1809
- onError: (callbacks) => {
1810
- makeOfferModal$.state.set({
1811
- ...makeOfferModal$.state.get(),
1812
- errorCallbacks: callbacks
1813
- });
1814
- },
1815
- onSuccess: (callbacks) => {
1816
- makeOfferModal$.state.set({
1817
- ...makeOfferModal$.state.get(),
1818
- successCallbacks: callbacks
1819
- });
1820
- }
1821
- };
1822
- };
1823
- var MakeOfferModal = () => {
1824
- return /* @__PURE__ */ jsx18(Show2, { if: makeOfferModal$.isOpen, children: /* @__PURE__ */ jsx18(Modal3, {}) });
1825
- };
1826
- var Modal3 = () => {
1827
- useHydrate2();
1828
- return /* @__PURE__ */ jsx18(ModalContent2, {});
1829
- };
1830
- var ModalContent2 = observer9(() => {
1831
- const [insufficientBalance, setInsufficientBalance] = useState5(false);
1832
- const {
1833
- chainId,
1834
- collectionAddress,
1835
- collectibleId,
1836
- collectionName,
1837
- collectionType,
1838
- offerPrice
1839
- } = makeOfferModal$.state.get();
1840
- const { steps } = makeOfferModal$.get();
1841
- const ctas = [
1842
- {
1843
- label: "Approve TOKEN",
1844
- onClick: steps.tokenApproval.execute,
1845
- hidden: !steps.tokenApproval.isNeeded(),
1846
- pending: steps.tokenApproval.pending,
1847
- variant: "glass"
1848
- },
1849
- {
1850
- label: "Make offer",
1851
- onClick: steps.createOffer.execute,
1852
- pending: steps.createOffer.pending,
1853
- disabled: steps.tokenApproval.isNeeded() || offerPrice.amountRaw === "0" || insufficientBalance
1854
- }
1855
- ];
1856
- return /* @__PURE__ */ jsxs14(
1857
- ActionModal,
1858
- {
1859
- store: makeOfferModal$,
1860
- onClose: () => {
1861
- makeOfferModal$.close();
1862
- },
1863
- title: "Make an offer",
1864
- ctas,
1865
- children: [
1866
- /* @__PURE__ */ jsx18(
1867
- TokenPreview,
1868
- {
1869
- collectionName,
1870
- collectionAddress,
1871
- collectibleId,
1872
- chainId
1873
- }
1874
- ),
1875
- /* @__PURE__ */ jsx18(
1876
- priceInput_default,
1877
- {
1878
- chainId,
1879
- collectionAddress,
1880
- $listingPrice: makeOfferModal$.state.offerPrice,
1881
- checkBalance: {
1882
- enabled: true,
1883
- callback: (state) => setInsufficientBalance(state)
1884
- }
1885
- }
1886
- ),
1887
- collectionType === "ERC1155" /* ERC1155 */ && /* @__PURE__ */ jsx18(
1888
- QuantityInput,
1889
- {
1890
- chainId,
1891
- $quantity: makeOfferModal$.state.quantity,
1892
- collectionAddress,
1893
- collectibleId
1894
- }
1895
- ),
1896
- !!offerPrice && /* @__PURE__ */ jsx18(
1897
- FloorPriceText,
1898
- {
1899
- tokenId: collectibleId,
1900
- chainId,
1901
- collectionAddress,
1902
- price: offerPrice
1903
- }
1904
- ),
1905
- /* @__PURE__ */ jsx18(expirationDateSelect_default, { $date: makeOfferModal$.state.expiry })
1906
- ]
1907
- }
1908
- );
1909
- });
1910
-
1911
- // src/react/ui/modals/SellModal/index.tsx
1912
- import { Show as Show3, observer as observer10 } from "@legendapp/state/react";
1913
- import { useAccount as useAccount8 } from "wagmi";
1914
-
1915
- // src/react/ui/modals/_internal/components/transactionHeader/index.tsx
1916
- import { Box as Box13, NetworkImage as NetworkImage3, Skeleton as Skeleton5, Text as Text12 } from "@0xsequence/design-system";
1917
- import { formatDistanceToNow as formatDistanceToNow2 } from "date-fns";
1918
- import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
1919
- function TransactionHeader({
1920
- title,
1921
- chainId,
1922
- date
1923
- }) {
1924
- return /* @__PURE__ */ jsxs15(Box13, { display: "flex", alignItems: "center", width: "full", children: [
1925
- /* @__PURE__ */ jsx19(Text12, { fontSize: "small", fontWeight: "medium", color: "text80", marginRight: "1", children: title }),
1926
- /* @__PURE__ */ jsx19(NetworkImage3, { size: "xs", chainId }),
1927
- date && /* @__PURE__ */ jsxs15(Text12, { fontSize: "small", color: "text50", flexGrow: "1", textAlign: "right", children: [
1928
- formatDistanceToNow2(date),
1929
- " ago"
1930
- ] }) || /* @__PURE__ */ jsx19(Skeleton5, { width: "8", height: "4" })
1931
- ] });
1932
- }
1933
-
1934
- // src/react/ui/modals/SellModal/_store.ts
1935
- import { observable as observable6, when as when3 } from "@legendapp/state";
1936
- import { useMount as useMount3, useSelector as useSelector3 } from "@legendapp/state/react";
1937
- import { useAccount as useAccount7, useSendTransaction as useSendTransaction3 } from "wagmi";
1938
-
1939
- // src/react/ui/modals/SellModal/_utils/getSellTransactionTitleMessage.ts
1940
- var getSellTransactionTitle = (params) => {
1941
- if (params.isConfirmed) {
1942
- return "Your sale has processed";
1943
- }
1944
- if (params.isFailed) {
1945
- return "Your sale has failed";
1946
- }
1947
- return "Your sale is processing";
1948
- };
1949
- var getSellTransactionMessage = (params, collectibleName) => {
1950
- if (params.isConfirmed) {
1951
- return `You just sold ${collectibleName}. It\u2019s been confirmed on the blockchain!`;
1952
- }
1953
- if (params.isFailed) {
1954
- return `Your sale of ${collectibleName} has failed. Please try again.`;
1955
- }
1956
- return `You just sold ${collectibleName}. It should be confirmed on the blockchain shortly.`;
1957
- };
1958
-
1959
- // src/react/ui/modals/SellModal/_store.ts
1960
- var initialState5 = {
1961
- isOpen: false,
1962
- open: ({ collectionAddress, chainId, tokenId, order }) => {
1963
- sellModal$.state.set({
1964
- ...sellModal$.state.get(),
1965
- collectionAddress,
1966
- chainId,
1967
- tokenId,
1968
- order
1969
- });
1970
- sellModal$.isOpen.set(true);
1971
- },
1972
- close: () => {
1973
- sellModal$.isOpen.set(false);
1974
- sellModal$.state.set({
1975
- ...initialState5.state
1976
- });
1977
- },
1978
- state: {
1979
- collectionAddress: "",
1980
- chainId: "",
1981
- tokenId: "",
1982
- order: void 0
1983
- },
1984
- steps: {
1985
- isLoading: () => !!sellModal$.steps.stepsData.get(),
1986
- stepsData: void 0,
1987
- _currentStep: null,
1988
- tokenApproval: {},
1989
- sell: {}
1990
- },
1991
- hash: void 0
1992
- };
1993
- var sellModal$ = observable6(initialState5);
1994
- var useHydrate3 = () => {
1995
- const chainId = useSelector3(sellModal$.state.chainId);
1996
- const collectionAddress = useSelector3(sellModal$.state.collectionAddress);
1997
- const order = useSelector3(sellModal$.state.order);
1998
- useTokenApprovalHandler3(chainId);
1999
- useSellHandler(chainId);
2000
- const { generateSellTransactionAsync } = useGenerateSellTransaction({
2001
- chainId
2002
- });
2003
- const { connector, address } = useAccount7();
2004
- useMount3(() => {
2005
- const setSteps = async () => {
2006
- const sellTransactionData = await generateSellTransactionAsync({
2007
- walletType: connector?.walletType,
2008
- collectionAddress,
2009
- seller: address,
2010
- marketplace: "sequence_marketplace_v1" /* sequence_marketplace_v1 */,
2011
- ordersData: [
2012
- {
2013
- ...order,
2014
- orderId: order.orderId,
2015
- quantity: "1"
2016
- }
2017
- ],
2018
- additionalFees: []
2019
- });
2020
- sellModal$.steps.stepsData.set(sellTransactionData);
2021
- };
2022
- when3(() => !!order && !!connector, setSteps);
2023
- });
2024
- };
2025
- var useTokenApprovalHandler3 = (chainId) => {
2026
- const { sendTransactionAsync, isPending } = useSendTransaction3();
2027
- const onError = sellModal$.state.get().errorCallbacks?.onApproveTokenError;
2028
- const onSuccess = sellModal$.state.get().successCallbacks?.onApproveTokenSuccess;
2029
- sellModal$.steps.tokenApproval.set({
2030
- isNeeded: () => !!sellModal$.steps.tokenApproval.getStep(),
2031
- getStep: () => sellModal$.steps.stepsData?.get()?.find((s) => s.id === "tokenApproval" /* tokenApproval */),
2032
- pending: sellModal$.steps._currentStep.get() === "tokenApproval" && isPending,
2033
- execute: async () => {
2034
- const step = sellModal$.steps.tokenApproval.getStep();
2035
- if (!step) return;
2036
- sellModal$.steps._currentStep.set("tokenApproval");
2037
- try {
2038
- await sendTransactionAsync({
2039
- to: step.to,
2040
- chainId: Number(chainId),
2041
- data: step.data,
2042
- value: BigInt(step.value || "0")
2043
- });
2044
- sellModal$.steps._currentStep.set(null);
2045
- onSuccess && onSuccess();
2046
- } catch (error) {
2047
- onError && onError(error);
2048
- }
2049
- }
2050
- });
2051
- };
2052
- var useSellHandler = (chainId) => {
2053
- const { tokenId, collectionAddress, errorCallbacks, successCallbacks } = sellModal$.state.get();
2054
- const { address } = useAccount7();
2055
- const {
2056
- generateSellTransactionAsync,
2057
- isPending: generateSellTransactionPending
2058
- } = useGenerateSellTransaction({
2059
- chainId
2060
- });
2061
- const { data: collectible } = useCollectible({
2062
- chainId,
2063
- collectibleId: tokenId,
2064
- collectionAddress
2065
- });
2066
- const { data: currencies } = useCurrencies({ chainId });
2067
- const { sendTransactionAsync, isPending: sendTransactionPending } = useSendTransaction3();
2068
- const { show: showTransactionStatusModal } = useTransactionStatusModal();
2069
- function setSellStep() {
2070
- sellModal$.steps.sell.set({
2071
- pending: sellModal$.steps._currentStep.get() === "sell" && (generateSellTransactionPending || sendTransactionPending),
2072
- execute: () => {
2073
- sellModal$.steps._currentStep.set("sell");
2074
- const { collectionAddress: collectionAddress2, order } = sellModal$.state.get();
2075
- generateSellTransactionAsync({
2076
- collectionAddress: collectionAddress2,
2077
- seller: address,
2078
- marketplace: order.marketplace,
2079
- ordersData: [
2080
- {
2081
- ...order,
2082
- quantity: "1"
2083
- }
2084
- ],
2085
- additionalFees: order?.feeBreakdown ? [
2086
- {
2087
- amount: String(order.feeBps),
2088
- receiver: order.feeBreakdown?.[0]?.recipientAddress
2089
- }
2090
- ] : []
2091
- }).then(async (response) => {
2092
- const step = response.find((s) => s.id === "sell" /* sell */);
2093
- if (!step) throw new Error("No steps found");
2094
- try {
2095
- const hash = await sendTransactionAsync({
2096
- to: step.to,
2097
- chainId: Number(chainId),
2098
- data: step.data,
2099
- value: BigInt(step.value || "0")
2100
- });
2101
- sellModal$.hash.set(hash);
2102
- sellModal$.steps._currentStep.set(null);
2103
- sellModal$.close();
2104
- showTransactionStatusModal({
2105
- hash,
2106
- price: {
2107
- amountRaw: order.priceAmount,
2108
- currency: currencies.find(
2109
- (currency) => currency.contractAddress === order.priceCurrencyAddress
2110
- )
2111
- },
2112
- collectionAddress: collectionAddress2,
2113
- chainId,
2114
- tokenId,
2115
- getTitle: getSellTransactionTitle,
2116
- getMessage: (params) => getSellTransactionMessage(params, collectible?.name || ""),
2117
- type: "sell" /* sell */,
2118
- callbacks: {
2119
- onSuccess: successCallbacks?.onSellSuccess,
2120
- onUnknownError: errorCallbacks?.onSellError
2121
- },
2122
- queriesToInvalidate: [
2123
- ...collectableKeys.all,
2124
- balanceQueries.all
2125
- ]
2126
- });
2127
- } catch (error) {
2128
- errorCallbacks?.onSellError?.(error);
2129
- }
2130
- }).catch((error) => {
2131
- errorCallbacks?.onSellError?.(error);
2132
- });
2133
- }
2134
- });
2135
- }
2136
- when3(currencies && collectible, setSellStep);
2137
- };
2138
-
2139
- // src/react/ui/modals/SellModal/index.tsx
2140
- import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
2141
- var useSellModal = () => {
2142
- const { chainId: accountChainId } = useAccount8();
2143
- const { show: showSwitchNetworkModal } = useSwitchChainModal();
2144
- const { errorCallbacks, successCallbacks } = sellModal$.state.get();
2145
- const openModal = (args) => {
2146
- sellModal$.open(args);
2147
- };
2148
- const handleShowModal = (args) => {
2149
- const isSameChain = accountChainId === Number(args.chainId);
2150
- if (!isSameChain) {
2151
- showSwitchNetworkModal({
2152
- chainIdToSwitchTo: Number(args.chainId),
2153
- onSwitchChain: () => openModal(args),
2154
- callbacks: {
2155
- onSuccess: successCallbacks?.onSwitchChainSuccess,
2156
- onUnknownError: errorCallbacks?.onSwitchChainError,
2157
- onSwitchingNotSupported: errorCallbacks?.onSwitchingNotSupportedError,
2158
- onUserRejectedRequest: errorCallbacks?.onUserRejectedSwitchingChainRequestError
2159
- }
2160
- });
2161
- return;
2162
- }
2163
- openModal(args);
2164
- };
2165
- return {
2166
- show: handleShowModal,
2167
- close: () => sellModal$.close(),
2168
- onError: (callbacks) => {
2169
- sellModal$.state.set({
2170
- ...sellModal$.state.get(),
2171
- errorCallbacks: callbacks
2172
- });
2173
- },
2174
- onSuccess: (callbacks) => {
2175
- sellModal$.state.set({
2176
- ...sellModal$.state.get(),
2177
- successCallbacks: callbacks
2178
- });
2179
- }
2180
- };
2181
- };
2182
- var SellModal = () => {
2183
- return /* @__PURE__ */ jsx20(Show3, { if: sellModal$.isOpen, children: /* @__PURE__ */ jsx20(Modal4, {}) });
2184
- };
2185
- var Modal4 = () => {
2186
- useHydrate3();
2187
- return /* @__PURE__ */ jsx20(ModalContent3, {});
2188
- };
2189
- var ModalContent3 = observer10(() => {
2190
- const modalState = sellModal$.state.get();
2191
- const { collectionAddress, chainId, tokenId, order } = modalState;
2192
- const { steps } = sellModal$.get();
2193
- const { data: collection } = useCollection({ chainId, collectionAddress });
2194
- const { data: currencies } = useCurrencies({ chainId, collectionAddress });
2195
- const currency = currencies?.find(
2196
- (currency2) => currency2.contractAddress === order?.priceCurrencyAddress
2197
- );
2198
- const ctas = [
2199
- {
2200
- label: "Approve TOKEN",
2201
- onClick: steps.tokenApproval.execute,
2202
- hidden: !steps.tokenApproval.isNeeded(),
2203
- pending: steps.tokenApproval.pending,
2204
- variant: "glass"
2205
- },
2206
- {
2207
- label: "Accept",
2208
- onClick: steps.sell.execute,
2209
- pending: steps.sell.pending,
2210
- disabled: steps.tokenApproval.isNeeded()
2211
- }
2212
- ];
2213
- return /* @__PURE__ */ jsxs16(
2214
- ActionModal,
2215
- {
2216
- store: sellModal$,
2217
- onClose: () => sellModal$.close(),
2218
- title: "You have an offer",
2219
- ctas,
2220
- children: [
2221
- /* @__PURE__ */ jsx20(
2222
- TransactionHeader,
2223
- {
2224
- title: "Offer received",
2225
- chainId: Number(chainId),
2226
- date: order && new Date(order.createdAt)
2227
- }
2228
- ),
2229
- /* @__PURE__ */ jsx20(
2230
- TokenPreview,
2231
- {
2232
- collectionName: collection?.name,
2233
- collectionAddress,
2234
- collectibleId: tokenId,
2235
- chainId
2236
- }
2237
- ),
2238
- /* @__PURE__ */ jsx20(
2239
- TransactionDetails,
2240
- {
2241
- collectibleId: tokenId,
2242
- collectionAddress,
2243
- chainId,
2244
- price: currency ? { amountRaw: order?.priceAmount, currency } : void 0
2245
- }
2246
- )
2247
- ]
2248
- }
2249
- );
2250
- });
2251
-
2252
- // src/react/ui/modals/SuccessfulPurchaseModal/index.tsx
2253
- import {
2254
- Box as Box14,
2255
- Button as Button4,
2256
- CloseIcon as CloseIcon3,
2257
- ExternalLinkIcon,
2258
- IconButton as IconButton4,
2259
- Image as Image3,
2260
- Text as Text13
2261
- } from "@0xsequence/design-system";
2262
- import { observer as observer11 } from "@legendapp/state/react";
2263
- import { Close as Close3, Content as Content4, Overlay as Overlay3, Portal as Portal4, Root as Root4 } from "@radix-ui/react-dialog";
2264
-
2265
- // src/react/ui/modals/SuccessfulPurchaseModal/_store.ts
2266
- import { observable as observable7 } from "@legendapp/state";
2267
- var initialState6 = {
2268
- isOpen: false,
2269
- open: ({
2270
- collectibles,
2271
- totalPrice,
2272
- explorerName,
2273
- explorerUrl,
2274
- ctaOptions
2275
- }) => {
2276
- successfulPurchaseModal$.state.set({
2277
- ...successfulPurchaseModal$.state.get(),
2278
- collectibles,
2279
- totalPrice,
2280
- explorerName,
2281
- explorerUrl,
2282
- ctaOptions
2283
- });
2284
- successfulPurchaseModal$.isOpen.set(true);
2285
- },
2286
- close: () => {
2287
- successfulPurchaseModal$.isOpen.set(false);
2288
- successfulPurchaseModal$.state.set({
2289
- ...initialState6.state
2290
- });
2291
- },
2292
- state: {
2293
- collectibles: [],
2294
- totalPrice: "0",
2295
- explorerName: "",
2296
- explorerUrl: "",
2297
- ctaOptions: void 0
2298
- }
2299
- };
2300
- var successfulPurchaseModal$ = observable7(initialState6);
2301
-
2302
- // src/react/ui/modals/SuccessfulPurchaseModal/index.tsx
2303
- import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
2304
- var useSuccessfulPurchaseModal = () => {
2305
- return {
2306
- show: (args) => successfulPurchaseModal$.open(args),
2307
- close: () => successfulPurchaseModal$.close()
2308
- };
2309
- };
2310
- var SuccessfulPurchaseModal = observer11(() => {
2311
- return /* @__PURE__ */ jsx21(Root4, { open: successfulPurchaseModal$.isOpen.get(), children: /* @__PURE__ */ jsxs17(Portal4, { children: [
2312
- /* @__PURE__ */ jsx21(Overlay3, { className: dialogOverlay2 }),
2313
- /* @__PURE__ */ jsxs17(Content4, { className: dialogContent.narrow, children: [
2314
- /* @__PURE__ */ jsxs17(Box14, { display: "flex", flexDirection: "column", gap: "4", width: "full", children: [
2315
- /* @__PURE__ */ jsx21(
2316
- Text13,
2317
- {
2318
- textAlign: "center",
2319
- fontSize: "medium",
2320
- fontWeight: "bold",
2321
- color: "text100",
2322
- children: "Successful purchase!"
2323
- }
2324
- ),
2325
- /* @__PURE__ */ jsx21(
2326
- CollectiblesGrid,
2327
- {
2328
- collectibles: successfulPurchaseModal$.state.get().collectibles
2329
- }
2330
- ),
2331
- /* @__PURE__ */ jsxs17(Box14, { display: "flex", alignItems: "center", gap: "1", children: [
2332
- /* @__PURE__ */ jsx21(Text13, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "You bought" }),
2333
- /* @__PURE__ */ jsx21(Text13, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().collectibles.length }),
2334
- /* @__PURE__ */ jsx21(Text13, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "items for" }),
2335
- /* @__PURE__ */ jsx21(Text13, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().totalPrice })
2336
- ] }),
2337
- /* @__PURE__ */ jsx21(SuccessfulPurchaseActions, {})
2338
- ] }),
2339
- /* @__PURE__ */ jsx21(
2340
- Close3,
2341
- {
2342
- onClick: () => {
2343
- successfulPurchaseModal$.close();
2344
- },
2345
- className: closeButton2,
2346
- asChild: true,
2347
- children: /* @__PURE__ */ jsx21(IconButton4, { size: "xs", "aria-label": "Close modal", icon: CloseIcon3 })
2348
- }
2349
- )
2350
- ] })
2351
- ] }) });
2352
- });
2353
- function SuccessfulPurchaseActions() {
2354
- return /* @__PURE__ */ jsxs17(Box14, { display: "flex", flexDirection: "column", gap: "2", children: [
2355
- successfulPurchaseModal$.state.ctaOptions.get() && /* @__PURE__ */ jsx21(
2356
- Button4,
2357
- {
2358
- shape: "square",
2359
- leftIcon: successfulPurchaseModal$.state.ctaOptions.ctaIcon.get() || void 0,
2360
- label: successfulPurchaseModal$.state.ctaOptions.ctaLabel.get(),
2361
- width: "full",
2362
- onClick: successfulPurchaseModal$.state.ctaOptions.ctaOnClick.get() || void 0
2363
- }
2364
- ),
2365
- /* @__PURE__ */ jsx21(
2366
- Button4,
2367
- {
2368
- as: "a",
2369
- href: successfulPurchaseModal$.state.explorerUrl.get(),
2370
- target: "_blank",
2371
- rel: "noopener noreferrer",
2372
- shape: "square",
2373
- leftIcon: ExternalLinkIcon,
2374
- label: `View on ${successfulPurchaseModal$.state.explorerName.get()}`,
2375
- width: "full"
2376
- }
2377
- )
2378
- ] });
2379
- }
2380
- function CollectiblesGrid({ collectibles }) {
2381
- const total = collectibles.length;
2382
- const shownCollectibles = total > 4 ? collectibles.slice(0, 4) : collectibles;
2383
- return /* @__PURE__ */ jsx21(Box14, { className: collectiblesGrid, display: "grid", gap: "2", children: shownCollectibles.map((collectible) => {
2384
- const showPlus = total > 4 && collectibles.indexOf(collectible) === 3;
2385
- return /* @__PURE__ */ jsxs17(
2386
- Box14,
2387
- {
2388
- className: collectiblesGridItem,
2389
- position: "relative",
2390
- children: [
2391
- /* @__PURE__ */ jsx21(
2392
- Image3,
2393
- {
2394
- src: collectible.image,
2395
- alt: collectible.name,
2396
- className: showPlus ? collectiblesGridImagePale : collectiblesGridImage,
2397
- aspectRatio: "1/1",
2398
- background: "backgroundSecondary",
2399
- borderRadius: "sm"
2400
- }
2401
- ),
2402
- showPlus && /* @__PURE__ */ jsx21(
2403
- Box14,
2404
- {
2405
- position: "absolute",
2406
- top: "0",
2407
- left: "0",
2408
- right: "0",
2409
- bottom: "0",
2410
- display: "flex",
2411
- alignItems: "center",
2412
- justifyContent: "center",
2413
- background: "backgroundOverlay",
2414
- backdropFilter: "blur",
2415
- children: /* @__PURE__ */ jsxs17(
2416
- Text13,
2417
- {
2418
- fontSize: "small",
2419
- fontWeight: "medium",
2420
- color: "text80",
2421
- paddingX: "2",
2422
- paddingY: "1.5",
2423
- borderRadius: "sm",
2424
- background: "backgroundSecondary",
2425
- backdropFilter: "blur",
2426
- children: [
2427
- total,
2428
- " TOTAL"
2429
- ]
2430
- }
2431
- )
2432
- }
2433
- )
2434
- ]
2435
- },
2436
- collectible.tokenId
2437
- );
2438
- }) });
2439
- }
2440
- var SuccessfulPurchaseModal_default = SuccessfulPurchaseModal;
2441
-
2442
- // src/react/ui/modals/TransferModal/_store.ts
2443
- import { observable as observable8 } from "@legendapp/state";
2444
- var initialState7 = {
2445
- isOpen: false,
2446
- open: ({ chainId, collectionAddress, tokenId }) => {
2447
- transferModal$.state.set({
2448
- ...transferModal$.state.get(),
2449
- chainId,
2450
- collectionAddress,
2451
- tokenId
2452
- });
2453
- transferModal$.isOpen.set(true);
2454
- },
2455
- close: () => {
2456
- transferModal$.isOpen.set(false);
2457
- transferModal$.state.set({
2458
- ...initialState7.state
2459
- });
2460
- transferModal$.view.set("enterReceiverAddress");
2461
- transferModal$.hash.set(void 0);
2462
- },
2463
- state: {
2464
- receiverAddress: "",
2465
- collectionAddress: "0x",
2466
- chainId: "",
2467
- tokenId: "",
2468
- quantity: "1"
2469
- },
2470
- view: "enterReceiverAddress",
2471
- hash: void 0
2472
- };
2473
- var transferModal$ = observable8(initialState7);
2474
-
2475
- // src/react/ui/modals/TransferModal/index.tsx
2476
- import { CloseIcon as CloseIcon4, IconButton as IconButton5 } from "@0xsequence/design-system";
2477
- import { observer as observer13, Show as Show4 } from "@legendapp/state/react";
2478
- import { Close as Close4, Content as Content5, Overlay as Overlay4, Portal as Portal5, Root as Root5 } from "@radix-ui/react-dialog";
2479
- import { useAccount as useAccount10 } from "wagmi";
2480
-
2481
- // src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
2482
- import { Box as Box15, Button as Button5, Text as Text14, TextInput } from "@0xsequence/design-system";
2483
- import { isAddress } from "viem";
2484
- import { useAccount as useAccount9 } from "wagmi";
2485
-
2486
- // src/react/ui/modals/TransferModal/messages.ts
2487
- var baseMessages = {
2488
- enterReceiverAddress: "Items sent to the wrong wallet address can't be recovered!",
2489
- followWalletInstructions: "Follow your wallet's instructions to submit a transaction to transfer your assets."
2490
- };
2491
- function getMessage(key) {
2492
- return baseMessages[key];
2493
- }
2494
-
2495
- // src/react/ui/modals/TransferModal/_utils/getTransferTransactionTitleMessage.ts
2496
- var getTransferTransactionTitle = (params) => {
2497
- if (params.isConfirmed) {
2498
- return "Transfer has processed";
2499
- }
2500
- if (params.isFailed) {
2501
- return "Transfer has failed";
2502
- }
2503
- return "Transfer is processing";
2504
- };
2505
- var getTransferTransactionMessage = (params, collectibleName) => {
2506
- if (params.isConfirmed) {
2507
- return `You just tranferred ${collectibleName}. It\u2019s been confirmed on the blockchain!`;
2508
- }
2509
- if (params.isFailed) {
2510
- return `Transferring ${collectibleName} has failed. Please try again.`;
2511
- }
2512
- return `You just transferred ${collectibleName}. It should be confirmed on the blockchain shortly.`;
2513
- };
2514
-
2515
- // src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx
2516
- var useHandleTransfer = () => {
2517
- const {
2518
- receiverAddress,
2519
- collectionAddress,
2520
- tokenId,
2521
- quantity,
2522
- chainId,
2523
- collectionType,
2524
- successCallbacks,
2525
- errorCallbacks
2526
- } = transferModal$.state.get();
2527
- const { transferTokensAsync } = useTransferTokens();
2528
- const { show: showTransactionStatusModal } = useTransactionStatusModal();
2529
- const { data: collectible } = useCollectible({
2530
- collectionAddress,
2531
- collectibleId: tokenId,
2532
- chainId
2533
- });
2534
- async function transfer() {
2535
- if (collectionType !== "ERC721" /* ERC721 */ && collectionType !== "ERC1155" /* ERC1155 */) {
2536
- throw new Error("Invalid contract type");
2537
- }
2538
- if (collectionType === "ERC721" /* ERC721 */) {
2539
- try {
2540
- const hash = await transferTokensAsync({
2541
- receiverAddress,
2542
- collectionAddress,
2543
- tokenId,
2544
- chainId,
2545
- contractType: "ERC721" /* ERC721 */
2546
- });
2547
- transferModal$.close();
2548
- showTransactionStatusModal({
2549
- hash,
2550
- collectionAddress,
2551
- chainId,
2552
- tokenId,
2553
- price: void 0,
2554
- getTitle: getTransferTransactionTitle,
2555
- getMessage: (params) => getTransferTransactionMessage(params, collectible.name),
2556
- type: "transfer",
2557
- callbacks: {
2558
- onSuccess: successCallbacks?.onTransferSuccess,
2559
- onUnknownError: errorCallbacks?.onTransferError
2560
- },
2561
- queriesToInvalidate: balanceQueries.all
2562
- });
2563
- } catch (error) {
2564
- transferModal$.view.set("enterReceiverAddress");
2565
- errorCallbacks?.onTransferError?.(error);
2566
- }
2567
- }
2568
- if (collectionType === "ERC1155" /* ERC1155 */) {
2569
- try {
2570
- const hash = await transferTokensAsync({
2571
- receiverAddress,
2572
- collectionAddress,
2573
- tokenId,
2574
- chainId,
2575
- contractType: "ERC1155" /* ERC1155 */,
2576
- quantity: String(quantity)
2577
- });
2578
- transferModal$.close();
2579
- showTransactionStatusModal({
2580
- hash,
2581
- collectionAddress,
2582
- chainId,
2583
- tokenId,
2584
- price: void 0,
2585
- getTitle: getTransferTransactionTitle,
2586
- getMessage: (params) => getTransferTransactionMessage(params, collectible.name),
2587
- type: "transfer",
2588
- callbacks: {
2589
- onSuccess: successCallbacks?.onTransferSuccess,
2590
- onUnknownError: errorCallbacks?.onTransferError
2591
- }
2592
- });
2593
- } catch (error) {
2594
- transferModal$.view.set("enterReceiverAddress");
2595
- errorCallbacks?.onTransferError?.(error);
2596
- }
2597
- }
2598
- }
2599
- return { transfer };
2600
- };
2601
- var useHandleTransfer_default = useHandleTransfer;
2602
-
2603
- // src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
2604
- import { Fragment, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
2605
- var EnterWalletAddressView = () => {
2606
- const { address } = useAccount9();
2607
- const { collectionAddress, tokenId, chainId, collectionType } = transferModal$.state.get();
2608
- const $quantity = transferModal$.state.quantity;
2609
- const isWalletAddressValid = isAddress(
2610
- transferModal$.state.receiverAddress.get()
2611
- );
2612
- const { data: tokenBalance } = useListBalances({
2613
- chainId,
2614
- contractAddress: collectionAddress,
2615
- tokenId,
2616
- accountAddress: address,
2617
- query: { enabled: !!address }
2618
- });
2619
- const balanceAmount = tokenBalance?.pages[0].balances[0].balance;
2620
- const insufficientBalance = $quantity.get() > balanceAmount;
2621
- const { data: collection } = useCollection({
2622
- collectionAddress,
2623
- chainId
2624
- });
2625
- transferModal$.state.collectionType.set(
2626
- collection?.type
2627
- );
2628
- const { transfer } = useHandleTransfer_default();
2629
- function handleChangeWalletAddress(event) {
2630
- transferModal$.state.receiverAddress.set(event.target.value);
2631
- }
2632
- function handleChangeView() {
2633
- transfer();
2634
- transferModal$.view.set("followWalletInstructions");
2635
- }
2636
- return /* @__PURE__ */ jsxs18(Box15, { display: "grid", gap: "6", flexGrow: "1", children: [
2637
- /* @__PURE__ */ jsx22(Text14, { color: "white", fontSize: "large", fontWeight: "bold", children: "Transfer your item" }),
2638
- /* @__PURE__ */ jsxs18(Box15, { display: "flex", flexDirection: "column", gap: "3", children: [
2639
- /* @__PURE__ */ jsx22(
2640
- AlertMessage,
2641
- {
2642
- message: getMessage("enterReceiverAddress"),
2643
- type: "warning"
2644
- }
2645
- ),
2646
- /* @__PURE__ */ jsx22(
2647
- TextInput,
2648
- {
2649
- label: "Wallet address",
2650
- labelLocation: "top",
2651
- value: transferModal$.state.receiverAddress.get(),
2652
- onChange: handleChangeWalletAddress,
2653
- name: "walletAddress",
2654
- placeholder: "Enter wallet address of recipient"
2655
- }
2656
- ),
2657
- collectionType === "ERC1155" /* ERC1155 */ && balanceAmount && /* @__PURE__ */ jsxs18(Fragment, { children: [
2658
- /* @__PURE__ */ jsx22(
2659
- QuantityInput,
2660
- {
2661
- $quantity,
2662
- chainId,
2663
- collectionAddress,
2664
- collectibleId: tokenId
2665
- }
2666
- ),
2667
- /* @__PURE__ */ jsx22(
2668
- Text14,
2669
- {
2670
- color: insufficientBalance ? "negative" : "text50",
2671
- fontSize: "small",
2672
- fontWeight: "medium",
2673
- children: `You have ${balanceAmount} of this item`
2674
- }
2675
- )
2676
- ] })
2677
- ] }),
2678
- /* @__PURE__ */ jsx22(
2679
- Button5,
2680
- {
2681
- onClick: handleChangeView,
2682
- disabled: !isWalletAddressValid || insufficientBalance,
2683
- title: "Transfer",
2684
- label: "Transfer",
2685
- variant: "primary",
2686
- shape: "square",
2687
- size: "sm",
2688
- justifySelf: "flex-end",
2689
- paddingX: "10"
2690
- }
2691
- )
2692
- ] });
2693
- };
2694
- var enterWalletAddress_default = EnterWalletAddressView;
2695
-
2696
- // src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx
2697
- import { observer as observer12 } from "@legendapp/state/react";
2698
- import { Box as Box16, Button as Button6, Text as Text15 } from "@0xsequence/design-system";
2699
- import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
2700
- var FollowWalletInstructionsView = observer12(() => {
2701
- return /* @__PURE__ */ jsxs19(Box16, { display: "grid", gap: "6", flexGrow: "1", children: [
2702
- /* @__PURE__ */ jsx23(Text15, { color: "white", fontSize: "large", fontWeight: "bold", children: "Transfer your item" }),
2703
- /* @__PURE__ */ jsx23(Box16, { display: "flex", flexDirection: "column", gap: "3", children: /* @__PURE__ */ jsx23(
2704
- AlertMessage,
2705
- {
2706
- message: getMessage("followWalletInstructions"),
2707
- type: "info"
2708
- }
2709
- ) }),
2710
- /* @__PURE__ */ jsx23(
2711
- Button6,
2712
- {
2713
- disabled: true,
2714
- title: "Transfer",
2715
- label: "Transfer",
2716
- variant: "primary",
2717
- shape: "square",
2718
- size: "sm",
2719
- justifySelf: "flex-end",
2720
- paddingX: "10"
2721
- }
2722
- )
2723
- ] });
2724
- });
2725
- var followWalletInstructions_default = FollowWalletInstructionsView;
2726
-
2727
- // src/react/ui/modals/TransferModal/index.tsx
2728
- import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
2729
- var useTransferModal = () => {
2730
- const { chainId: accountChainId } = useAccount10();
2731
- const { show: showSwitchNetworkModal } = useSwitchChainModal();
2732
- const { errorCallbacks, successCallbacks } = transferModal$.state.get();
2733
- const openModal = (args) => {
2734
- transferModal$.open(args);
2735
- };
2736
- const handleShowModal = (args) => {
2737
- const isSameChain = accountChainId === Number(args.chainId);
2738
- if (!isSameChain) {
2739
- showSwitchNetworkModal({
2740
- chainIdToSwitchTo: Number(args.chainId),
2741
- onSwitchChain: () => openModal(args),
2742
- callbacks: {
2743
- onSuccess: successCallbacks?.onSwitchChainSuccess,
2744
- onUnknownError: errorCallbacks?.onSwitchChainError,
2745
- onSwitchingNotSupported: errorCallbacks?.onSwitchingNotSupportedError,
2746
- onUserRejectedRequest: errorCallbacks?.onUserRejectedSwitchingChainRequestError
2747
- }
2748
- });
2749
- return;
2750
- }
2751
- openModal(args);
2752
- };
2753
- return {
2754
- show: handleShowModal,
2755
- close: () => transferModal$.close(),
2756
- onError: (callbacks) => {
2757
- transferModal$.state.set({
2758
- ...transferModal$.state.get(),
2759
- errorCallbacks: callbacks
2760
- });
2761
- },
2762
- onSuccess: (callbacks) => {
2763
- transferModal$.state.set({
2764
- ...transferModal$.state.get(),
2765
- successCallbacks: callbacks
2766
- });
2767
- }
2768
- };
2769
- };
2770
- var TransferModal = () => {
2771
- return /* @__PURE__ */ jsx24(Show4, { if: transferModal$.isOpen, children: /* @__PURE__ */ jsx24(Modal5, {}) });
2772
- };
2773
- var Modal5 = () => {
2774
- return /* @__PURE__ */ jsx24(ModalContent4, {});
2775
- };
2776
- var ModalContent4 = observer13(() => {
2777
- return /* @__PURE__ */ jsx24(Root5, { open: true, children: /* @__PURE__ */ jsxs20(Portal5, { children: [
2778
- /* @__PURE__ */ jsx24(Overlay4, { className: dialogOverlay3 }),
2779
- /* @__PURE__ */ jsxs20(Content5, { className: transferModalContent, children: [
2780
- /* @__PURE__ */ jsx24(TransactionModalView, {}),
2781
- /* @__PURE__ */ jsx24(Close4, { onClick: transferModal$.close, className: closeButton3, asChild: true, children: /* @__PURE__ */ jsx24(IconButton5, { size: "xs", "aria-label": "Close modal", icon: CloseIcon4 }) })
2782
- ] })
2783
- ] }) });
2784
- });
2785
- var TransactionModalView = observer13(() => {
2786
- const { view } = transferModal$.get();
2787
- switch (view) {
2788
- case "enterReceiverAddress":
2789
- return /* @__PURE__ */ jsx24(enterWalletAddress_default, {});
2790
- case "followWalletInstructions":
2791
- return /* @__PURE__ */ jsx24(followWalletInstructions_default, {});
2792
- default:
2793
- return null;
2794
- }
2795
- });
2796
-
2797
- // src/react/ui/modals/modal-provider.tsx
2798
- import { Fragment as Fragment2, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
2799
- var ModalProvider = observer14(() => {
2800
- return /* @__PURE__ */ jsxs21(Fragment2, { children: [
2801
- /* @__PURE__ */ jsx25(AccountModal, {}),
2802
- /* @__PURE__ */ jsx25(CreateListingModal, {}),
2803
- /* @__PURE__ */ jsx25(MakeOfferModal, {}),
2804
- /* @__PURE__ */ jsx25(TransferModal, {}),
2805
- /* @__PURE__ */ jsx25(SellModal, {}),
2806
- /* @__PURE__ */ jsx25(SuccessfulPurchaseModal_default, {}),
2807
- /* @__PURE__ */ jsx25(switchChainModal_default, {}),
2808
- /* @__PURE__ */ jsx25(transactionStatusModal_default, {})
2809
- ] });
2810
- });
2811
-
2812
- // src/react/ui/components/collectible-card/CollectibleCard.tsx
2813
- import { useState as useState6 } from "react";
2814
- import { Box as Box21, IconButton as IconButton7, Skeleton as Skeleton6 } from "@0xsequence/design-system";
2815
-
2816
- // src/react/ui/components/_internals/action-button/ActionButton.tsx
2817
- import { Button as Button7 } from "@0xsequence/design-system";
2818
- import { observer as observer15 } from "@legendapp/state/react";
2819
- import { useAccount as useAccount11 } from "wagmi";
2820
- import { jsx as jsx26 } from "react/jsx-runtime";
2821
- var ActionButton = observer15(function AddToCartButton({
2822
- collectionAddress,
2823
- chainId,
2824
- tokenId,
2825
- isTransfer
2826
- }) {
2827
- const { address: accountAddress } = useAccount11();
2828
- const { data: balance, isLoading: balanceLoading } = useBalanceOfCollectible({
2829
- chainId,
2830
- collectionAddress,
2831
- collectableId: tokenId,
2832
- // biome-ignore lint/style/noNonNullAssertion: <explanation>
2833
- userAddress: accountAddress
2834
- });
2835
- const { data: highestOffer, isLoading: highestOfferLoading } = useHighestOffer({
2836
- collectionAddress,
2837
- chainId: String(chainId),
2838
- tokenId
2839
- });
2840
- const { data: lowestListing, isLoading: lowestListingLoading } = useLowestListing({
2841
- collectionAddress,
2842
- chainId: String(chainId),
2843
- tokenId
2844
- });
2845
- const collectibleOwned = balance?.balance ?? 0;
2846
- const { show: showCreateListingModal } = useCreateListingModal();
2847
- const { show: showMakeOfferModal } = useMakeOfferModal();
2848
- const { show: showSellModal } = useSellModal();
2849
- const { show: showTransferModal } = useTransferModal();
2850
- if (balanceLoading || highestOfferLoading || lowestListingLoading || !accountAddress) {
2851
- return null;
2852
- }
2853
- if (isTransfer && collectibleOwned) {
2854
- return /* @__PURE__ */ jsx26(
2855
- ActionButtonBody,
2856
- {
2857
- label: "Transfer",
2858
- onClick: () => showTransferModal({
2859
- collectionAddress,
2860
- chainId,
2861
- tokenId
2862
- })
2863
- }
2864
- );
2865
- }
2866
- if (!collectibleOwned) {
2867
- return /* @__PURE__ */ jsx26(
2868
- ActionButtonBody,
2869
- {
2870
- label: "Make an offer",
2871
- onClick: () => showMakeOfferModal({
2872
- collectionAddress,
2873
- chainId,
2874
- collectibleId: tokenId
2875
- })
2876
- }
2877
- );
2878
- }
2879
- if (!collectibleOwned && lowestListing?.order) {
2880
- return /* @__PURE__ */ jsx26(
2881
- ActionButtonBody,
2882
- {
2883
- label: "Add to cart",
2884
- onClick: () => {
2885
- }
2886
- }
2887
- );
2888
- }
2889
- if (collectibleOwned && !lowestListing?.order) {
2890
- return /* @__PURE__ */ jsx26(
2891
- ActionButtonBody,
2892
- {
2893
- label: "Create listing",
2894
- onClick: () => showCreateListingModal({
2895
- collectionAddress,
2896
- chainId,
2897
- collectibleId: tokenId
2898
- })
2899
- }
2900
- );
2901
- }
2902
- if (collectibleOwned && highestOffer?.order) {
2903
- return /* @__PURE__ */ jsx26(
2904
- ActionButtonBody,
2905
- {
2906
- label: "Sell",
2907
- onClick: () => showSellModal({
2908
- collectionAddress,
2909
- chainId,
2910
- tokenId,
2911
- // biome-ignore lint/style/noNonNullAssertion: <explanation>
2912
- order: highestOffer.order
2913
- })
2914
- }
2915
- );
2916
- }
2917
- return null;
2918
- });
2919
- function ActionButtonBody({ label, onClick }) {
2920
- return /* @__PURE__ */ jsx26(
2921
- Button7,
2922
- {
2923
- variant: "primary",
2924
- label,
2925
- onClick: (e) => {
2926
- e.preventDefault();
2927
- e.stopPropagation();
2928
- onClick();
2929
- },
2930
- size: "xs",
2931
- shape: "square",
2932
- width: "full"
2933
- }
2934
- );
2935
- }
2936
-
2937
- // src/react/ui/icons/DiamondEye.tsx
2938
- import { Box as Box17 } from "@0xsequence/design-system";
2939
- import { jsx as jsx27 } from "react/jsx-runtime";
2940
- var Svg = () => /* @__PURE__ */ jsx27(
2941
- "svg",
2942
- {
2943
- width: "16",
2944
- height: "12",
2945
- viewBox: "0 0 16 12",
2946
- fill: "none",
2947
- xmlns: "http://www.w3.org/2000/svg",
2948
- children: /* @__PURE__ */ jsx27(
2949
- "path",
2950
- {
2951
- fillRule: "evenodd",
2952
- clipRule: "evenodd",
2953
- d: "M5.00447 0.108826L0.611084 4.50526L7.99997 11.8911L15.3889 4.50526L10.9955 0.108826H5.00447ZM4.60507 2.90461C6.4718 1.0297 9.52815 1.02968 11.3949 2.90459L12.9925 4.50223L11.3949 6.09983C9.52815 7.97473 6.4718 7.97473 4.60507 6.09985L3.00749 4.50223L4.60507 2.90461ZM5.70321 4.50209C5.70321 5.77095 6.73193 6.79865 7.99974 6.79865C9.2676 6.79865 10.2963 5.77095 10.2963 4.50209C10.2963 3.23322 9.2676 2.20553 7.99974 2.20553C6.73193 2.20553 5.70321 3.23322 5.70321 4.50209ZM7.99974 5.50058C7.44853 5.50058 7.00125 5.05377 7.00125 4.50209C7.00125 3.9504 7.44853 3.50359 7.99974 3.50359C8.55095 3.50359 8.99825 3.9504 8.99825 4.50209C8.99825 5.05377 8.55095 5.50058 7.99974 5.50058Z",
2954
- fill: "white"
2955
- }
2956
- )
2957
- }
2958
- );
2959
- var SvgDiamondEyeIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx27(
2960
- Box17,
2961
- {
2962
- as: Svg,
2963
- className: iconVariants({
2964
- size
2965
- }),
2966
- ...props
2967
- }
2968
- );
2969
- var DiamondEye_default = SvgDiamondEyeIcon;
2970
-
2971
- // src/react/ui/components/collectible-card/Footer.tsx
2972
- import { Box as Box20, IconButton as IconButton6, Image as Image4, Text as Text17 } from "@0xsequence/design-system";
2973
- import { useAccount as useAccount12 } from "wagmi";
2974
- import { formatUnits as formatUnits4 } from "viem";
2975
-
2976
- // src/react/ui/components/_internals/pill/Pill.tsx
2977
- import { Box as Box18, Text as Text16 } from "@0xsequence/design-system";
2978
- import { jsx as jsx28 } from "react/jsx-runtime";
2979
- function Pill({ text }) {
2980
- return /* @__PURE__ */ jsx28(
2981
- Box18,
2982
- {
2983
- background: "backgroundRaised",
2984
- display: "flex",
2985
- alignItems: "center",
2986
- justifyContent: "center",
2987
- paddingY: "1",
2988
- paddingX: "2",
2989
- borderRadius: "sm",
2990
- width: "max",
2991
- children: /* @__PURE__ */ jsx28(Text16, { fontSize: "small", fontWeight: "medium", color: "text80", children: text })
2992
- }
2993
- );
2994
- }
2995
-
2996
- // src/react/ui/icons/Bell.tsx
2997
- import { Box as Box19 } from "@0xsequence/design-system";
2998
- import { jsx as jsx29 } from "react/jsx-runtime";
2999
- var Svg2 = () => /* @__PURE__ */ jsx29(
3000
- "svg",
3001
- {
3002
- width: "17",
3003
- height: "17",
3004
- viewBox: "0 0 17 17",
3005
- fill: "none",
3006
- xmlns: "http://www.w3.org/2000/svg",
3007
- children: /* @__PURE__ */ jsx29(
3008
- "path",
3009
- {
3010
- "fill-rule": "evenodd",
3011
- "clip-rule": "evenodd",
3012
- d: "M12.3127 7.45705V9.74274C12.3127 10.3805 12.6293 10.6971 12.9647 11.0326L12.9652 11.033L12.9679 11.0358C13.3205 11.3893 13.6843 11.754 13.6843 12.4854C13.6843 12.5491 13.6335 12.5998 13.57 12.5998H3.51277C3.44959 12.5998 3.39844 12.5489 3.39844 12.4854C3.39844 11.7539 3.76242 11.389 4.11507 11.0354L4.11754 11.033C4.45305 10.6975 4.76984 10.3807 4.76984 9.74245V7.45676C4.76984 5.6932 5.98854 4.21248 7.62704 3.802V3.11399C7.62704 2.60926 8.03659 2.19971 8.54132 2.19971C9.04606 2.19971 9.45561 2.60926 9.45561 3.11399V3.802C11.094 4.21286 12.3127 5.69335 12.3127 7.45705ZM10.3698 13.1711C10.3698 14.1809 9.55099 14.9997 8.54121 14.9997C7.53128 14.9997 6.71272 14.181 6.71272 13.1711H10.3698ZM8.758 7.70501C9.30005 7.85574 9.6696 7.99832 9.86302 8.13224C10.1776 8.35015 10.3374 8.67657 10.338 9.106C10.338 9.7284 10.1359 10.1706 9.72956 10.4326C9.50571 10.5778 9.18295 10.6723 8.75846 10.7195V11.4005H8.42657V10.7195C7.74604 10.6746 7.28244 10.4349 7.04094 9.99812C6.90703 9.76157 6.83984 9.44246 6.83984 9.04019H7.46277C7.48004 9.35983 7.53041 9.59501 7.6135 9.74163C7.75837 10.0063 8.0303 10.1548 8.42664 10.1861V8.27703C7.9177 8.18078 7.54357 8.01963 7.30116 7.79532C7.0605 7.57102 6.93929 7.25914 6.93929 6.86234C6.93929 6.50686 7.06917 6.18768 7.32977 5.90212C7.58991 5.61657 7.95581 5.47132 8.42619 5.46675V5.00049H8.75808V5.45861C9.22343 5.4927 9.58119 5.62981 9.82863 5.87039C10.0787 6.11144 10.2086 6.43062 10.2204 6.82651H9.60569C9.5907 6.64899 9.54299 6.49507 9.4631 6.36884C9.31595 6.13183 9.08076 6.00697 8.758 5.99518V7.70501ZM7.80143 7.36315C7.95574 7.49478 8.16369 7.58608 8.42611 7.63691L8.42619 5.98886C8.11651 5.99936 7.89723 6.09424 7.76651 6.2681C7.63572 6.4447 7.57036 6.62815 7.57036 6.82019C7.57036 7.05081 7.64705 7.23289 7.80143 7.36315ZM8.75747 10.2033C9.15883 10.1847 9.43305 10.0394 9.58606 9.76522C9.66504 9.62408 9.70415 9.46285 9.70399 9.27948C9.70399 8.98624 9.59686 8.76376 9.38123 8.61121C9.2582 8.52219 9.05079 8.4391 8.75747 8.35921V10.2033Z",
3013
- fill: "white"
3014
- }
3015
- )
3016
- }
3017
- );
3018
- var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx29(
3019
- Box19,
3020
- {
3021
- as: Svg2,
3022
- className: iconVariants({
3023
- size
3024
- }),
3025
- ...props
3026
- }
3027
- );
3028
- var Bell_default = SvgBellIcon;
3029
-
3030
- // src/react/ui/components/collectible-card/styles.css.ts
3031
- var actionWrapper = "styles_actionWrapper__biep7a7";
3032
- var collectibleCard = "styles_collectibleCard__biep7a0";
3033
- var collectibleImage = "styles_collectibleImage__biep7a1";
3034
- var collectibleTileWrapper = "styles_collectibleTileWrapper__biep7a2";
3035
- var footer = { animated: "styles_footer_animated__biep7a5 fyvr11wl", "static": "fyvr11wl" };
3036
- var offerBellButton = "styles_offerBellButton__biep7a3";
3037
-
3038
- // src/react/ui/components/collectible-card/Footer.tsx
3039
- import { jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
3040
- var Footer = ({
3041
- name,
3042
- type,
3043
- chainId,
3044
- tokenId,
3045
- collectionAddress,
3046
- onOfferClick
3047
- }) => {
3048
- const { address: accountAddress } = useAccount12();
3049
- const { data: balance } = useBalanceOfCollectible({
3050
- chainId: String(chainId),
3051
- collectionAddress,
3052
- collectableId: tokenId,
3053
- userAddress: accountAddress
3054
- });
3055
- const { data: lowestListing } = useLowestListing({
3056
- chainId: String(chainId),
3057
- collectionAddress,
3058
- tokenId
3059
- });
3060
- const { data: highestOffer } = useHighestOffer({
3061
- chainId: String(chainId),
3062
- collectionAddress,
3063
- tokenId
3064
- });
3065
- const { data: currencies } = useCurrencies({
3066
- chainId: String(chainId),
3067
- collectionAddress,
3068
- query: {
3069
- enabled: !!lowestListing?.order
3070
- }
3071
- });
3072
- const currency = currencies?.find(
3073
- (currency2) => currency2.contractAddress === lowestListing?.order?.priceCurrencyAddress
3074
- );
3075
- if (name.length > 15 && highestOffer?.order) {
3076
- name = name.substring(0, 13) + "...";
3077
- }
3078
- if (name.length > 17 && !highestOffer?.order) {
3079
- name = name.substring(0, 17) + "...";
3080
- }
3081
- return /* @__PURE__ */ jsxs22(
3082
- Box20,
3083
- {
3084
- display: "flex",
3085
- flexDirection: "column",
3086
- gap: "2",
3087
- padding: "4",
3088
- whiteSpace: "nowrap",
3089
- position: "relative",
3090
- className: accountAddress ? footer.animated : footer.static,
3091
- children: [
3092
- /* @__PURE__ */ jsxs22(
3093
- Box20,
3094
- {
3095
- display: "flex",
3096
- alignItems: "center",
3097
- justifyContent: "space-between",
3098
- position: "relative",
3099
- children: [
3100
- /* @__PURE__ */ jsx30(Text17, { color: "text100", fontSize: "normal", fontWeight: "bold", textAlign: "left", children: name }),
3101
- highestOffer?.order && onOfferClick && /* @__PURE__ */ jsx30(
3102
- IconButton6,
3103
- {
3104
- variant: "primary",
3105
- className: offerBellButton,
3106
- onClick: (e) => {
3107
- e.stopPropagation();
3108
- onOfferClick?.();
3109
- },
3110
- icon: Bell_default
3111
- }
3112
- )
3113
- ]
3114
- }
3115
- ),
3116
- lowestListing?.order && currency && /* @__PURE__ */ jsxs22(Box20, { display: "flex", alignItems: "center", gap: "1", children: [
3117
- /* @__PURE__ */ jsx30(Image4, { src: currency?.imageUrl, width: "3", height: "3" }),
3118
- /* @__PURE__ */ jsxs22(Text17, { color: "text100", fontSize: "small", fontWeight: "bold", textAlign: "left", children: [
3119
- formatUnits4(
3120
- BigInt(lowestListing.order.priceAmount),
3121
- currency.decimals
3122
- ),
3123
- " "
3124
- ] })
3125
- ] }),
3126
- balance && type !== "ERC721" /* ERC721 */ && /* @__PURE__ */ jsx30(Pill, { text: `Owned: ${balance}` }),
3127
- type === "ERC721" /* ERC721 */ && /* @__PURE__ */ jsx30(Pill, { text: "ERC-721" })
3128
- ]
3129
- }
3130
- );
3131
- };
3132
-
3133
- // src/react/ui/images/chess-tile.png
3134
- var chess_tile_default = "./chess-tile-6BS5MQT5.png";
3135
-
3136
- // src/react/ui/components/collectible-card/CollectibleCard.tsx
3137
- import { useAccount as useAccount13 } from "wagmi";
3138
- import { jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
3139
- function CollectibleSkeleton() {
3140
- return /* @__PURE__ */ jsxs23(
3141
- Box21,
3142
- {
3143
- display: "flex",
3144
- flexDirection: "column",
3145
- gap: "3",
3146
- alignItems: "center",
3147
- overflow: "hidden",
3148
- children: [
3149
- /* @__PURE__ */ jsx31(
3150
- Skeleton6,
3151
- {
3152
- size: "lg",
3153
- style: { width: "100%", height: 164, borderRadius: 0, paddingTop: 16 }
3154
- }
3155
- ),
3156
- /* @__PURE__ */ jsxs23(
3157
- Box21,
3158
- {
3159
- display: "flex",
3160
- flexDirection: "column",
3161
- gap: "2",
3162
- paddingX: "4",
3163
- paddingBottom: "4",
3164
- children: [
3165
- /* @__PURE__ */ jsx31(Skeleton6, { size: "lg" }),
3166
- /* @__PURE__ */ jsx31(Skeleton6, { size: "sm" })
3167
- ]
3168
- }
3169
- )
3170
- ]
3171
- }
3172
- );
3173
- }
3174
- function CollectibleCard({
3175
- tokenId,
3176
- chainId,
3177
- collectionAddress,
3178
- onCollectibleClick,
3179
- onOfferClick
3180
- }) {
3181
- const { data: collectible, isLoading: collectibleLoading } = useCollectible({
3182
- chainId: String(chainId),
3183
- collectionAddress,
3184
- collectibleId: tokenId
3185
- });
3186
- const { data: collection } = useCollection({
3187
- chainId: String(chainId),
3188
- collectionAddress
3189
- });
3190
- if (collectibleLoading || !collectible || !collection) {
3191
- return /* @__PURE__ */ jsx31(CollectibleSkeleton, {});
3192
- }
3193
- return /* @__PURE__ */ jsx31(
3194
- Box21,
3195
- {
3196
- className: collectibleCard,
3197
- borderRadius: "md",
3198
- overflow: "hidden",
3199
- background: "backgroundPrimary",
3200
- children: /* @__PURE__ */ jsx31(
3201
- CardWrapper,
3202
- {
3203
- name: collectible.name,
3204
- type: collection.type,
3205
- imageSrc: collectible.image,
3206
- tokenId,
3207
- chainId: String(chainId),
3208
- collectionAddress,
3209
- marketplaceSource: collectible.external_url,
3210
- onCollectibleClick,
3211
- onOfferClick
3212
- }
3213
- )
3214
- }
3215
- );
3216
- }
3217
- var CardWrapper = ({
3218
- name,
3219
- type,
3220
- imageSrc,
3221
- tokenId,
3222
- chainId,
3223
- collectionAddress,
3224
- marketplaceSource,
3225
- onCollectibleClick,
3226
- onOfferClick
3227
- }) => {
3228
- const { address: accountAddress } = useAccount13();
3229
- const [loadingError, setLoadingError] = useState6(false);
3230
- return /* @__PURE__ */ jsx31(
3231
- Box21,
3232
- {
3233
- display: "flex",
3234
- flexDirection: "column",
3235
- alignItems: "flex-start",
3236
- position: "relative",
3237
- width: "full",
3238
- height: "full",
3239
- zIndex: "10",
3240
- overflow: "hidden",
3241
- onClick: onCollectibleClick,
3242
- as: "button",
3243
- border: "none",
3244
- padding: "0",
3245
- className: collectibleTileWrapper,
3246
- children: /* @__PURE__ */ jsxs23("article", { style: { width: "100%" }, children: [
3247
- marketplaceSource && /* @__PURE__ */ jsx31(
3248
- IconButton7,
3249
- {
3250
- as: "a",
3251
- href: marketplaceSource,
3252
- size: "sm",
3253
- backdropFilter: "blur",
3254
- variant: "glass",
3255
- onClick: (e) => {
3256
- e.stopPropagation();
3257
- },
3258
- position: "absolute",
3259
- top: "2",
3260
- left: "2",
3261
- icon: DiamondEye_default
3262
- }
3263
- ),
3264
- /* @__PURE__ */ jsx31(
3265
- "img",
3266
- {
3267
- src: loadingError ? chess_tile_default : imageSrc || chess_tile_default,
3268
- alt: name,
3269
- className: collectibleImage,
3270
- onError: () => setLoadingError(true)
3271
- }
3272
- ),
3273
- /* @__PURE__ */ jsx31(
3274
- Footer,
3275
- {
3276
- name,
3277
- type,
3278
- tokenId,
3279
- chainId,
3280
- collectionAddress,
3281
- onOfferClick
3282
- }
3283
- ),
3284
- accountAddress && /* @__PURE__ */ jsx31(
3285
- Box21,
3286
- {
3287
- display: "flex",
3288
- alignItems: "center",
3289
- justifyContent: "center",
3290
- padding: "2",
3291
- className: actionWrapper,
3292
- children: /* @__PURE__ */ jsx31(
3293
- ActionButton,
3294
- {
3295
- chainId: String(chainId),
3296
- collectionAddress,
3297
- tokenId
3298
- }
3299
- )
3300
- }
3301
- )
3302
- ] })
3303
- }
3304
- );
3305
- };
3306
-
3307
- export {
3308
- useCreateListingModal,
3309
- useMakeOfferModal,
3310
- useSellModal,
3311
- useSuccessfulPurchaseModal,
3312
- useTransferModal,
3313
- ModalProvider,
3314
- CollectibleCard
3315
- };
3316
- //# sourceMappingURL=chunk-QXLZPSSR.js.map