@0xsequence/marketplace-sdk 0.3.2 → 0.3.4

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 (139) hide show
  1. package/dist/{chunk-NII6JJGH.js → chunk-3CXEYH2I.js} +5 -3
  2. package/dist/chunk-3CXEYH2I.js.map +1 -0
  3. package/dist/{chunk-GJAKQ5Q3.js → chunk-53Q7BNZH.js} +8 -2
  4. package/dist/chunk-53Q7BNZH.js.map +1 -0
  5. package/dist/{chunk-O7UQGT43.js → chunk-6LQST3KZ.js} +553 -283
  6. package/dist/chunk-6LQST3KZ.js.map +1 -0
  7. package/dist/{chunk-GZG2QO64.js → chunk-D3HRXVYJ.js} +72 -21
  8. package/dist/chunk-D3HRXVYJ.js.map +1 -0
  9. package/dist/{chunk-4YU2UPYH.js → chunk-FFCNYF3S.js} +61 -61
  10. package/dist/chunk-FFCNYF3S.js.map +1 -0
  11. package/dist/chunk-G2FYRJMK.js +38 -0
  12. package/dist/chunk-G2FYRJMK.js.map +1 -0
  13. package/dist/{chunk-WA433WAJ.js → chunk-L6GSYPCR.js} +20 -6
  14. package/dist/chunk-L6GSYPCR.js.map +1 -0
  15. package/dist/{chunk-SPW24Y7I.js → chunk-OUZ42I6B.js} +7 -2
  16. package/dist/chunk-OUZ42I6B.js.map +1 -0
  17. package/dist/{chunk-22NLQ3AS.js → chunk-PMDJARYX.js} +1081 -980
  18. package/dist/chunk-PMDJARYX.js.map +1 -0
  19. package/dist/chunk-T2AMWIKD.js +277 -0
  20. package/dist/chunk-T2AMWIKD.js.map +1 -0
  21. package/dist/{chunk-G33554LK.js → chunk-WQCWBXBM.js} +8 -16
  22. package/dist/chunk-WQCWBXBM.js.map +1 -0
  23. package/dist/index.css +40 -0
  24. package/dist/index.d.ts +2 -2
  25. package/dist/index.js +172 -71
  26. package/dist/index.js.map +1 -1
  27. package/dist/{marketplace.gen-BLP7822q.d.ts → marketplace.gen-jdKqutnd.d.ts} +57 -18
  28. package/dist/react/_internal/api/index.d.ts +4 -2
  29. package/dist/react/_internal/api/index.js +8 -3
  30. package/dist/react/_internal/index.d.ts +3 -3
  31. package/dist/react/_internal/index.js +9 -4
  32. package/dist/react/_internal/wagmi/index.js +2 -1
  33. package/dist/react/hooks/index.d.ts +285 -12
  34. package/dist/react/hooks/index.js +14 -5
  35. package/dist/react/index.css +29 -29
  36. package/dist/react/index.css.map +1 -1
  37. package/dist/react/index.d.ts +4 -4
  38. package/dist/react/index.js +17 -8
  39. package/dist/react/ssr/index.js +55 -4
  40. package/dist/react/ssr/index.js.map +1 -1
  41. package/dist/react/ui/components/index.css +13 -13
  42. package/dist/react/ui/components/index.css.map +1 -1
  43. package/dist/react/ui/components/index.d.ts +3 -3
  44. package/dist/react/ui/components/index.js +9 -8
  45. package/dist/react/ui/icons/index.js +1 -1
  46. package/dist/react/ui/icons/index.js.map +1 -1
  47. package/dist/react/ui/index.css +29 -29
  48. package/dist/react/ui/index.css.map +1 -1
  49. package/dist/react/ui/index.d.ts +3 -3
  50. package/dist/react/ui/index.js +9 -8
  51. package/dist/react/ui/modals/_internal/components/actionModal/index.js +3 -2
  52. package/dist/react/ui/styles/index.d.ts +1 -1
  53. package/dist/{services-C9-lvWcC.d.ts → services-C2O-7p_M.d.ts} +2 -2
  54. package/dist/styles/index.css +40 -0
  55. package/dist/styles/index.css.map +1 -1
  56. package/dist/styles/index.d.ts +9 -2
  57. package/dist/styles/index.js +14 -2
  58. package/dist/types/index.d.ts +2 -2
  59. package/dist/types/index.js +3 -2
  60. package/dist/{types-QqXjNuUP.d.ts → types-BlDoGvJV.d.ts} +1 -1
  61. package/dist/utils/index.d.ts +2 -2
  62. package/dist/utils/index.js +2 -1
  63. package/package.json +18 -15
  64. package/src/react/_internal/api/marketplace.gen.ts +85 -20
  65. package/src/react/_internal/api/query-keys.ts +2 -0
  66. package/src/react/_internal/api/services.ts +4 -3
  67. package/src/react/_internal/api/zod-schema.ts +20 -0
  68. package/src/react/_internal/transaction-machine/execute-transaction.ts +311 -224
  69. package/src/react/_internal/transaction-machine/logger.ts +66 -0
  70. package/src/react/_internal/transaction-machine/useTransactionMachine.ts +69 -19
  71. package/src/react/_internal/wagmi/embedded.ts +2 -2
  72. package/src/react/hooks/index.ts +2 -0
  73. package/src/react/hooks/options/marketplaceConfigOptions.ts +6 -2
  74. package/src/react/hooks/useBuyCollectable.tsx +14 -8
  75. package/src/react/hooks/useCancelOrder.tsx +4 -3
  76. package/src/react/hooks/useCheckoutOptions.tsx +2 -2
  77. package/src/react/hooks/useConfig.tsx +2 -3
  78. package/src/react/hooks/useCountListingsForCollectible.tsx +64 -0
  79. package/src/react/hooks/useCountOffersForCollectible.tsx +64 -0
  80. package/src/react/hooks/useCreateListing.tsx +13 -14
  81. package/src/react/hooks/useCurrencies.tsx +9 -8
  82. package/src/react/hooks/useCurrency.tsx +6 -6
  83. package/src/react/hooks/useGenerateBuyTransaction.tsx +3 -3
  84. package/src/react/hooks/useMakeOffer.tsx +14 -13
  85. package/src/react/hooks/useRoyaltyPercentage.tsx +1 -1
  86. package/src/react/hooks/useSell.tsx +12 -12
  87. package/src/react/hooks/useTransferTokens.tsx +2 -1
  88. package/src/react/ui/components/_internals/action-button/ActionButton.tsx +3 -2
  89. package/src/react/ui/components/_internals/custom-select/CustomSelect.tsx +4 -4
  90. package/src/react/ui/components/collectible-card/CollectibleCard.tsx +2 -2
  91. package/src/react/ui/components/collectible-card/Footer.tsx +33 -29
  92. package/src/react/ui/icons/ArrowUp.tsx +1 -1
  93. package/src/react/ui/modals/BuyModal/_store.ts +8 -6
  94. package/src/react/ui/modals/BuyModal/index.tsx +120 -81
  95. package/src/react/ui/modals/CreateListingModal/_store.ts +1 -0
  96. package/src/react/ui/modals/CreateListingModal/index.tsx +34 -14
  97. package/src/react/ui/modals/MakeOfferModal/_store.ts +2 -0
  98. package/src/react/ui/modals/MakeOfferModal/index.tsx +21 -11
  99. package/src/react/ui/modals/SellModal/index.tsx +21 -13
  100. package/src/react/ui/modals/SuccessfulPurchaseModal/_store.ts +1 -1
  101. package/src/react/ui/modals/SuccessfulPurchaseModal/index.tsx +1 -1
  102. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +12 -7
  103. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx +2 -1
  104. package/src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx +2 -2
  105. package/src/react/ui/modals/TransferModal/styles.css.ts +1 -1
  106. package/src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx +1 -1
  107. package/src/react/ui/modals/_internal/components/actionModal/LoadingModal.tsx +1 -1
  108. package/src/react/ui/modals/_internal/components/alertMessage/index.tsx +7 -2
  109. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +2 -7
  110. package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +2 -1
  111. package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +1 -0
  112. package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +42 -102
  113. package/src/react/ui/modals/_internal/components/switchChainModal/styles.css.ts +1 -1
  114. package/src/react/ui/modals/_internal/components/timeAgo/index.tsx +1 -1
  115. package/src/react/ui/modals/_internal/components/tokenPreview/index.tsx +1 -1
  116. package/src/react/ui/modals/_internal/components/transaction-footer/index.tsx +32 -11
  117. package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +2 -2
  118. package/src/react/ui/modals/_internal/components/transactionHeader/index.tsx +14 -2
  119. package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +17 -5
  120. package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +12 -4
  121. package/src/react/ui/modals/_internal/components/transactionStatusModal/styles.css.ts +1 -1
  122. package/src/react/ui/modals/modal-provider.tsx +3 -3
  123. package/src/styles/index.ts +3 -0
  124. package/src/utils/_internal/error/base.ts +32 -0
  125. package/src/utils/_internal/error/context.ts +13 -0
  126. package/src/utils/_internal/error/transaction.ts +369 -0
  127. package/src/utils/get-public-rpc-client.ts +4 -1
  128. package/tsconfig.tsbuildinfo +1 -1
  129. package/tsup.config.ts +3 -0
  130. package/dist/chess-tile-6BS5MQT5.png +0 -0
  131. package/dist/chunk-22NLQ3AS.js.map +0 -1
  132. package/dist/chunk-4YU2UPYH.js.map +0 -1
  133. package/dist/chunk-G33554LK.js.map +0 -1
  134. package/dist/chunk-GJAKQ5Q3.js.map +0 -1
  135. package/dist/chunk-GZG2QO64.js.map +0 -1
  136. package/dist/chunk-NII6JJGH.js.map +0 -1
  137. package/dist/chunk-O7UQGT43.js.map +0 -1
  138. package/dist/chunk-SPW24Y7I.js.map +0 -1
  139. package/dist/chunk-WA433WAJ.js.map +0 -1
@@ -7,10 +7,14 @@ import {
7
7
  MinusIcon_default,
8
8
  PlusIcon_default,
9
9
  PositiveCircleIcon_default
10
- } from "./chunk-4YU2UPYH.js";
10
+ } from "./chunk-FFCNYF3S.js";
11
11
  import {
12
+ actionWrapper,
12
13
  closeButton,
13
14
  closeButton2,
15
+ collectibleCard,
16
+ collectibleImage,
17
+ collectibleTileWrapper,
14
18
  collectiblesGrid,
15
19
  collectiblesGridImage,
16
20
  collectiblesGridImagePale,
@@ -20,15 +24,18 @@ import {
20
24
  dialogContent,
21
25
  dialogOverlay,
22
26
  dialogOverlay2,
27
+ footer,
28
+ offerBellButton,
23
29
  priceInputCurrencyImage,
24
30
  priceInputWrapper,
25
31
  quantityInputWrapper,
26
32
  tokenPreview,
27
33
  transferModalContent
28
- } from "./chunk-WA433WAJ.js";
34
+ } from "./chunk-L6GSYPCR.js";
29
35
  import {
30
36
  AlertMessage,
31
37
  switchChainModal_default,
38
+ useBalanceOfCollectible,
32
39
  useBuyCollectable,
33
40
  useCollectible,
34
41
  useCollection,
@@ -41,412 +48,309 @@ import {
41
48
  useSwitchChainModal,
42
49
  useTransactionMachine,
43
50
  useTransferTokens
44
- } from "./chunk-O7UQGT43.js";
51
+ } from "./chunk-6LQST3KZ.js";
45
52
  import {
46
53
  iconVariants
47
54
  } from "./chunk-SBVLWSRZ.js";
48
55
  import {
49
56
  calculatePriceDifferencePercentage,
50
57
  truncateMiddle
51
- } from "./chunk-SPW24Y7I.js";
58
+ } from "./chunk-OUZ42I6B.js";
52
59
  import {
53
60
  balanceQueries,
54
61
  collectableKeys,
55
62
  getQueryClient
56
- } from "./chunk-GZG2QO64.js";
63
+ } from "./chunk-D3HRXVYJ.js";
64
+ import {
65
+ InvalidContractTypeError,
66
+ InvalidStepError
67
+ } from "./chunk-T2AMWIKD.js";
57
68
 
58
69
  // src/react/ui/modals/modal-provider.tsx
59
70
  import { observer as observer14 } from "@legendapp/state/react";
60
71
 
61
- // src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
62
- import {
63
- CloseIcon,
64
- IconButton,
65
- Skeleton,
66
- Text as Text4
67
- } from "@0xsequence/design-system";
68
- import { observer as observer2 } from "@legendapp/state/react";
69
- import { Close, Content, Overlay, Portal, Root } from "@radix-ui/react-dialog";
70
- import { useEffect as useEffect2 } from "react";
71
- import { useTransactionReceipt } from "wagmi";
72
-
73
- // src/react/ui/modals/_internal/components/transaction-footer/index.tsx
74
- import { Box, Spinner, Text } from "@0xsequence/design-system";
72
+ // src/react/ui/modals/Account/index.tsx
73
+ import { Box, Button, Modal, Text } from "@0xsequence/design-system";
74
+ import { observable } from "@legendapp/state";
75
+ import { observer } from "@legendapp/state/react";
76
+ import { useAccount } from "wagmi";
75
77
  import { jsx, jsxs } from "react/jsx-runtime";
76
- function TransactionFooter({
77
- transactionHash,
78
- isConfirming,
79
- isConfirmed,
80
- isFailed
81
- }) {
82
- const icon = isConfirming && /* @__PURE__ */ jsx(Spinner, { size: "md" }) || isConfirmed && /* @__PURE__ */ jsx(PositiveCircleIcon_default, { size: "md" });
83
- const title = isConfirming && "Processing transaction" || isConfirmed && "Transaction complete" || isFailed && "Transaction failed";
84
- return /* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", children: [
85
- icon,
86
- /* @__PURE__ */ jsx(Text, { color: "text50", fontSize: "normal", fontWeight: "medium", marginLeft: "2", children: title }),
87
- /* @__PURE__ */ jsx(
88
- Text,
89
- {
90
- color: "polygonLight",
91
- flexGrow: "1",
92
- textAlign: "right",
93
- fontSize: "normal",
94
- fontWeight: "medium",
95
- marginLeft: "2",
96
- children: truncateMiddle(transactionHash, 4, 4)
97
- }
98
- )
78
+ var accountModalOpen$ = observable(false);
79
+ var AccountModal = observer(function AccountModal2() {
80
+ const { address } = useAccount();
81
+ return accountModalOpen$.get() && /* @__PURE__ */ jsxs(Modal, { children: [
82
+ /* @__PURE__ */ jsxs(Box, { children: [
83
+ /* @__PURE__ */ jsx(Text, { children: "Wallet address" }),
84
+ /* @__PURE__ */ jsx(Text, { children: address })
85
+ ] }),
86
+ /* @__PURE__ */ jsx(Button, { label: "Sign out" })
99
87
  ] });
100
- }
88
+ });
101
89
 
102
- // src/react/ui/modals/_internal/components/transactionPreview/index.tsx
103
- import { Box as Box3, Image, NetworkImage, Text as Text3 } from "@0xsequence/design-system";
104
- import { observer } from "@legendapp/state/react";
105
- import { formatUnits } from "viem";
90
+ // src/react/ui/modals/BuyModal/index.tsx
91
+ import { Show, observer as observer2, useSelector } from "@legendapp/state/react";
92
+ import { useEffect } from "react";
106
93
 
107
- // src/react/ui/modals/_internal/components/timeAgo/index.tsx
108
- import { Box as Box2, Text as Text2 } from "@0xsequence/design-system";
109
- import { formatDistanceToNow } from "date-fns";
110
- import { useState, useEffect } from "react";
111
- import { jsx as jsx2 } from "react/jsx-runtime";
112
- function TimeAgo({ date }) {
113
- const [timeAgo, setTimeAgo] = useState("");
114
- useEffect(() => {
115
- const interval = setInterval(() => {
116
- setTimeAgo(formatDistanceToNow(date));
117
- }, 1e3);
118
- return () => clearInterval(interval);
119
- }, [date]);
120
- return /* @__PURE__ */ jsx2(
121
- Box2,
122
- {
123
- flexGrow: "1",
124
- display: "flex",
125
- alignItems: "center",
126
- justifyContent: "flex-end",
127
- children: /* @__PURE__ */ jsx2(Text2, { color: "text50", fontSize: "small", children: timeAgo })
94
+ // src/react/ui/modals/_internal/components/quantityInput/index.tsx
95
+ import { Box as Box2, IconButton, NumericInput } from "@0xsequence/design-system";
96
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
97
+ function QuantityInput({
98
+ $quantity,
99
+ $invalidQuantity,
100
+ decimals,
101
+ maxQuantity
102
+ }) {
103
+ function handleChangeQuantity(value) {
104
+ const formattedValue = formatQuantity(value);
105
+ $quantity.set(formattedValue);
106
+ validateQuantity(formattedValue);
107
+ }
108
+ function validateQuantity(value) {
109
+ if (!value || value.trim() === "" || isNaN(Number(value))) {
110
+ $invalidQuantity.set(true);
111
+ return;
128
112
  }
129
- );
113
+ const numValue = Number(value);
114
+ $invalidQuantity.set(numValue <= 0 || numValue > Number(maxQuantity));
115
+ }
116
+ function formatQuantity(value) {
117
+ if (!value || isNaN(Number(value))) {
118
+ return "0";
119
+ }
120
+ if (Number(value) > Number(maxQuantity)) {
121
+ return maxQuantity;
122
+ }
123
+ return value;
124
+ }
125
+ function handleIncrement() {
126
+ const currentValue = Number(quantity) || 0;
127
+ const maxValue = Number(maxQuantity);
128
+ const newValue = Math.min(currentValue + 1, maxValue);
129
+ handleChangeQuantity(newValue.toString());
130
+ return newValue.toString();
131
+ }
132
+ function handleDecrement() {
133
+ const minValue = decimals ? Number(`0.${"0".repeat(decimals - 1)}1`) : 1;
134
+ const currentValue = Number(quantity) || 0;
135
+ const newValue = Math.max(currentValue - 1, minValue);
136
+ const stringValue = newValue.toString();
137
+ handleChangeQuantity(stringValue);
138
+ return stringValue;
139
+ }
140
+ const quantity = $quantity.get();
141
+ const invalidQuantity = $invalidQuantity.get();
142
+ return /* @__PURE__ */ jsxs2(Box2, { className: quantityInputWrapper, children: [
143
+ /* @__PURE__ */ jsx2(
144
+ NumericInput,
145
+ {
146
+ name: "quantity",
147
+ decimals: decimals || 0,
148
+ paddingLeft: "1",
149
+ label: "Enter quantity",
150
+ labelLocation: "top",
151
+ controls: /* @__PURE__ */ jsxs2(
152
+ Box2,
153
+ {
154
+ display: "flex",
155
+ alignItems: "center",
156
+ gap: "1",
157
+ marginRight: "2",
158
+ children: [
159
+ /* @__PURE__ */ jsx2(
160
+ IconButton,
161
+ {
162
+ disabled: !quantity || Number(quantity) <= 0,
163
+ onClick: handleDecrement,
164
+ background: "buttonGlass",
165
+ size: "xs",
166
+ icon: MinusIcon_default
167
+ }
168
+ ),
169
+ /* @__PURE__ */ jsx2(
170
+ IconButton,
171
+ {
172
+ onClick: handleIncrement,
173
+ background: "buttonGlass",
174
+ size: "xs",
175
+ icon: PlusIcon_default
176
+ }
177
+ )
178
+ ]
179
+ }
180
+ ),
181
+ numeric: true,
182
+ value: quantity,
183
+ onChange: (e) => handleChangeQuantity(e.target.value),
184
+ width: "full"
185
+ }
186
+ ),
187
+ invalidQuantity && /* @__PURE__ */ jsx2(Box2, { color: "negative", fontSize: "small", children: invalidQuantity })
188
+ ] });
130
189
  }
131
190
 
132
- // src/react/ui/modals/_internal/components/transactionStatusModal/store.ts
133
- import { observable } from "@legendapp/state";
191
+ // src/react/ui/modals/BuyModal/_store.ts
192
+ import { observable as observable2 } from "@legendapp/state";
134
193
  var initialState = {
135
194
  isOpen: false,
136
195
  open: ({
137
- hash,
138
- price,
139
- collectionAddress,
140
- chainId,
141
- tokenId,
142
- getTitle,
143
- getMessage: getMessage2,
144
- type,
145
196
  callbacks,
146
- queriesToInvalidate
197
+ defaultCallbacks,
198
+ ...args
147
199
  }) => {
148
- transactionStatusModal$.state.set({
149
- ...transactionStatusModal$.state.get(),
150
- hash,
151
- price,
152
- collectionAddress,
153
- chainId,
154
- tokenId,
155
- getTitle,
156
- getMessage: getMessage2,
157
- type,
158
- callbacks,
159
- queriesToInvalidate
200
+ buyModal$.state.set({
201
+ quantity: args.order.quantityAvailableFormatted,
202
+ order: args.order,
203
+ modalId: buyModal$.state.modalId.get() + 1,
204
+ invalidQuantity: false
160
205
  });
161
- transactionStatusModal$.isOpen.set(true);
206
+ buyModal$.callbacks.set(callbacks || defaultCallbacks);
207
+ buyModal$.isOpen.set(true);
162
208
  },
163
209
  close: () => {
164
- transactionStatusModal$.isOpen.set(false);
165
- transactionStatusModal$.state.set({
166
- ...initialState.state
167
- });
210
+ buyModal$.isOpen.set(false);
168
211
  },
169
212
  state: {
170
- hash: void 0,
171
- status: "PENDING",
172
- price: void 0,
173
- collectionAddress: "",
174
- chainId: "",
175
- tokenId: "",
176
- getTitle: void 0,
177
- getMessage: void 0,
178
- type: void 0
179
- }
180
- };
181
- var transactionStatusModal$ = observable(initialState);
182
-
183
- // src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx
184
- import { useMemo } from "react";
185
-
186
- // src/react/ui/modals/_internal/components/transactionPreview/consts.ts
187
- var TRANSACTION_TITLES = {
188
- sell: {
189
- confirming: "Selling",
190
- confirmed: "Sold",
191
- failed: "Sale failed"
192
- },
193
- createListing: {
194
- confirming: "Creating listing",
195
- confirmed: "Listed",
196
- failed: "Listing failed"
197
- },
198
- createOffer: {
199
- confirming: "Creating offer",
200
- confirmed: "Offer created",
201
- failed: "Offer failed"
202
- },
203
- buy: {
204
- confirming: "Buying",
205
- confirmed: "Bought",
206
- failed: "Purchase failed"
213
+ order: void 0,
214
+ quantity: "1",
215
+ modalId: 0,
216
+ invalidQuantity: false
207
217
  },
208
- transfer: {
209
- confirming: "Transferring",
210
- confirmed: "Transferred",
211
- failed: "Transfer failed"
212
- }
218
+ callbacks: void 0
213
219
  };
220
+ var buyModal$ = observable2(initialState);
214
221
 
215
- // src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx
216
- function useTransactionPreviewTitle(status, type) {
217
- return useMemo(() => {
218
- if (!type) return "";
219
- const { isConfirming, isConfirmed, isFailed } = status;
220
- const titles = TRANSACTION_TITLES[type];
221
- if (isConfirming) return titles.confirming;
222
- if (isConfirmed) return titles.confirmed;
223
- if (isFailed) return titles.failed;
224
- return "";
225
- }, [status, type]);
226
- }
227
-
228
- // src/react/ui/modals/_internal/components/transactionPreview/index.tsx
229
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
230
- var TransactionPreview = observer(
231
- ({
232
- price,
222
+ // src/react/ui/modals/BuyModal/index.tsx
223
+ import { jsx as jsx3 } from "react/jsx-runtime";
224
+ var useBuyModal = (callbacks) => {
225
+ return {
226
+ show: (args) => buyModal$.open({ ...args, defaultCallbacks: callbacks }),
227
+ close: () => buyModal$.close()
228
+ };
229
+ };
230
+ var BuyModal = () => /* @__PURE__ */ jsx3(Show, { if: buyModal$.isOpen, children: /* @__PURE__ */ jsx3(BuyModalContent, {}) });
231
+ var BuyModalContent = () => {
232
+ const chainId = String(useSelector(buyModal$.state.order.chainId));
233
+ const collectionAddress = useSelector(
234
+ buyModal$.state.order.collectionContractAddress
235
+ );
236
+ const collectibleId = useSelector(buyModal$.state.order.tokenId);
237
+ const modalId = useSelector(buyModal$.state.modalId);
238
+ const { data: collection } = useCollection({
239
+ chainId,
240
+ collectionAddress
241
+ });
242
+ const { buy, isLoading } = useBuyCollectable({
243
+ chainId,
233
244
  collectionAddress,
245
+ onError: buyModal$.callbacks.get()?.onError,
246
+ onSuccess: (hash) => {
247
+ buyModal$.callbacks.get()?.onSuccess?.(hash);
248
+ buyModal$.close();
249
+ }
250
+ });
251
+ const { data: collectable } = useCollectible({
234
252
  chainId,
235
- collectible,
236
- currencyImageUrl,
237
- isConfirming,
238
- isConfirmed,
239
- isFailed
240
- }) => {
241
- const { type } = transactionStatusModal$.state.get();
242
- const title = useTransactionPreviewTitle(
243
- { isConfirmed, isConfirming, isFailed },
244
- type
245
- );
246
- const { data: collection } = useCollection({
253
+ collectionAddress,
254
+ collectibleId
255
+ });
256
+ if (modalId == 0 || !collection || !collectable || !buy) return null;
257
+ return collection.type === "ERC721" /* ERC721 */ ? /* @__PURE__ */ jsx3(
258
+ CheckoutModal,
259
+ {
260
+ buy,
261
+ collectable,
262
+ order: buyModal$.state.order.get(),
263
+ isLoading
264
+ },
265
+ modalId
266
+ ) : /* @__PURE__ */ jsx3(
267
+ ERC1155QuantityModal,
268
+ {
269
+ buy,
270
+ collectable,
271
+ order: buyModal$.state.order.get(),
272
+ chainId,
247
273
  collectionAddress,
248
- chainId
249
- });
250
- const collectibleImage2 = collectible.image;
251
- const collectibleName = collectible.name;
252
- const collectionName = collection?.name;
253
- const priceFormatted = price ? formatUnits(BigInt(price.amountRaw), price.currency.decimals) : void 0;
254
- return /* @__PURE__ */ jsxs2(Box3, { padding: "3", background: "backgroundSecondary", borderRadius: "md", children: [
255
- /* @__PURE__ */ jsxs2(Box3, { display: "flex", alignItems: "center", children: [
256
- /* @__PURE__ */ jsx3(
257
- Text3,
274
+ collectibleId,
275
+ isLoading
276
+ }
277
+ );
278
+ };
279
+ function CheckoutModal({
280
+ buy,
281
+ collectable,
282
+ order,
283
+ isLoading
284
+ }) {
285
+ useEffect(() => {
286
+ const executeBuy = () => {
287
+ if (isLoading) return;
288
+ buy({
289
+ orderId: order.orderId,
290
+ collectableDecimals: collectable.decimals || 0,
291
+ quantity: "1",
292
+ marketplace: order.marketplace
293
+ });
294
+ };
295
+ executeBuy();
296
+ }, [isLoading]);
297
+ return null;
298
+ }
299
+ var ERC1155QuantityModal = observer2(
300
+ ({ buy, collectable, order }) => {
301
+ buyModal$.state.quantity.set(
302
+ Math.max(Number(order.quantityRemaining), 1).toString()
303
+ );
304
+ return /* @__PURE__ */ jsx3(
305
+ ActionModal,
306
+ {
307
+ store: buyModal$,
308
+ onClose: () => buyModal$.close(),
309
+ title: "Select Quantity",
310
+ ctas: [
258
311
  {
259
- color: "text50",
260
- fontSize: "small",
261
- fontWeight: "medium",
262
- marginRight: "1",
263
- children: title
312
+ label: "Select Quantity",
313
+ onClick: () => {
314
+ buy({
315
+ quantity: buyModal$.state.quantity.get(),
316
+ orderId: order.orderId,
317
+ collectableDecimals: collectable.decimals || 0,
318
+ marketplace: order.marketplace
319
+ });
320
+ buyModal$.close();
321
+ }
264
322
  }
265
- ),
266
- /* @__PURE__ */ jsx3(NetworkImage, { chainId: Number(chainId), size: "xs" }),
267
- isConfirming && /* @__PURE__ */ jsx3(TimeAgo, { date: /* @__PURE__ */ new Date() })
268
- ] }),
269
- /* @__PURE__ */ jsxs2(Box3, { display: "flex", alignItems: "center", marginTop: "2", children: [
270
- /* @__PURE__ */ jsx3(
271
- Image,
323
+ ],
324
+ children: /* @__PURE__ */ jsx3(
325
+ QuantityInput,
272
326
  {
273
- src: collectibleImage2,
274
- alt: collectibleName,
275
- width: "9",
276
- height: "9",
277
- borderRadius: "xs",
278
- marginRight: "3"
279
- }
280
- ),
281
- /* @__PURE__ */ jsxs2(
282
- Box3,
283
- {
284
- display: "flex",
285
- flexDirection: "column",
286
- alignItems: "flex-start",
287
- gap: "0.5",
288
- children: [
289
- /* @__PURE__ */ jsx3(Text3, { color: "text80", fontSize: "small", fontWeight: "medium", children: collectibleName }),
290
- /* @__PURE__ */ jsx3(Text3, { color: "text100", fontSize: "small", children: collectionName })
291
- ]
292
- }
293
- ),
294
- price && /* @__PURE__ */ jsxs2(
295
- Box3,
296
- {
297
- flexGrow: "1",
298
- display: "flex",
299
- alignItems: "center",
300
- justifyContent: "flex-end",
301
- gap: "1",
302
- children: [
303
- /* @__PURE__ */ jsx3(Image, { src: currencyImageUrl, width: "3", height: "3" }),
304
- /* @__PURE__ */ jsxs2(Text3, { color: "text80", fontSize: "small", fontWeight: "medium", children: [
305
- priceFormatted,
306
- " ",
307
- price.currency.symbol
308
- ] })
309
- ]
327
+ $quantity: buyModal$.state.quantity,
328
+ $invalidQuantity: buyModal$.state.invalidQuantity,
329
+ decimals: order.quantityDecimals,
330
+ maxQuantity: order.quantityRemaining
310
331
  }
311
332
  )
312
- ] })
313
- ] });
333
+ }
334
+ );
314
335
  }
315
336
  );
316
- var transactionPreview_default = TransactionPreview;
317
-
318
- // src/react/ui/modals/_internal/components/transactionStatusModal/styles.css.ts
319
- var closeButton3 = "fyvr11lw fyvr1tc fyvr1mo";
320
- var dialogOverlay3 = "fyvr1m0 fyvr1o8 fyvr1qg fyvr1so fyvr11xl fyvr11m0 fyvr11rs";
321
- var transactionStatusModalContent = "modal_dialogContent_wide__1ypl6nt3 modal_dialogContentBase__1ypl6nt1 fyvr11hg fyvr11i4 fyvr11g4 fyvr11gs fyvr11l8 fyvr11wl fyvr11m0 fyvr11rs fyvr1vo fyvr1xs fyvr1zw fyvr1120 fyvr11lc fyvr11mc fyvr11cw";
322
-
323
- // src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
324
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
325
- var useTransactionStatusModal = () => {
326
- return {
327
- show: (args) => transactionStatusModal$.open(args),
328
- close: () => transactionStatusModal$.close()
329
- };
330
- };
331
- var TransactionStatusModal = observer2(() => {
332
- const {
333
- hash,
334
- price,
335
- collectionAddress,
336
- chainId,
337
- tokenId,
338
- getTitle,
339
- getMessage: getMessage2,
340
- callbacks,
341
- queriesToInvalidate
342
- } = transactionStatusModal$.state.get();
343
- const { data: collectible } = useCollectible({
344
- collectionAddress,
345
- chainId,
346
- collectibleId: tokenId
347
- });
348
- const {
349
- isLoading: isConfirming,
350
- isSuccess: isConfirmed,
351
- isError: isFailed,
352
- error
353
- } = useTransactionReceipt({ hash });
354
- const title = getTitle && getTitle({ isConfirmed, isConfirming, isFailed });
355
- const message = getMessage2 && getMessage2({ isConfirmed, isConfirming, isFailed });
356
- const { onUnknownError, onSuccess } = callbacks || {};
357
- const queryClient = getQueryClient();
358
- useEffect2(() => {
359
- if (!transactionStatusModal$.isOpen.get()) return;
360
- let isSubscribed = true;
361
- if (isConfirmed && isSubscribed && onSuccess) {
362
- onSuccess();
363
- }
364
- if (isFailed && isSubscribed && onUnknownError) {
365
- onUnknownError(error);
366
- }
367
- if (isSubscribed && queriesToInvalidate) {
368
- queryClient.invalidateQueries({ queryKey: [...queriesToInvalidate] });
369
- }
370
- return () => {
371
- isSubscribed = false;
372
- };
373
- }, [isConfirmed, isFailed, onSuccess, onUnknownError, error]);
374
- return /* @__PURE__ */ jsx4(Root, { open: transactionStatusModal$.isOpen.get(), children: /* @__PURE__ */ jsxs3(Portal, { children: [
375
- /* @__PURE__ */ jsx4(Overlay, { className: dialogOverlay3 }),
376
- /* @__PURE__ */ jsxs3(Content, { className: transactionStatusModalContent, children: [
377
- title ? /* @__PURE__ */ jsx4(Text4, { fontSize: "large", fontWeight: "bold", color: "text100", children: title }) : /* @__PURE__ */ jsx4(Skeleton, { width: "16", height: "6" }),
378
- message ? /* @__PURE__ */ jsx4(Text4, { fontSize: "small", color: "text80", children: message }) : /* @__PURE__ */ jsx4(Skeleton, { width: "20", height: "4" }),
379
- collectible && /* @__PURE__ */ jsx4(
380
- transactionPreview_default,
381
- {
382
- price,
383
- collectionAddress,
384
- chainId,
385
- collectible,
386
- currencyImageUrl: price?.currency.imageUrl,
387
- isConfirming,
388
- isConfirmed,
389
- isFailed
390
- }
391
- ),
392
- /* @__PURE__ */ jsx4(
393
- TransactionFooter,
394
- {
395
- transactionHash: hash,
396
- isConfirming,
397
- isConfirmed,
398
- isFailed
399
- }
400
- ),
401
- /* @__PURE__ */ jsx4(
402
- Close,
403
- {
404
- onClick: () => {
405
- transactionStatusModal$.close();
406
- },
407
- className: closeButton3,
408
- asChild: true,
409
- children: /* @__PURE__ */ jsx4(IconButton, { size: "xs", "aria-label": "Close modal", icon: CloseIcon })
410
- }
411
- )
412
- ] })
413
- ] }) });
414
- });
415
- var transactionStatusModal_default = TransactionStatusModal;
416
-
417
- // src/react/ui/modals/Account/index.tsx
418
- import { Box as Box4, Button, Modal, Text as Text5 } from "@0xsequence/design-system";
419
- import { observable as observable2 } from "@legendapp/state";
420
- import { observer as observer3 } from "@legendapp/state/react";
421
- import { useAccount } from "wagmi";
422
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
423
- var accountModalOpen$ = observable2(false);
424
- var AccountModal = observer3(function AccountModal2() {
425
- const { address } = useAccount();
426
- return accountModalOpen$.get() && /* @__PURE__ */ jsxs4(Modal, { children: [
427
- /* @__PURE__ */ jsxs4(Box4, { children: [
428
- /* @__PURE__ */ jsx5(Text5, { children: "Wallet address" }),
429
- /* @__PURE__ */ jsx5(Text5, { children: address })
430
- ] }),
431
- /* @__PURE__ */ jsx5(Button, { label: "Sign out" })
432
- ] });
433
- });
434
337
 
435
338
  // src/react/ui/modals/CreateListingModal/index.tsx
436
339
  import { Box as Box12 } from "@0xsequence/design-system";
437
- import { Show, observer as observer7 } from "@legendapp/state/react";
340
+ import { Show as Show2, observer as observer8 } from "@legendapp/state/react";
341
+ import { useAccount as useAccount3 } from "wagmi";
438
342
 
439
343
  // src/react/hooks/useCreateListing.tsx
440
- import { useState as useState2, useCallback } from "react";
344
+ import { useCallback, useState } from "react";
441
345
  var useCreateListing = ({
442
346
  onSuccess,
443
347
  onError,
444
348
  onTransactionSent,
445
349
  ...config
446
350
  }) => {
447
- const [isLoading, setIsLoading] = useState2(false);
448
- const [steps, setSteps] = useState2(null);
449
- const machine = useTransactionMachine(
351
+ const [isLoading, setIsLoading] = useState(false);
352
+ const [steps, setSteps] = useState(null);
353
+ const { machine, isLoading: isMachineLoading } = useTransactionMachine(
450
354
  {
451
355
  ...config,
452
356
  type: "LISTING" /* LISTING */
@@ -459,47 +363,97 @@ var useCreateListing = ({
459
363
  async (props) => {
460
364
  if (!machine) return;
461
365
  setIsLoading(true);
462
- try {
463
- const generatedSteps = await machine.getTransactionSteps(props);
464
- setSteps(generatedSteps);
465
- } catch (error) {
466
- onError?.(error);
467
- } finally {
366
+ const generatedSteps = await machine.getTransactionSteps(props);
367
+ if (!generatedSteps) {
468
368
  setIsLoading(false);
369
+ return;
469
370
  }
371
+ setSteps(generatedSteps);
372
+ setIsLoading(false);
470
373
  },
471
374
  [machine, onError]
472
375
  );
473
376
  return {
474
- createListing: (props) => machine?.start({ props }),
377
+ createListing: (props) => machine?.start(props),
475
378
  getListingSteps: (props) => ({
476
379
  isLoading,
477
380
  steps,
478
381
  refreshSteps: () => loadSteps(props)
479
382
  }),
480
- onError,
481
- onSuccess
383
+ isLoading: isMachineLoading
482
384
  };
483
385
  };
484
386
 
387
+ // src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx
388
+ import { Box as Box3 } from "@0xsequence/design-system";
389
+ import { jsx as jsx4 } from "react/jsx-runtime";
390
+ var ErrorModal = ({ store, onClose, title }) => /* @__PURE__ */ jsx4(ActionModal, { store, onClose, title, ctas: [], children: /* @__PURE__ */ jsx4(Box3, { display: "flex", justifyContent: "center", alignItems: "center", padding: "4", children: "Error loading item details" }) });
391
+
392
+ // src/react/ui/modals/_internal/components/actionModal/LoadingModal.tsx
393
+ import { Box as Box4, Spinner } from "@0xsequence/design-system";
394
+ import { jsx as jsx5 } from "react/jsx-runtime";
395
+ var LoadingModal = ({ store, onClose, title }) => /* @__PURE__ */ jsx5(ActionModal, { store, onClose, title, ctas: [], children: /* @__PURE__ */ jsx5(Box4, { display: "flex", justifyContent: "center", alignItems: "center", padding: "4", children: /* @__PURE__ */ jsx5(Spinner, { size: "lg" }) }) });
396
+
485
397
  // src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
486
- import { useState as useState3 } from "react";
487
- import { Box as Box5, Text as Text6 } from "@0xsequence/design-system";
488
- import { observer as observer4 } from "@legendapp/state/react";
398
+ import { useState as useState2 } from "react";
399
+ import { Box as Box5, Text as Text2 } from "@0xsequence/design-system";
400
+ import { observer as observer3 } from "@legendapp/state/react";
489
401
  import { addDays, isSameDay } from "date-fns";
490
402
 
403
+ // src/react/ui/components/_internals/custom-select/CustomSelect.tsx
404
+ import { CheckmarkIcon, ChevronDownIcon } from "@0xsequence/design-system";
405
+ import * as Select from "@radix-ui/react-select";
406
+ import React from "react";
407
+
408
+ // src/react/ui/components/_internals/custom-select/styles.css.ts
409
+ var content = "fyvr11eg fyvr11es fyvr11f4 fyvr11fg fyvr11hc fyvr11i0 fyvr11g0 fyvr11go fyvr11q0 fyvr11qg fyvr12q3 fyvr12ir fyvr1243 fyvr12bf fyvr12rr fyvr12kf fyvr125r fyvr12d3 fyvr11xx fyvr11r0 fyvr11rt";
410
+ var item = "styles_item__1ddtujk2 fyvr11h0 fyvr11ho fyvr11fo fyvr11gc fyvr1v4 fyvr1x8 fyvr1zs fyvr111g fyvr11ik fyvr12w9 fyvr11l8 fyvr11ow fyvr14g fyvr11m4 fyvr11rc fyvr12zf";
411
+ var itemIndicator = "fyvr11lw fyvr1qk fyvr11lk fyvr11ow fyvr11no";
412
+ var trigger = "fyvr11hk fyvr11i8 fyvr11g8 fyvr11gw fyvr1zg fyvr111k fyvr11lk fyvr11ow fyvr11no fyvr11ik fyvr14g fyvr11cg fyvr11wr fyvr12w9 fyvr12zf fyvr12s9 fyvr11a4";
413
+
414
+ // src/react/ui/components/_internals/custom-select/CustomSelect.tsx
415
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
416
+ var CustomSelectItem = React.forwardRef(({ children, ...props }, forwardedRef) => {
417
+ return /* @__PURE__ */ jsxs3(Select.Item, { className: item, ...props, ref: forwardedRef, children: [
418
+ /* @__PURE__ */ jsx6(Select.ItemText, { children }),
419
+ /* @__PURE__ */ jsx6(Select.ItemIndicator, { className: itemIndicator, children: /* @__PURE__ */ jsx6(CheckmarkIcon, { size: "xs" }) })
420
+ ] });
421
+ });
422
+ var CustomSelect = ({
423
+ items,
424
+ placeholder = "Select an item...",
425
+ onValueChange,
426
+ defaultValue
427
+ }) => {
428
+ return /* @__PURE__ */ jsxs3(Select.Root, { onValueChange, defaultValue, children: [
429
+ /* @__PURE__ */ jsxs3(Select.Trigger, { className: trigger, children: [
430
+ /* @__PURE__ */ jsx6(Select.Value, { placeholder }),
431
+ /* @__PURE__ */ jsx6(Select.Icon, { children: /* @__PURE__ */ jsx6(ChevronDownIcon, { size: "xs" }) })
432
+ ] }),
433
+ /* @__PURE__ */ jsx6(Select.Portal, { children: /* @__PURE__ */ jsx6(Select.Content, { className: content, children: /* @__PURE__ */ jsx6(Select.Viewport, { children: items.map((item2, index) => /* @__PURE__ */ jsx6(
434
+ CustomSelectItem,
435
+ {
436
+ value: item2.value,
437
+ disabled: item2.disabled,
438
+ children: item2.label
439
+ },
440
+ index
441
+ )) }) }) })
442
+ ] });
443
+ };
444
+
491
445
  // src/react/ui/modals/_internal/components/calendarPopover/index.tsx
492
446
  import { Button as Button2 } from "@0xsequence/design-system";
493
- import { Content as Content2, Portal as Portal2, Root as Root2, Trigger } from "@radix-ui/react-popover";
447
+ import { Content as Content2, Portal as Portal2, Root as Root2, Trigger as Trigger2 } from "@radix-ui/react-popover";
494
448
  import { format } from "date-fns";
495
449
 
496
450
  // src/react/ui/modals/_internal/components/calendar/index.tsx
497
451
  import { DayPicker } from "react-day-picker";
498
452
  import "react-day-picker/style.css";
499
- import { jsx as jsx6 } from "react/jsx-runtime";
453
+ import { jsx as jsx7 } from "react/jsx-runtime";
500
454
  function Calendar({ ...props }) {
501
455
  const { selectedDate, setSelectedDate } = props;
502
- return /* @__PURE__ */ jsx6(
456
+ return /* @__PURE__ */ jsx7(
503
457
  DayPicker,
504
458
  {
505
459
  disabled: {
@@ -547,13 +501,13 @@ Calendar.displayName = "Calendar";
547
501
  var calendar_default = Calendar;
548
502
 
549
503
  // src/react/ui/modals/_internal/components/calendarPopover/index.tsx
550
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
504
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
551
505
  function CalendarPopover({
552
506
  selectedDate,
553
507
  setSelectedDate
554
508
  }) {
555
- return /* @__PURE__ */ jsxs5(Root2, { children: [
556
- /* @__PURE__ */ jsx7(Trigger, { asChild: true, children: /* @__PURE__ */ jsx7(
509
+ return /* @__PURE__ */ jsxs4(Root2, { children: [
510
+ /* @__PURE__ */ jsx8(Trigger2, { asChild: true, children: /* @__PURE__ */ jsx8(
557
511
  Button2,
558
512
  {
559
513
  leftIcon: CalendarIcon_default,
@@ -563,7 +517,7 @@ function CalendarPopover({
563
517
  shape: "square"
564
518
  }
565
519
  ) }),
566
- /* @__PURE__ */ jsx7(Portal2, { children: /* @__PURE__ */ jsx7(Content2, { className: dateSelectPopoverContent, sideOffset: 5, children: /* @__PURE__ */ jsx7(
520
+ /* @__PURE__ */ jsx8(Portal2, { children: /* @__PURE__ */ jsx8(Content2, { className: dateSelectPopoverContent, sideOffset: 5, children: /* @__PURE__ */ jsx8(
567
521
  calendar_default,
568
522
  {
569
523
  selectedDate,
@@ -574,50 +528,8 @@ function CalendarPopover({
574
528
  ] });
575
529
  }
576
530
 
577
- // src/react/ui/components/_internals/custom-select/CustomSelect.tsx
578
- import React from "react";
579
- import * as Select from "@radix-ui/react-select";
580
- import { CheckmarkIcon, ChevronDownIcon } from "@0xsequence/design-system";
581
-
582
- // src/react/ui/components/_internals/custom-select/styles.css.ts
583
- var content = "fyvr11eg fyvr11es fyvr11f4 fyvr11fg fyvr11hc fyvr11i0 fyvr11g0 fyvr11go fyvr11q0 fyvr11qg fyvr12q3 fyvr12ir fyvr1243 fyvr12bf fyvr12rr fyvr12kf fyvr125r fyvr12d3 fyvr11xx fyvr11r0 fyvr11rt";
584
- var item = "styles_item__1ddtujk2 fyvr11h0 fyvr11ho fyvr11fo fyvr11gc fyvr1v4 fyvr1x8 fyvr1zs fyvr111g fyvr11ik fyvr12w9 fyvr11l8 fyvr11ow fyvr14g fyvr11m4 fyvr11rc fyvr12zf";
585
- var itemIndicator = "fyvr11lw fyvr1qk fyvr11lk fyvr11ow fyvr11no";
586
- var trigger = "fyvr11hk fyvr11i8 fyvr11g8 fyvr11gw fyvr1zg fyvr111k fyvr11lk fyvr11ow fyvr11no fyvr11ik fyvr14g fyvr11cg fyvr11wr fyvr12w9 fyvr12zf fyvr12s9 fyvr11a4";
587
-
588
- // src/react/ui/components/_internals/custom-select/CustomSelect.tsx
589
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
590
- var CustomSelectItem = React.forwardRef(({ children, ...props }, forwardedRef) => {
591
- return /* @__PURE__ */ jsxs6(Select.Item, { className: item, ...props, ref: forwardedRef, children: [
592
- /* @__PURE__ */ jsx8(Select.ItemText, { children }),
593
- /* @__PURE__ */ jsx8(Select.ItemIndicator, { className: itemIndicator, children: /* @__PURE__ */ jsx8(CheckmarkIcon, { size: "xs" }) })
594
- ] });
595
- });
596
- var CustomSelect = ({
597
- items,
598
- placeholder = "Select an item...",
599
- onValueChange,
600
- defaultValue
601
- }) => {
602
- return /* @__PURE__ */ jsxs6(Select.Root, { onValueChange, defaultValue, children: [
603
- /* @__PURE__ */ jsxs6(Select.Trigger, { className: trigger, children: [
604
- /* @__PURE__ */ jsx8(Select.Value, { placeholder }),
605
- /* @__PURE__ */ jsx8(Select.Icon, { children: /* @__PURE__ */ jsx8(ChevronDownIcon, { size: "xs" }) })
606
- ] }),
607
- /* @__PURE__ */ jsx8(Select.Portal, { children: /* @__PURE__ */ jsx8(Select.Content, { className: content, children: /* @__PURE__ */ jsx8(Select.Viewport, { children: items.map((item2) => /* @__PURE__ */ jsx8(
608
- CustomSelectItem,
609
- {
610
- value: item2.value,
611
- disabled: item2.disabled,
612
- children: item2.label
613
- },
614
- item2.value
615
- )) }) }) })
616
- ] });
617
- };
618
-
619
531
  // src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
620
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
532
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
621
533
  var PRESET_RANGES = {
622
534
  TODAY: {
623
535
  label: "Today",
@@ -645,11 +557,11 @@ var PRESET_RANGES = {
645
557
  offset: 30
646
558
  }
647
559
  };
648
- var ExpirationDateSelect = observer4(function ExpirationDateSelect2({
560
+ var ExpirationDateSelect = observer3(function ExpirationDateSelect2({
649
561
  className,
650
562
  $date
651
563
  }) {
652
- const [_, setRange] = useState3("1_week");
564
+ const [_, setRange] = useState2("1_week");
653
565
  function handleSelectPresetRange(range) {
654
566
  setRange(range);
655
567
  const presetRange = Object.values(PRESET_RANGES).find(
@@ -670,19 +582,20 @@ var ExpirationDateSelect = observer4(function ExpirationDateSelect2({
670
582
  }
671
583
  $date.set(date);
672
584
  }
673
- return /* @__PURE__ */ jsxs7(Box5, { width: "full", position: "relative", children: [
585
+ return /* @__PURE__ */ jsxs5(Box5, { width: "full", position: "relative", children: [
674
586
  /* @__PURE__ */ jsx9(
675
- Text6,
587
+ Text2,
676
588
  {
677
589
  fontSize: "small",
678
590
  fontWeight: "medium",
679
591
  textAlign: "left",
680
592
  width: "full",
681
593
  color: "text100",
594
+ fontFamily: "body",
682
595
  children: "Set expiry"
683
596
  }
684
597
  ),
685
- /* @__PURE__ */ jsxs7(
598
+ /* @__PURE__ */ jsxs5(
686
599
  Box5,
687
600
  {
688
601
  className,
@@ -738,7 +651,7 @@ var ExpirationDateSelect = observer4(function ExpirationDateSelect2({
738
651
  var expirationDateSelect_default = ExpirationDateSelect;
739
652
 
740
653
  // src/react/ui/modals/_internal/components/floorPriceText/index.tsx
741
- import { Text as Text7 } from "@0xsequence/design-system";
654
+ import { Text as Text3 } from "@0xsequence/design-system";
742
655
  import { jsx as jsx10 } from "react/jsx-runtime";
743
656
  function FloorPriceText({
744
657
  chainId,
@@ -765,31 +678,32 @@ function FloorPriceText({
765
678
  });
766
679
  const floorPriceDifferenceText = floorPriceRaw === price.amountRaw ? "Same as floor price" : `${floorPriceDifference}% ${floorPriceRaw > price.amountRaw ? "below" : "above"} floor price`;
767
680
  return /* @__PURE__ */ jsx10(
768
- Text7,
681
+ Text3,
769
682
  {
770
683
  fontSize: "small",
771
684
  fontWeight: "medium",
772
685
  textAlign: "left",
773
686
  width: "full",
774
687
  color: "text50",
688
+ fontFamily: "body",
775
689
  children: floorPriceDifferenceText
776
690
  }
777
691
  );
778
692
  }
779
693
 
780
694
  // src/react/ui/modals/_internal/components/priceInput/index.tsx
781
- import { Box as Box6, NumericInput, TokenImage } from "@0xsequence/design-system";
782
- import { observer as observer6 } from "@legendapp/state/react";
783
- import { useState as useState4 } from "react";
695
+ import { Box as Box6, NumericInput as NumericInput2, TokenImage } from "@0xsequence/design-system";
696
+ import { observer as observer5 } from "@legendapp/state/react";
697
+ import { useState as useState3 } from "react";
784
698
  import { erc20Abi, parseUnits } from "viem";
785
699
  import { useAccount as useAccount2, useReadContract } from "wagmi";
786
700
 
787
701
  // src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx
788
- import { Skeleton as Skeleton2 } from "@0xsequence/design-system";
789
- import { observer as observer5 } from "@legendapp/state/react";
790
- import { useEffect as useEffect3 } from "react";
702
+ import { Skeleton } from "@0xsequence/design-system";
703
+ import { observer as observer4 } from "@legendapp/state/react";
704
+ import { useEffect as useEffect2 } from "react";
791
705
  import { jsx as jsx11 } from "react/jsx-runtime";
792
- var CurrencyOptionsSelect = observer5(function CurrencyOptionsSelect2({
706
+ var CurrencyOptionsSelect = observer4(function CurrencyOptionsSelect2({
793
707
  chainId,
794
708
  collectionAddress,
795
709
  $selectedCurrency
@@ -798,17 +712,17 @@ var CurrencyOptionsSelect = observer5(function CurrencyOptionsSelect2({
798
712
  collectionAddress,
799
713
  chainId
800
714
  });
801
- useEffect3(() => {
715
+ useEffect2(() => {
802
716
  if (currencies && currencies.length > 0 && !$selectedCurrency.contractAddress.get()) {
803
717
  $selectedCurrency.set(currencies[0]);
804
718
  }
805
719
  }, [currencies]);
806
720
  if (!currencies || currenciesLoading) {
807
- return /* @__PURE__ */ jsx11(Skeleton2, { borderRadius: "lg", width: "20", height: "7", marginRight: "3" });
721
+ return /* @__PURE__ */ jsx11(Skeleton, { borderRadius: "lg", width: "20", height: "7", marginRight: "3" });
808
722
  }
809
723
  const options = currencies.map(
810
724
  (currency) => ({
811
- label: currency.name,
725
+ label: currency.symbol,
812
726
  value: currency.contractAddress
813
727
  })
814
728
  );
@@ -818,27 +732,19 @@ var CurrencyOptionsSelect = observer5(function CurrencyOptionsSelect2({
818
732
  );
819
733
  $selectedCurrency.set(c);
820
734
  };
821
- return /* @__PURE__ */ jsx11(
822
- CustomSelect,
823
- {
824
- items: options,
825
- placeholder: options[0].label,
826
- onValueChange: onChange,
827
- defaultValue: options[0].value
828
- }
829
- );
735
+ return /* @__PURE__ */ jsx11(CustomSelect, { items: options, onValueChange: onChange, placeholder: "" });
830
736
  });
831
737
  var currencyOptionsSelect_default = CurrencyOptionsSelect;
832
738
 
833
739
  // src/react/ui/modals/_internal/components/priceInput/index.tsx
834
- import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
835
- var PriceInput = observer6(function PriceInput2({
740
+ import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
741
+ var PriceInput = observer5(function PriceInput2({
836
742
  chainId,
837
743
  collectionAddress,
838
744
  $listingPrice,
839
745
  checkBalance
840
746
  }) {
841
- const [balanceError, setBalanceError] = useState4("");
747
+ const [balanceError, setBalanceError] = useState3("");
842
748
  const { address: accountAddress } = useAccount2();
843
749
  const { data: balance, isSuccess: isBalanceSuccess } = useReadContract({
844
750
  address: $listingPrice.currency.contractAddress.get(),
@@ -850,7 +756,7 @@ var PriceInput = observer6(function PriceInput2({
850
756
  }
851
757
  });
852
758
  const currencyDecimals = $listingPrice.currency.decimals.get();
853
- const [value, setValue] = useState4("");
759
+ const [value, setValue] = useState3("");
854
760
  const checkInsufficientBalance = (priceAmountRaw) => {
855
761
  const hasInsufficientBalance = isBalanceSuccess && priceAmountRaw && currencyDecimals && BigInt(priceAmountRaw) > (balance || 0);
856
762
  if (!checkBalance) return;
@@ -868,7 +774,7 @@ var PriceInput = observer6(function PriceInput2({
868
774
  $listingPrice.amountRaw.set(parsedAmount.toString());
869
775
  checkBalance && checkInsufficientBalance(parsedAmount.toString());
870
776
  };
871
- return /* @__PURE__ */ jsxs8(Box6, { className: priceInputWrapper, position: "relative", children: [
777
+ return /* @__PURE__ */ jsxs6(Box6, { className: priceInputWrapper, position: "relative", children: [
872
778
  /* @__PURE__ */ jsx12(
873
779
  Box6,
874
780
  {
@@ -881,7 +787,7 @@ var PriceInput = observer6(function PriceInput2({
881
787
  }
882
788
  ),
883
789
  /* @__PURE__ */ jsx12(
884
- NumericInput,
790
+ NumericInput2,
885
791
  {
886
792
  name: "listingPrice",
887
793
  decimals: currencyDecimals,
@@ -905,175 +811,48 @@ var PriceInput = observer6(function PriceInput2({
905
811
  });
906
812
  var priceInput_default = PriceInput;
907
813
 
908
- // src/react/ui/modals/_internal/components/quantityInput/index.tsx
909
- import { Box as Box7, IconButton as IconButton2, NumericInput as NumericInput2 } from "@0xsequence/design-system";
910
- import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
911
- function QuantityInput({
912
- $quantity,
913
- chainId,
814
+ // src/react/ui/modals/_internal/components/tokenPreview/index.tsx
815
+ import { Box as Box7, Image, Skeleton as Skeleton2, Text as Text4 } from "@0xsequence/design-system";
816
+
817
+ // src/react/ui/images/chess-tile.png
818
+ var chess_tile_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK8AAACuCAYAAABAzl3QAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAInSURBVHgB7dyxbUMxEAXBs6FEjagv91/AD+keeNFCMw1csmBEvJ/P53Nm4Xme2Xi/37Ph/nfeP+f8/Q5EiZcs8ZIlXrLES5Z4yRIvWeIlS7xkiZcs8ZIlXrLES5Z4yRIvWS//Ud2v3vfykiVessRLlnjJEi9Z4iVLvGSJlyzxkiVessRLlnjJEi9Z4iVLvGS9/Ed1v3j/nOPlpUu8ZImXLPGSJV6yxEuWeMkSL1niJUu8ZImXLPGSJV6yxEuWeMmyz+v+bNjnhQviJUu8ZImXLPGSJV6yxEuWeMkSL1niJUu8ZImXLPGSJV6yxEuWfV73Z8M+L1wQL1niJUu8ZImXLPGSJV6yxEuWeMkSL1niJUu8ZImXLPGSJV6y7PO6Pxv2eeGCeMkSL1niJUu8ZImXLPGSJV6yxEuWeMkSL1niJUu8ZImXLPGSZZ/X/dmwzwsXxEuWeMkSL1niJUu8ZImXLPGSJV6yxEuWeMkSL1niJUu8ZImXLPu87s+GfV64IF6yxEuWeMkSL1niJUu8ZImXLPGSJV6yxEuWeMkSL1niJUu8ZNnndX827PPCBfGSJV6yxEuWeMkSL1niJUu8ZImXLPGSJV6yxEuWeMkSL1niJcs+r/uzYZ8XLoiXLPGSJV6yxEuWeMkSL1niJUu8ZImXLPGSJV6yxEuWeMkSL1n2ed2fDfu8cEG8ZImXLPGSJV6yxEuWeMkSL1niJUu8ZImXLPGSJV6y/gF97MkwfJRH7QAAAABJRU5ErkJggg==";
819
+
820
+ // src/react/ui/modals/_internal/components/tokenPreview/index.tsx
821
+ import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
822
+ function TokenPreview({
823
+ collectionName,
914
824
  collectionAddress,
915
- collectibleId
825
+ collectibleId,
826
+ chainId
916
827
  }) {
917
- const { data: collectable, isLoading: collectableLoading } = useCollectible({
828
+ const { data: collectable, isLoading: collectibleLoading } = useCollectible({
918
829
  chainId,
919
830
  collectionAddress,
920
831
  collectibleId
921
832
  });
922
- const quantityDecimals = collectable && (collectable.decimals || 0);
923
- function handleChangeQuantity(value) {
924
- if (!isValidInput(value)) return;
925
- const formattedValue = formatQuantity(value);
926
- if (formattedValue !== null) {
927
- $quantity.set(formattedValue);
928
- }
929
- }
930
- function handleIncrement() {
931
- if (!isValidInput()) return;
932
- const newQuantity = incrementQuantity();
933
- if (newQuantity !== null) {
934
- $quantity.set(newQuantity);
935
- }
936
- }
937
- function handleDecrement() {
938
- if (!isValidInput()) return;
939
- const newQuantity = decrementQuantity();
940
- if (newQuantity !== null) {
941
- $quantity.set(newQuantity);
942
- }
943
- }
944
- function isValidInput(value) {
945
- return collectable !== void 0 && quantityDecimals !== void 0 && (value === void 0 || value !== "");
833
+ if (collectibleLoading) {
834
+ return /* @__PURE__ */ jsxs7(Box7, { display: "flex", alignItems: "center", gap: "3", width: "full", children: [
835
+ /* @__PURE__ */ jsx13(Skeleton2, { width: "9", height: "9", borderRadius: "xs" }),
836
+ /* @__PURE__ */ jsxs7(Box7, { display: "flex", flexGrow: "1", gap: "1", flexDirection: "column", children: [
837
+ /* @__PURE__ */ jsx13(Skeleton2, { width: "1/3", height: "3" }),
838
+ /* @__PURE__ */ jsx13(Skeleton2, { width: "1/2", height: "3" })
839
+ ] })
840
+ ] });
946
841
  }
947
- function formatQuantity(value) {
948
- if (quantityDecimals === 0 && value.includes(".")) {
949
- return null;
950
- }
951
- if (quantityDecimals && quantityDecimals > 0) {
952
- const decimalIndex = value.indexOf(".");
953
- if (decimalIndex !== -1 && value.length - decimalIndex > quantityDecimals + 1) {
954
- return null;
955
- }
956
- }
957
- return value;
958
- }
959
- const quantity = $quantity.get();
960
- function incrementQuantity() {
961
- if (!isValidInput()) return null;
962
- if (!quantity) {
963
- return quantityDecimals === 0 ? "1" : `1.${"0".repeat(quantityDecimals)}`;
964
- }
965
- const newValue = quantityDecimals === 0 ? (Number.parseInt(quantity) + 1).toString() : (Number.parseFloat(quantity) + 1).toFixed(quantityDecimals);
966
- return newValue;
967
- }
968
- function decrementQuantity() {
969
- if (!quantity) {
970
- return "1";
971
- }
972
- const newValue = Number.parseFloat(quantity) - 1;
973
- if (newValue < 0) {
974
- return null;
975
- }
976
- return quantityDecimals === 0 ? newValue.toString() : newValue.toFixed(quantityDecimals);
977
- }
978
- function getPlaceholder(decimals) {
979
- if (decimals === 0) {
980
- return "0";
981
- } else {
982
- return "0." + "0".repeat(decimals);
983
- }
984
- }
985
- if (collectableLoading) {
986
- return null;
987
- }
988
- return /* @__PURE__ */ jsx13(Box7, { className: quantityInputWrapper, children: /* @__PURE__ */ jsx13(
989
- NumericInput2,
990
- {
991
- name: "quantity",
992
- decimals: quantityDecimals || 0,
993
- paddingLeft: "1",
994
- label: "Enter quantity",
995
- labelLocation: "top",
996
- placeholder: getPlaceholder(quantityDecimals || 0),
997
- controls: /* @__PURE__ */ jsxs9(
998
- Box7,
999
- {
1000
- display: "flex",
1001
- alignItems: "center",
1002
- gap: "1",
1003
- marginRight: "2",
1004
- children: [
1005
- /* @__PURE__ */ jsx13(
1006
- IconButton2,
1007
- {
1008
- disabled: Number.parseFloat(quantity) === 0 || !quantity,
1009
- onClick: handleDecrement,
1010
- background: "buttonGlass",
1011
- size: "xs",
1012
- icon: MinusIcon_default
1013
- }
1014
- ),
1015
- /* @__PURE__ */ jsx13(
1016
- IconButton2,
1017
- {
1018
- onClick: handleIncrement,
1019
- background: "buttonGlass",
1020
- size: "xs",
1021
- icon: PlusIcon_default
1022
- }
1023
- )
1024
- ]
1025
- }
1026
- ),
1027
- numeric: true,
1028
- value: $quantity.get(),
1029
- onChange: (e) => handleChangeQuantity(e.target.value),
1030
- width: "full"
1031
- }
1032
- ) });
1033
- }
1034
-
1035
- // src/react/ui/modals/_internal/components/tokenPreview/index.tsx
1036
- import { Box as Box8, Image as Image2, Skeleton as Skeleton3, Text as Text8 } from "@0xsequence/design-system";
1037
-
1038
- // src/react/ui/images/chess-tile.png
1039
- var chess_tile_default = "./chess-tile-6BS5MQT5.png";
1040
-
1041
- // src/react/ui/modals/_internal/components/tokenPreview/index.tsx
1042
- import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
1043
- function TokenPreview({
1044
- collectionName,
1045
- collectionAddress,
1046
- collectibleId,
1047
- chainId
1048
- }) {
1049
- const { data: collectable, isLoading: collectibleLoading } = useCollectible({
1050
- chainId,
1051
- collectionAddress,
1052
- collectibleId
1053
- });
1054
- if (collectibleLoading) {
1055
- return /* @__PURE__ */ jsxs10(Box8, { display: "flex", alignItems: "center", gap: "3", width: "full", children: [
1056
- /* @__PURE__ */ jsx14(Skeleton3, { width: "9", height: "9", borderRadius: "xs" }),
1057
- /* @__PURE__ */ jsxs10(Box8, { display: "flex", flexGrow: "1", gap: "1", flexDirection: "column", children: [
1058
- /* @__PURE__ */ jsx14(Skeleton3, { width: "1/3", height: "3" }),
1059
- /* @__PURE__ */ jsx14(Skeleton3, { width: "1/2", height: "3" })
1060
- ] })
1061
- ] });
1062
- }
1063
- return /* @__PURE__ */ jsxs10(Box8, { className: tokenPreview, children: [
1064
- /* @__PURE__ */ jsx14(
1065
- Image2,
1066
- {
1067
- src: collectable?.image || chess_tile_default,
1068
- alt: collectable?.name,
1069
- width: "9",
1070
- height: "9",
1071
- borderRadius: "xs"
842
+ return /* @__PURE__ */ jsxs7(Box7, { className: tokenPreview, children: [
843
+ /* @__PURE__ */ jsx13(
844
+ Image,
845
+ {
846
+ src: collectable?.image || chess_tile_default,
847
+ alt: collectable?.name,
848
+ width: "9",
849
+ height: "9",
850
+ borderRadius: "xs"
1072
851
  }
1073
852
  ),
1074
- /* @__PURE__ */ jsxs10(Box8, { display: "flex", flexDirection: "column", marginLeft: "3", children: [
1075
- /* @__PURE__ */ jsx14(
1076
- Text8,
853
+ /* @__PURE__ */ jsxs7(Box7, { display: "flex", flexDirection: "column", marginLeft: "3", children: [
854
+ /* @__PURE__ */ jsx13(
855
+ Text4,
1077
856
  {
1078
857
  fontSize: "small",
1079
858
  color: "text80",
@@ -1082,8 +861,8 @@ function TokenPreview({
1082
861
  children: collectionName
1083
862
  }
1084
863
  ),
1085
- /* @__PURE__ */ jsx14(
1086
- Text8,
864
+ /* @__PURE__ */ jsx13(
865
+ Text4,
1087
866
  {
1088
867
  fontSize: "small",
1089
868
  fontWeight: "bold",
@@ -1097,9 +876,9 @@ function TokenPreview({
1097
876
  }
1098
877
 
1099
878
  // src/react/ui/modals/_internal/components/transactionDetails/index.tsx
1100
- import { Box as Box9, Image as Image3, Skeleton as Skeleton4, Text as Text9 } from "@0xsequence/design-system";
1101
- import { formatUnits as formatUnits2 } from "viem";
1102
- import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
879
+ import { Box as Box8, Image as Image2, Skeleton as Skeleton3, Text as Text5 } from "@0xsequence/design-system";
880
+ import { formatUnits } from "viem";
881
+ import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
1103
882
  var DEFAULT_MARKETPLACE_FEE_PERCENTAGE = 2.5;
1104
883
  function TransactionDetails({
1105
884
  collectibleId,
@@ -1118,25 +897,25 @@ function TransactionDetails({
1118
897
  collectibleId
1119
898
  });
1120
899
  const priceLoading = !price || marketplaceConfigLoading || royaltyPercentageLoading;
1121
- let formattedAmount = price && formatUnits2(BigInt(price.amountRaw), price.currency.decimals);
900
+ let formattedAmount = price && formatUnits(BigInt(price.amountRaw), price.currency.decimals);
1122
901
  if (royaltyPercentage !== void 0 && formattedAmount) {
1123
902
  formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * Number(royaltyPercentage) / 100).toString();
1124
903
  }
1125
904
  if (marketplaceFeePercentage !== void 0 && formattedAmount) {
1126
905
  formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * marketplaceFeePercentage / 100).toString();
1127
906
  }
1128
- return /* @__PURE__ */ jsxs11(
1129
- Box9,
907
+ return /* @__PURE__ */ jsxs8(
908
+ Box8,
1130
909
  {
1131
910
  width: "full",
1132
911
  display: "flex",
1133
912
  justifyContent: "space-between",
1134
913
  alignItems: "center",
1135
914
  children: [
1136
- /* @__PURE__ */ jsx15(Text9, { fontSize: "small", color: "text50", children: "Total earnings" }),
1137
- /* @__PURE__ */ jsxs11(Box9, { display: "flex", alignItems: "center", gap: "2", children: [
1138
- /* @__PURE__ */ jsx15(Image3, { src: currencyImageUrl, width: "3", height: "3" }),
1139
- priceLoading ? /* @__PURE__ */ jsx15(Skeleton4, { width: "16", height: "4" }) : /* @__PURE__ */ jsxs11(Text9, { fontSize: "small", color: "text100", children: [
915
+ /* @__PURE__ */ jsx14(Text5, { fontSize: "small", color: "text50", fontFamily: "body", children: "Total earnings" }),
916
+ /* @__PURE__ */ jsxs8(Box8, { display: "flex", alignItems: "center", gap: "2", children: [
917
+ /* @__PURE__ */ jsx14(Image2, { src: currencyImageUrl, width: "3", height: "3" }),
918
+ priceLoading ? /* @__PURE__ */ jsx14(Skeleton3, { width: "16", height: "4" }) : /* @__PURE__ */ jsxs8(Text5, { fontSize: "small", color: "text100", fontFamily: "body", children: [
1140
919
  formattedAmount,
1141
920
  " ",
1142
921
  price.currency.symbol
@@ -1147,10 +926,421 @@ function TransactionDetails({
1147
926
  );
1148
927
  }
1149
928
 
1150
- // src/react/ui/modals/CreateListingModal/_store.ts
929
+ // src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
930
+ import {
931
+ CloseIcon,
932
+ IconButton as IconButton2,
933
+ Skeleton as Skeleton4,
934
+ Text as Text9
935
+ } from "@0xsequence/design-system";
936
+ import { observer as observer7 } from "@legendapp/state/react";
937
+ import { Close, Content as Content3, Overlay, Portal as Portal3, Root as Root3 } from "@radix-ui/react-dialog";
938
+ import { useEffect as useEffect4 } from "react";
939
+ import { useTransactionReceipt } from "wagmi";
940
+
941
+ // src/react/ui/modals/_internal/components/transaction-footer/index.tsx
942
+ import { Box as Box9, Spinner as Spinner2, Text as Text6 } from "@0xsequence/design-system";
943
+ import { networks } from "@0xsequence/network";
944
+ import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
945
+ function TransactionFooter({
946
+ transactionHash,
947
+ isConfirming,
948
+ isConfirmed,
949
+ isFailed,
950
+ chainId
951
+ }) {
952
+ const icon = isConfirming && /* @__PURE__ */ jsx15(Spinner2, { size: "md" }) || isConfirmed && /* @__PURE__ */ jsx15(PositiveCircleIcon_default, { size: "md" });
953
+ const title = isConfirming && "Processing transaction" || isConfirmed && "Transaction complete" || isFailed && "Transaction failed";
954
+ const transactionUrl = `${networks[chainId]?.blockExplorer?.rootUrl}tx/${transactionHash}`;
955
+ return /* @__PURE__ */ jsxs9(Box9, { display: "flex", alignItems: "center", children: [
956
+ icon,
957
+ /* @__PURE__ */ jsx15(
958
+ Text6,
959
+ {
960
+ color: "text50",
961
+ fontSize: "normal",
962
+ fontWeight: "medium",
963
+ marginLeft: "2",
964
+ fontFamily: "body",
965
+ children: title
966
+ }
967
+ ),
968
+ /* @__PURE__ */ jsx15(
969
+ Box9,
970
+ {
971
+ as: "a",
972
+ flexGrow: "1",
973
+ marginLeft: "2",
974
+ href: transactionUrl,
975
+ target: "_blank",
976
+ rel: "noopener noreferrer",
977
+ textAlign: "right",
978
+ textDecoration: "none",
979
+ children: /* @__PURE__ */ jsx15(
980
+ Text6,
981
+ {
982
+ color: "polygonLight",
983
+ textAlign: "right",
984
+ fontSize: "normal",
985
+ fontWeight: "medium",
986
+ fontFamily: "body",
987
+ children: truncateMiddle(transactionHash, 4, 4)
988
+ }
989
+ )
990
+ }
991
+ )
992
+ ] });
993
+ }
994
+
995
+ // src/react/ui/modals/_internal/components/transactionPreview/index.tsx
996
+ import { Box as Box11, Image as Image3, NetworkImage, Text as Text8 } from "@0xsequence/design-system";
997
+ import { observer as observer6 } from "@legendapp/state/react";
998
+ import { formatUnits as formatUnits2 } from "viem";
999
+
1000
+ // src/react/ui/modals/_internal/components/timeAgo/index.tsx
1001
+ import { Box as Box10, Text as Text7 } from "@0xsequence/design-system";
1002
+ import { formatDistanceToNow } from "date-fns";
1003
+ import { useEffect as useEffect3, useState as useState4 } from "react";
1004
+ import { jsx as jsx16 } from "react/jsx-runtime";
1005
+ function TimeAgo({ date }) {
1006
+ const [timeAgo, setTimeAgo] = useState4("");
1007
+ useEffect3(() => {
1008
+ const interval = setInterval(() => {
1009
+ setTimeAgo(formatDistanceToNow(date));
1010
+ }, 1e3);
1011
+ return () => clearInterval(interval);
1012
+ }, [date]);
1013
+ return /* @__PURE__ */ jsx16(
1014
+ Box10,
1015
+ {
1016
+ flexGrow: "1",
1017
+ display: "flex",
1018
+ alignItems: "center",
1019
+ justifyContent: "flex-end",
1020
+ children: /* @__PURE__ */ jsx16(Text7, { color: "text50", fontSize: "small", children: timeAgo })
1021
+ }
1022
+ );
1023
+ }
1024
+
1025
+ // src/react/ui/modals/_internal/components/transactionStatusModal/store.ts
1151
1026
  import { observable as observable3 } from "@legendapp/state";
1152
- import { addDays as addDays2 } from "date-fns/addDays";
1153
1027
  var initialState2 = {
1028
+ isOpen: false,
1029
+ open: ({
1030
+ hash,
1031
+ price,
1032
+ collectionAddress,
1033
+ chainId,
1034
+ tokenId,
1035
+ getTitle,
1036
+ getMessage: getMessage2,
1037
+ type,
1038
+ callbacks,
1039
+ queriesToInvalidate
1040
+ }) => {
1041
+ transactionStatusModal$.state.set({
1042
+ ...transactionStatusModal$.state.get(),
1043
+ hash,
1044
+ price,
1045
+ collectionAddress,
1046
+ chainId,
1047
+ tokenId,
1048
+ getTitle,
1049
+ getMessage: getMessage2,
1050
+ type,
1051
+ callbacks,
1052
+ queriesToInvalidate
1053
+ });
1054
+ transactionStatusModal$.isOpen.set(true);
1055
+ },
1056
+ close: () => {
1057
+ transactionStatusModal$.isOpen.set(false);
1058
+ transactionStatusModal$.state.set({
1059
+ ...initialState2.state
1060
+ });
1061
+ },
1062
+ state: {
1063
+ hash: void 0,
1064
+ status: "PENDING",
1065
+ price: void 0,
1066
+ collectionAddress: "",
1067
+ chainId: "",
1068
+ tokenId: "",
1069
+ getTitle: void 0,
1070
+ getMessage: void 0,
1071
+ type: void 0
1072
+ }
1073
+ };
1074
+ var transactionStatusModal$ = observable3(initialState2);
1075
+
1076
+ // src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx
1077
+ import { useMemo } from "react";
1078
+
1079
+ // src/react/ui/modals/_internal/components/transactionPreview/consts.ts
1080
+ var TRANSACTION_TITLES = {
1081
+ sell: {
1082
+ confirming: "Selling",
1083
+ confirmed: "Sold",
1084
+ failed: "Sale failed"
1085
+ },
1086
+ createListing: {
1087
+ confirming: "Creating listing",
1088
+ confirmed: "Listed",
1089
+ failed: "Listing failed"
1090
+ },
1091
+ createOffer: {
1092
+ confirming: "Creating offer",
1093
+ confirmed: "Offer created",
1094
+ failed: "Offer failed"
1095
+ },
1096
+ buy: {
1097
+ confirming: "Buying",
1098
+ confirmed: "Bought",
1099
+ failed: "Purchase failed"
1100
+ },
1101
+ transfer: {
1102
+ confirming: "Transferring",
1103
+ confirmed: "Transferred",
1104
+ failed: "Transfer failed"
1105
+ }
1106
+ };
1107
+
1108
+ // src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx
1109
+ function useTransactionPreviewTitle(status, type) {
1110
+ return useMemo(() => {
1111
+ if (!type) return "";
1112
+ const { isConfirming, isConfirmed, isFailed } = status;
1113
+ const titles = TRANSACTION_TITLES[type];
1114
+ if (isConfirming) return titles.confirming;
1115
+ if (isConfirmed) return titles.confirmed;
1116
+ if (isFailed) return titles.failed;
1117
+ return "";
1118
+ }, [status, type]);
1119
+ }
1120
+
1121
+ // src/react/ui/modals/_internal/components/transactionPreview/index.tsx
1122
+ import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
1123
+ var TransactionPreview = observer6(
1124
+ ({
1125
+ price,
1126
+ collectionAddress,
1127
+ chainId,
1128
+ collectible,
1129
+ currencyImageUrl,
1130
+ isConfirming,
1131
+ isConfirmed,
1132
+ isFailed
1133
+ }) => {
1134
+ const { type } = transactionStatusModal$.state.get();
1135
+ const title = useTransactionPreviewTitle(
1136
+ { isConfirmed, isConfirming, isFailed },
1137
+ type
1138
+ );
1139
+ const { data: collection } = useCollection({
1140
+ collectionAddress,
1141
+ chainId
1142
+ });
1143
+ const collectibleImage2 = collectible.image;
1144
+ const collectibleName = collectible.name;
1145
+ const collectionName = collection?.name;
1146
+ const priceFormatted = price ? formatUnits2(BigInt(price.amountRaw), price.currency.decimals) : void 0;
1147
+ return /* @__PURE__ */ jsxs10(Box11, { padding: "3", background: "backgroundSecondary", borderRadius: "md", children: [
1148
+ /* @__PURE__ */ jsxs10(Box11, { display: "flex", alignItems: "center", children: [
1149
+ /* @__PURE__ */ jsx17(
1150
+ Text8,
1151
+ {
1152
+ color: "text50",
1153
+ fontSize: "small",
1154
+ fontWeight: "medium",
1155
+ marginRight: "1",
1156
+ fontFamily: "body",
1157
+ children: title
1158
+ }
1159
+ ),
1160
+ /* @__PURE__ */ jsx17(NetworkImage, { chainId: Number(chainId), size: "xs" }),
1161
+ isConfirming && /* @__PURE__ */ jsx17(TimeAgo, { date: /* @__PURE__ */ new Date() })
1162
+ ] }),
1163
+ /* @__PURE__ */ jsxs10(Box11, { display: "flex", alignItems: "center", marginTop: "2", children: [
1164
+ /* @__PURE__ */ jsx17(
1165
+ Image3,
1166
+ {
1167
+ src: collectibleImage2 || chess_tile_default,
1168
+ alt: collectibleName,
1169
+ width: "9",
1170
+ height: "9",
1171
+ borderRadius: "xs",
1172
+ marginRight: "3"
1173
+ }
1174
+ ),
1175
+ /* @__PURE__ */ jsxs10(
1176
+ Box11,
1177
+ {
1178
+ display: "flex",
1179
+ flexDirection: "column",
1180
+ alignItems: "flex-start",
1181
+ gap: "0.5",
1182
+ children: [
1183
+ /* @__PURE__ */ jsx17(
1184
+ Text8,
1185
+ {
1186
+ color: "text80",
1187
+ fontSize: "small",
1188
+ fontWeight: "medium",
1189
+ fontFamily: "body",
1190
+ children: collectibleName
1191
+ }
1192
+ ),
1193
+ /* @__PURE__ */ jsx17(Text8, { color: "text100", fontSize: "small", fontFamily: "body", children: collectionName })
1194
+ ]
1195
+ }
1196
+ ),
1197
+ price && /* @__PURE__ */ jsxs10(
1198
+ Box11,
1199
+ {
1200
+ flexGrow: "1",
1201
+ display: "flex",
1202
+ alignItems: "center",
1203
+ justifyContent: "flex-end",
1204
+ gap: "1",
1205
+ children: [
1206
+ /* @__PURE__ */ jsx17(Image3, { src: currencyImageUrl, width: "3", height: "3" }),
1207
+ /* @__PURE__ */ jsxs10(
1208
+ Text8,
1209
+ {
1210
+ color: "text80",
1211
+ fontSize: "small",
1212
+ fontWeight: "medium",
1213
+ fontFamily: "body",
1214
+ children: [
1215
+ priceFormatted,
1216
+ " ",
1217
+ price.currency.symbol
1218
+ ]
1219
+ }
1220
+ )
1221
+ ]
1222
+ }
1223
+ )
1224
+ ] })
1225
+ ] });
1226
+ }
1227
+ );
1228
+ var transactionPreview_default = TransactionPreview;
1229
+
1230
+ // src/react/ui/modals/_internal/components/transactionStatusModal/styles.css.ts
1231
+ var closeButton3 = "fyvr11lw fyvr1tc fyvr1mo";
1232
+ var dialogOverlay3 = "fyvr1m0 fyvr1o8 fyvr1qg fyvr1so fyvr11xl fyvr11m0 fyvr11rs";
1233
+ var transactionStatusModalContent = "modal_dialogContent_wide__1ypl6nt3 modal_dialogContentBase__1ypl6nt1 fyvr11hg fyvr11i4 fyvr11g4 fyvr11gs fyvr11l8 fyvr11wl fyvr11m0 fyvr11rs fyvr1vo fyvr1xs fyvr1zw fyvr1120 fyvr11lc fyvr11mc fyvr11cw";
1234
+
1235
+ // src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
1236
+ import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
1237
+ var useTransactionStatusModal = () => {
1238
+ return {
1239
+ show: (args) => transactionStatusModal$.open(args),
1240
+ close: () => transactionStatusModal$.close()
1241
+ };
1242
+ };
1243
+ var TransactionStatusModal = observer7(() => {
1244
+ const {
1245
+ hash,
1246
+ price,
1247
+ collectionAddress,
1248
+ chainId,
1249
+ tokenId,
1250
+ getTitle,
1251
+ getMessage: getMessage2,
1252
+ callbacks,
1253
+ queriesToInvalidate
1254
+ } = transactionStatusModal$.state.get();
1255
+ const { data: collectible } = useCollectible({
1256
+ collectionAddress,
1257
+ chainId,
1258
+ collectibleId: tokenId
1259
+ });
1260
+ const {
1261
+ data: transaction,
1262
+ isLoading: isConfirming,
1263
+ isSuccess: isConfirmed,
1264
+ isError: isFailed,
1265
+ error
1266
+ } = useTransactionReceipt({ hash });
1267
+ const title = getTitle && getTitle({ isConfirmed, isConfirming, isFailed });
1268
+ const message = getMessage2 && getMessage2({ isConfirmed, isConfirming, isFailed });
1269
+ const { onUnknownError, onSuccess } = callbacks || {};
1270
+ const queryClient = getQueryClient();
1271
+ useEffect4(() => {
1272
+ if (!transactionStatusModal$.isOpen.get()) return;
1273
+ let isSubscribed = true;
1274
+ if (isConfirmed && isSubscribed && onSuccess) {
1275
+ onSuccess();
1276
+ }
1277
+ if (isFailed && isSubscribed && onUnknownError) {
1278
+ onUnknownError(error);
1279
+ }
1280
+ if (isSubscribed && queriesToInvalidate) {
1281
+ queryClient.invalidateQueries({ queryKey: [...queriesToInvalidate] });
1282
+ }
1283
+ return () => {
1284
+ isSubscribed = false;
1285
+ };
1286
+ }, [isConfirmed, isFailed, onSuccess, onUnknownError, error]);
1287
+ return /* @__PURE__ */ jsx18(Root3, { open: transactionStatusModal$.isOpen.get(), children: /* @__PURE__ */ jsxs11(Portal3, { children: [
1288
+ /* @__PURE__ */ jsx18(Overlay, { className: dialogOverlay3 }),
1289
+ /* @__PURE__ */ jsxs11(Content3, { className: transactionStatusModalContent, children: [
1290
+ title ? /* @__PURE__ */ jsx18(
1291
+ Text9,
1292
+ {
1293
+ fontSize: "large",
1294
+ fontWeight: "bold",
1295
+ color: "text100",
1296
+ fontFamily: "body",
1297
+ children: title
1298
+ }
1299
+ ) : /* @__PURE__ */ jsx18(Skeleton4, { width: "16", height: "6" }),
1300
+ message ? /* @__PURE__ */ jsx18(Text9, { fontSize: "small", color: "text80", fontFamily: "body", children: message }) : /* @__PURE__ */ jsx18(Skeleton4, { width: "20", height: "4" }),
1301
+ collectible && /* @__PURE__ */ jsx18(
1302
+ transactionPreview_default,
1303
+ {
1304
+ price,
1305
+ collectionAddress,
1306
+ chainId,
1307
+ collectible,
1308
+ currencyImageUrl: price?.currency.imageUrl,
1309
+ isConfirming,
1310
+ isConfirmed,
1311
+ isFailed: isFailed || transaction?.status === "reverted"
1312
+ }
1313
+ ),
1314
+ /* @__PURE__ */ jsx18(
1315
+ TransactionFooter,
1316
+ {
1317
+ transactionHash: hash,
1318
+ isConfirming,
1319
+ isConfirmed,
1320
+ isFailed: isFailed || transaction?.status === "reverted",
1321
+ chainId
1322
+ }
1323
+ ),
1324
+ /* @__PURE__ */ jsx18(
1325
+ Close,
1326
+ {
1327
+ onClick: () => {
1328
+ transactionStatusModal$.close();
1329
+ },
1330
+ className: closeButton3,
1331
+ asChild: true,
1332
+ children: /* @__PURE__ */ jsx18(IconButton2, { size: "xs", "aria-label": "Close modal", icon: CloseIcon })
1333
+ }
1334
+ )
1335
+ ] })
1336
+ ] }) });
1337
+ });
1338
+ var transactionStatusModal_default = TransactionStatusModal;
1339
+
1340
+ // src/react/ui/modals/CreateListingModal/_store.ts
1341
+ import { observable as observable4 } from "@legendapp/state";
1342
+ import { addDays as addDays2 } from "date-fns/addDays";
1343
+ var initialState3 = {
1154
1344
  isOpen: false,
1155
1345
  collectionAddress: "",
1156
1346
  chainId: "",
@@ -1162,6 +1352,7 @@ var initialState2 = {
1162
1352
  currency: {}
1163
1353
  },
1164
1354
  quantity: "1",
1355
+ invalidQuantity: false,
1165
1356
  expiry: new Date(addDays2(/* @__PURE__ */ new Date(), 7).toJSON()),
1166
1357
  callbacks: void 0,
1167
1358
  onError: void 0,
@@ -1180,7 +1371,7 @@ var initialState2 = {
1180
1371
  createListingModal$.callbacks.set(void 0);
1181
1372
  }
1182
1373
  };
1183
- var createListingModal$ = observable3(initialState2);
1374
+ var createListingModal$ = observable4(initialState3);
1184
1375
 
1185
1376
  // src/react/ui/modals/CreateListingModal/_utils/getCreateListingTransactionTitleMessage.ts
1186
1377
  var getCreateListingTransactionTitle = (params) => {
@@ -1202,18 +1393,8 @@ var getCreateListingTransactionMessage = (params, collectibleName) => {
1202
1393
  return `You just listed ${collectibleName}. It should be confirmed on the blockchain shortly.`;
1203
1394
  };
1204
1395
 
1205
- // src/react/ui/modals/_internal/components/actionModal/LoadingModal.tsx
1206
- import { Box as Box10, Spinner as Spinner2 } from "@0xsequence/design-system";
1207
- import { jsx as jsx16 } from "react/jsx-runtime";
1208
- var LoadingModal = ({ store, onClose, title }) => /* @__PURE__ */ jsx16(ActionModal, { store, onClose, title, ctas: [], children: /* @__PURE__ */ jsx16(Box10, { display: "flex", justifyContent: "center", alignItems: "center", padding: "4", children: /* @__PURE__ */ jsx16(Spinner2, { size: "lg" }) }) });
1209
-
1210
- // src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx
1211
- import { Box as Box11 } from "@0xsequence/design-system";
1212
- import { jsx as jsx17 } from "react/jsx-runtime";
1213
- var ErrorModal = ({ store, onClose, title }) => /* @__PURE__ */ jsx17(ActionModal, { store, onClose, title, ctas: [], children: /* @__PURE__ */ jsx17(Box11, { display: "flex", justifyContent: "center", alignItems: "center", padding: "4", children: "Error loading item details" }) });
1214
-
1215
1396
  // src/react/ui/modals/CreateListingModal/index.tsx
1216
- import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
1397
+ import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
1217
1398
  var useCreateListingModal = (callbacks) => {
1218
1399
  return {
1219
1400
  show: (args) => createListingModal$.open({ ...args, defaultCallbacks: callbacks }),
@@ -1222,9 +1403,9 @@ var useCreateListingModal = (callbacks) => {
1222
1403
  };
1223
1404
  var CreateListingModal = () => {
1224
1405
  const { show: showTransactionStatusModal } = useTransactionStatusModal();
1225
- return /* @__PURE__ */ jsx18(Show, { if: createListingModal$.isOpen, children: /* @__PURE__ */ jsx18(Modal2, { showTransactionStatusModal }) });
1406
+ return /* @__PURE__ */ jsx19(Show2, { if: createListingModal$.isOpen, children: /* @__PURE__ */ jsx19(Modal2, { showTransactionStatusModal }) });
1226
1407
  };
1227
- var Modal2 = observer7(
1408
+ var Modal2 = observer8(
1228
1409
  ({
1229
1410
  showTransactionStatusModal
1230
1411
  }) => {
@@ -1247,7 +1428,14 @@ var Modal2 = observer7(
1247
1428
  chainId,
1248
1429
  collectionAddress
1249
1430
  });
1250
- const { getListingSteps } = useCreateListing({
1431
+ const { address } = useAccount3();
1432
+ const { data: balance } = useBalanceOfCollectible({
1433
+ chainId,
1434
+ collectionAddress,
1435
+ collectableId: collectibleId,
1436
+ userAddress: address
1437
+ });
1438
+ const { getListingSteps, isLoading: machineLoading } = useCreateListing({
1251
1439
  chainId,
1252
1440
  collectionAddress,
1253
1441
  onTransactionSent: (hash) => {
@@ -1266,7 +1454,11 @@ var Modal2 = observer7(
1266
1454
  createListingModal$.close();
1267
1455
  },
1268
1456
  onError: (error) => {
1269
- createListingModal$.onError?.(error);
1457
+ if (typeof createListingModal$.callbacks?.onError === "function") {
1458
+ createListingModal$.onError(error);
1459
+ } else {
1460
+ console.debug("onError callback not provided:", error);
1461
+ }
1270
1462
  }
1271
1463
  });
1272
1464
  const handleStepExecution = async (execute) => {
@@ -1278,8 +1470,8 @@ var Modal2 = observer7(
1278
1470
  createListingModal$.onError?.(error);
1279
1471
  }
1280
1472
  };
1281
- if (collectableIsLoading || collectionIsLoading) {
1282
- return /* @__PURE__ */ jsx18(
1473
+ if (collectableIsLoading || collectionIsLoading || machineLoading) {
1474
+ return /* @__PURE__ */ jsx19(
1283
1475
  LoadingModal,
1284
1476
  {
1285
1477
  store: createListingModal$,
@@ -1289,7 +1481,7 @@ var Modal2 = observer7(
1289
1481
  );
1290
1482
  }
1291
1483
  if (collectableIsError || collectionIsError) {
1292
- return /* @__PURE__ */ jsx18(
1484
+ return /* @__PURE__ */ jsx19(
1293
1485
  ErrorModal,
1294
1486
  {
1295
1487
  store: createListingModal$,
@@ -1316,13 +1508,14 @@ var Modal2 = observer7(
1316
1508
  onClick: () => handleStepExecution(() => steps?.approval.execute()),
1317
1509
  hidden: !steps?.approval.isPending,
1318
1510
  pending: steps?.approval.isExecuting,
1319
- variant: "glass"
1511
+ variant: "glass",
1512
+ disabled: createListingModal$.invalidQuantity.get()
1320
1513
  },
1321
1514
  {
1322
1515
  label: "List item for sale",
1323
1516
  onClick: () => handleStepExecution(() => steps?.transaction.execute()),
1324
1517
  pending: steps?.transaction.isExecuting || isLoading,
1325
- disabled: steps?.approval.isPending || listingPrice.amountRaw === "0" || isLoading
1518
+ disabled: steps?.approval.isPending || listingPrice.amountRaw === "0" || isLoading || createListingModal$.invalidQuantity.get()
1326
1519
  }
1327
1520
  ];
1328
1521
  return /* @__PURE__ */ jsxs12(
@@ -1333,7 +1526,7 @@ var Modal2 = observer7(
1333
1526
  title: "List item for sale",
1334
1527
  ctas,
1335
1528
  children: [
1336
- /* @__PURE__ */ jsx18(
1529
+ /* @__PURE__ */ jsx19(
1337
1530
  TokenPreview,
1338
1531
  {
1339
1532
  collectionName: collection?.name,
@@ -1343,7 +1536,7 @@ var Modal2 = observer7(
1343
1536
  }
1344
1537
  ),
1345
1538
  /* @__PURE__ */ jsxs12(Box12, { display: "flex", flexDirection: "column", width: "full", gap: "1", children: [
1346
- /* @__PURE__ */ jsx18(
1539
+ /* @__PURE__ */ jsx19(
1347
1540
  priceInput_default,
1348
1541
  {
1349
1542
  chainId,
@@ -1351,7 +1544,7 @@ var Modal2 = observer7(
1351
1544
  $listingPrice: createListingModal$.listingPrice
1352
1545
  }
1353
1546
  ),
1354
- !!listingPrice && /* @__PURE__ */ jsx18(
1547
+ !!listingPrice && /* @__PURE__ */ jsx19(
1355
1548
  FloorPriceText,
1356
1549
  {
1357
1550
  tokenId: collectibleId,
@@ -1361,17 +1554,17 @@ var Modal2 = observer7(
1361
1554
  }
1362
1555
  )
1363
1556
  ] }),
1364
- collection?.type === "ERC1155" && /* @__PURE__ */ jsx18(
1557
+ collection?.type === "ERC1155" && balance && /* @__PURE__ */ jsx19(
1365
1558
  QuantityInput,
1366
1559
  {
1367
- chainId,
1368
- collectionAddress,
1369
- collectibleId,
1370
- $quantity: createListingModal$.quantity
1560
+ $quantity: createListingModal$.quantity,
1561
+ $invalidQuantity: createListingModal$.invalidQuantity,
1562
+ decimals: collectible?.decimals || 0,
1563
+ maxQuantity: balance?.balance
1371
1564
  }
1372
1565
  ),
1373
- /* @__PURE__ */ jsx18(expirationDateSelect_default, { $date: createListingModal$.expiry }),
1374
- /* @__PURE__ */ jsx18(
1566
+ /* @__PURE__ */ jsx19(expirationDateSelect_default, { $date: createListingModal$.expiry }),
1567
+ /* @__PURE__ */ jsx19(
1375
1568
  TransactionDetails,
1376
1569
  {
1377
1570
  collectibleId,
@@ -1388,11 +1581,11 @@ var Modal2 = observer7(
1388
1581
  );
1389
1582
 
1390
1583
  // src/react/ui/modals/MakeOfferModal/index.tsx
1391
- import { Show as Show2, observer as observer8 } from "@legendapp/state/react";
1392
- import { useEffect as useEffect4, useState as useState6 } from "react";
1584
+ import { Show as Show3, observer as observer9 } from "@legendapp/state/react";
1585
+ import { useEffect as useEffect5, useState as useState6 } from "react";
1393
1586
 
1394
1587
  // src/react/hooks/useMakeOffer.tsx
1395
- import { useState as useState5, useCallback as useCallback2 } from "react";
1588
+ import { useCallback as useCallback2, useState as useState5 } from "react";
1396
1589
  var useMakeOffer = ({
1397
1590
  onSuccess,
1398
1591
  onError,
@@ -1401,7 +1594,7 @@ var useMakeOffer = ({
1401
1594
  }) => {
1402
1595
  const [isLoading, setIsLoading] = useState5(false);
1403
1596
  const [steps, setSteps] = useState5(null);
1404
- const machine = useTransactionMachine(
1597
+ const { machine, isLoading: isMachineLoading } = useTransactionMachine(
1405
1598
  {
1406
1599
  ...config,
1407
1600
  type: "OFFER" /* OFFER */
@@ -1414,31 +1607,31 @@ var useMakeOffer = ({
1414
1607
  async (props) => {
1415
1608
  if (!machine) return;
1416
1609
  setIsLoading(true);
1417
- try {
1418
- const generatedSteps = await machine.getTransactionSteps(props);
1419
- setSteps(generatedSteps);
1420
- } catch (error) {
1421
- onError?.(error);
1422
- } finally {
1610
+ const generatedSteps = await machine.getTransactionSteps(props);
1611
+ if (!generatedSteps) {
1423
1612
  setIsLoading(false);
1613
+ return;
1424
1614
  }
1615
+ setSteps(generatedSteps);
1616
+ setIsLoading(false);
1425
1617
  },
1426
1618
  [machine, onError]
1427
1619
  );
1428
1620
  return {
1429
- makeOffer: (props) => machine?.start({ props }),
1621
+ makeOffer: (props) => machine?.start(props),
1430
1622
  getMakeOfferSteps: (props) => ({
1431
1623
  isLoading,
1432
1624
  steps,
1433
1625
  refreshSteps: () => loadSteps(props)
1434
- })
1626
+ }),
1627
+ isLoading: isMachineLoading
1435
1628
  };
1436
1629
  };
1437
1630
 
1438
1631
  // src/react/ui/modals/MakeOfferModal/_store.ts
1439
- import { observable as observable4 } from "@legendapp/state";
1632
+ import { observable as observable5 } from "@legendapp/state";
1440
1633
  import { addDays as addDays3 } from "date-fns/addDays";
1441
- var initialState3 = {
1634
+ var initialState4 = {
1442
1635
  isOpen: false,
1443
1636
  collectionAddress: "",
1444
1637
  chainId: "",
@@ -1449,6 +1642,7 @@ var initialState3 = {
1449
1642
  currency: {}
1450
1643
  },
1451
1644
  quantity: "1",
1645
+ invalidQuantity: false,
1452
1646
  expiry: new Date(addDays3(/* @__PURE__ */ new Date(), 7).toJSON()),
1453
1647
  open: (args) => {
1454
1648
  makeOfferModal$.collectionAddress.set(args.collectionAddress);
@@ -1462,7 +1656,7 @@ var initialState3 = {
1462
1656
  makeOfferModal$.callbacks.set(void 0);
1463
1657
  }
1464
1658
  };
1465
- var makeOfferModal$ = observable4(initialState3);
1659
+ var makeOfferModal$ = observable5(initialState4);
1466
1660
 
1467
1661
  // src/react/ui/modals/MakeOfferModal/_utils/getMakeOfferTransactionTitleMessage.ts
1468
1662
  var getMakeOfferTransactionTitle = (params) => {
@@ -1485,16 +1679,16 @@ var getMakeOfferTransactionMessage = (params, collectibleName) => {
1485
1679
  };
1486
1680
 
1487
1681
  // src/react/ui/modals/MakeOfferModal/index.tsx
1488
- import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
1682
+ import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
1489
1683
  var useMakeOfferModal = (defaultCallbacks) => ({
1490
1684
  show: (args) => makeOfferModal$.open({ ...args, callbacks: defaultCallbacks }),
1491
1685
  close: makeOfferModal$.close
1492
1686
  });
1493
1687
  var MakeOfferModal = () => {
1494
1688
  const { show: showTransactionStatusModal } = useTransactionStatusModal();
1495
- return /* @__PURE__ */ jsx19(Show2, { if: makeOfferModal$.isOpen, children: /* @__PURE__ */ jsx19(ModalContent, { showTransactionStatusModal }) });
1689
+ return /* @__PURE__ */ jsx20(Show3, { if: makeOfferModal$.isOpen, children: /* @__PURE__ */ jsx20(ModalContent, { showTransactionStatusModal }) });
1496
1690
  };
1497
- var ModalContent = observer8(
1691
+ var ModalContent = observer9(
1498
1692
  ({
1499
1693
  showTransactionStatusModal
1500
1694
  }) => {
@@ -1541,10 +1735,18 @@ var ModalContent = observer8(
1541
1735
  makeOfferModal$.close();
1542
1736
  },
1543
1737
  onSuccess: (hash) => {
1544
- makeOfferModal$.callbacks?.onSuccess?.(hash);
1738
+ if (typeof makeOfferModal$.callbacks?.onSuccess === "function") {
1739
+ makeOfferModal$.callbacks.onSuccess(hash);
1740
+ } else {
1741
+ console.debug("onSuccess callback not provided:", hash);
1742
+ }
1545
1743
  },
1546
1744
  onError: (error) => {
1547
- makeOfferModal$.callbacks?.onError?.(error);
1745
+ if (typeof makeOfferModal$.callbacks?.onError === "function") {
1746
+ makeOfferModal$.callbacks.onError(error);
1747
+ } else {
1748
+ console.debug("onError callback not provided:", error);
1749
+ }
1548
1750
  }
1549
1751
  });
1550
1752
  const dateToUnixTime = (date) => Math.floor(date.getTime() / 1e3).toString();
@@ -1559,12 +1761,12 @@ var ModalContent = observer8(
1559
1761
  pricePerToken: offerPrice.amountRaw
1560
1762
  }
1561
1763
  });
1562
- useEffect4(() => {
1764
+ useEffect5(() => {
1563
1765
  if (!currencyAddress) return;
1564
1766
  refreshSteps();
1565
1767
  }, [currencyAddress]);
1566
1768
  if (collectableIsLoading || collectionIsLoading || currenciesIsLoading) {
1567
- return /* @__PURE__ */ jsx19(
1769
+ return /* @__PURE__ */ jsx20(
1568
1770
  LoadingModal,
1569
1771
  {
1570
1772
  store: makeOfferModal$,
@@ -1574,7 +1776,7 @@ var ModalContent = observer8(
1574
1776
  );
1575
1777
  }
1576
1778
  if (collectableIsError || collectionIsError) {
1577
- return /* @__PURE__ */ jsx19(
1779
+ return /* @__PURE__ */ jsx20(
1578
1780
  ErrorModal,
1579
1781
  {
1580
1782
  store: makeOfferModal$,
@@ -1598,13 +1800,14 @@ var ModalContent = observer8(
1598
1800
  onClick: () => handleStepExecution(() => steps?.approval.execute()),
1599
1801
  hidden: !steps?.approval.isPending,
1600
1802
  pending: steps?.approval.isExecuting,
1601
- variant: "glass"
1803
+ variant: "glass",
1804
+ disabled: makeOfferModal$.invalidQuantity.get()
1602
1805
  },
1603
1806
  {
1604
1807
  label: "Make offer",
1605
1808
  onClick: () => handleStepExecution(() => steps?.transaction.execute()),
1606
1809
  pending: steps?.transaction.isExecuting || isLoading,
1607
- disabled: steps?.approval.isPending || offerPrice.amountRaw === "0" || insufficientBalance || isLoading
1810
+ disabled: steps?.approval.isPending || offerPrice.amountRaw === "0" || insufficientBalance || isLoading || makeOfferModal$.invalidQuantity.get()
1608
1811
  }
1609
1812
  ];
1610
1813
  return /* @__PURE__ */ jsxs13(
@@ -1615,7 +1818,7 @@ var ModalContent = observer8(
1615
1818
  title: "Make an offer",
1616
1819
  ctas,
1617
1820
  children: [
1618
- /* @__PURE__ */ jsx19(
1821
+ /* @__PURE__ */ jsx20(
1619
1822
  TokenPreview,
1620
1823
  {
1621
1824
  collectionName: collection?.name,
@@ -1624,7 +1827,7 @@ var ModalContent = observer8(
1624
1827
  chainId
1625
1828
  }
1626
1829
  ),
1627
- /* @__PURE__ */ jsx19(
1830
+ /* @__PURE__ */ jsx20(
1628
1831
  priceInput_default,
1629
1832
  {
1630
1833
  chainId,
@@ -1636,16 +1839,16 @@ var ModalContent = observer8(
1636
1839
  }
1637
1840
  }
1638
1841
  ),
1639
- collection?.type === "ERC1155" /* ERC1155 */ && /* @__PURE__ */ jsx19(
1842
+ collection?.type === "ERC1155" /* ERC1155 */ && /* @__PURE__ */ jsx20(
1640
1843
  QuantityInput,
1641
1844
  {
1642
- chainId,
1643
1845
  $quantity: makeOfferModal$.quantity,
1644
- collectionAddress,
1645
- collectibleId
1846
+ $invalidQuantity: makeOfferModal$.invalidQuantity,
1847
+ decimals: collectible?.decimals || 0,
1848
+ maxQuantity: String(Number.MAX_SAFE_INTEGER)
1646
1849
  }
1647
1850
  ),
1648
- !!offerPrice && /* @__PURE__ */ jsx19(
1851
+ !!offerPrice && /* @__PURE__ */ jsx20(
1649
1852
  FloorPriceText,
1650
1853
  {
1651
1854
  tokenId: collectibleId,
@@ -1654,7 +1857,7 @@ var ModalContent = observer8(
1654
1857
  price: offerPrice
1655
1858
  }
1656
1859
  ),
1657
- /* @__PURE__ */ jsx19(expirationDateSelect_default, { $date: makeOfferModal$.expiry })
1860
+ /* @__PURE__ */ jsx20(expirationDateSelect_default, { $date: makeOfferModal$.expiry })
1658
1861
  ]
1659
1862
  }
1660
1863
  );
@@ -1662,53 +1865,10 @@ var ModalContent = observer8(
1662
1865
  );
1663
1866
 
1664
1867
  // src/react/ui/modals/SellModal/index.tsx
1665
- import { Show as Show3, observer as observer9 } from "@legendapp/state/react";
1666
-
1667
- // src/react/ui/modals/_internal/components/transactionHeader/index.tsx
1668
- import { Box as Box13, Image as Image4, Skeleton as Skeleton5, Text as Text10 } from "@0xsequence/design-system";
1669
- import { formatDistanceToNow as formatDistanceToNow2 } from "date-fns";
1670
- import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
1671
- function TransactionHeader({
1672
- title,
1673
- currencyImageUrl,
1674
- date
1675
- }) {
1676
- return /* @__PURE__ */ jsxs14(Box13, { display: "flex", alignItems: "center", width: "full", children: [
1677
- /* @__PURE__ */ jsx20(Text10, { fontSize: "small", fontWeight: "medium", color: "text80", marginRight: "1", children: title }),
1678
- /* @__PURE__ */ jsx20(Image4, { src: currencyImageUrl, width: "3", height: "3", marginRight: "1" }),
1679
- date && /* @__PURE__ */ jsxs14(Text10, { fontSize: "small", color: "text50", flexGrow: "1", textAlign: "right", children: [
1680
- formatDistanceToNow2(date),
1681
- " ago"
1682
- ] }) || /* @__PURE__ */ jsx20(Skeleton5, { width: "8", height: "4" })
1683
- ] });
1684
- }
1685
-
1686
- // src/react/ui/modals/SellModal/_store.ts
1687
- import { observable as observable5 } from "@legendapp/state";
1688
- var initialState4 = {
1689
- isOpen: false,
1690
- collectionAddress: "",
1691
- chainId: "",
1692
- tokenId: "",
1693
- order: void 0,
1694
- callbacks: void 0,
1695
- open: (args) => {
1696
- sellModal$.collectionAddress.set(args.collectionAddress);
1697
- sellModal$.chainId.set(args.chainId);
1698
- sellModal$.tokenId.set(args.tokenId);
1699
- sellModal$.order.set(args.order);
1700
- sellModal$.callbacks.set(args.callbacks);
1701
- sellModal$.isOpen.set(true);
1702
- },
1703
- close: () => {
1704
- sellModal$.isOpen.set(false);
1705
- sellModal$.callbacks.set(void 0);
1706
- }
1707
- };
1708
- var sellModal$ = observable5(initialState4);
1868
+ import { Show as Show4, observer as observer10 } from "@legendapp/state/react";
1709
1869
 
1710
1870
  // src/react/hooks/useSell.tsx
1711
- import { useState as useState7, useCallback as useCallback3 } from "react";
1871
+ import { useCallback as useCallback3, useState as useState7 } from "react";
1712
1872
  var useSell = ({
1713
1873
  onSuccess,
1714
1874
  onError,
@@ -1717,7 +1877,7 @@ var useSell = ({
1717
1877
  }) => {
1718
1878
  const [isLoading, setIsLoading] = useState7(false);
1719
1879
  const [steps, setSteps] = useState7(null);
1720
- const machine = useTransactionMachine(
1880
+ const { machine, isLoading: isMachineLoading } = useTransactionMachine(
1721
1881
  {
1722
1882
  ...config,
1723
1883
  type: "SELL" /* SELL */
@@ -1730,27 +1890,90 @@ var useSell = ({
1730
1890
  async (props) => {
1731
1891
  if (!machine) return;
1732
1892
  setIsLoading(true);
1733
- try {
1734
- const generatedSteps = await machine.getTransactionSteps(props);
1735
- setSteps(generatedSteps);
1736
- } catch (error) {
1737
- onError?.(error);
1738
- } finally {
1893
+ const generatedSteps = await machine.getTransactionSteps(props);
1894
+ if (!generatedSteps) {
1739
1895
  setIsLoading(false);
1896
+ return;
1740
1897
  }
1898
+ setSteps(generatedSteps);
1899
+ setIsLoading(false);
1741
1900
  },
1742
1901
  [machine, onError]
1743
1902
  );
1744
1903
  return {
1745
- sell: (props) => machine?.start({ props }),
1904
+ sell: (props) => machine?.start(props),
1746
1905
  getSellSteps: (props) => ({
1747
1906
  isLoading,
1748
1907
  steps,
1749
1908
  refreshSteps: () => loadSteps(props)
1750
- })
1909
+ }),
1910
+ isLoading: isMachineLoading
1751
1911
  };
1752
1912
  };
1753
1913
 
1914
+ // src/react/ui/modals/_internal/components/transactionHeader/index.tsx
1915
+ import { Box as Box13, Image as Image4, Skeleton as Skeleton5, Text as Text10 } from "@0xsequence/design-system";
1916
+ import { formatDistanceToNow as formatDistanceToNow2 } from "date-fns";
1917
+ import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
1918
+ function TransactionHeader({
1919
+ title,
1920
+ currencyImageUrl,
1921
+ date
1922
+ }) {
1923
+ return /* @__PURE__ */ jsxs14(Box13, { display: "flex", alignItems: "center", width: "full", children: [
1924
+ /* @__PURE__ */ jsx21(
1925
+ Text10,
1926
+ {
1927
+ fontSize: "small",
1928
+ fontWeight: "medium",
1929
+ color: "text80",
1930
+ marginRight: "1",
1931
+ fontFamily: "body",
1932
+ children: title
1933
+ }
1934
+ ),
1935
+ /* @__PURE__ */ jsx21(Image4, { src: currencyImageUrl, width: "3", height: "3", marginRight: "1" }),
1936
+ date && /* @__PURE__ */ jsxs14(
1937
+ Text10,
1938
+ {
1939
+ fontSize: "small",
1940
+ color: "text50",
1941
+ flexGrow: "1",
1942
+ textAlign: "right",
1943
+ fontFamily: "body",
1944
+ children: [
1945
+ formatDistanceToNow2(date),
1946
+ " ago"
1947
+ ]
1948
+ }
1949
+ ) || /* @__PURE__ */ jsx21(Skeleton5, { width: "8", height: "4" })
1950
+ ] });
1951
+ }
1952
+
1953
+ // src/react/ui/modals/SellModal/_store.ts
1954
+ import { observable as observable6 } from "@legendapp/state";
1955
+ var initialState5 = {
1956
+ isOpen: false,
1957
+ collectionAddress: "",
1958
+ chainId: "",
1959
+ tokenId: "",
1960
+ order: void 0,
1961
+ callbacks: void 0,
1962
+ open: (args) => {
1963
+ sellModal$.collectionAddress.set(args.collectionAddress);
1964
+ sellModal$.chainId.set(args.chainId);
1965
+ sellModal$.tokenId.set(args.tokenId);
1966
+ sellModal$.order.set(args.order);
1967
+ sellModal$.callbacks.set(args.callbacks);
1968
+ sellModal$.isOpen.set(true);
1969
+ },
1970
+ close: () => {
1971
+ sellModal$.isOpen.set(false);
1972
+ sellModal$.callbacks.set(void 0);
1973
+ }
1974
+ };
1975
+ var sellModal$ = observable6(initialState5);
1976
+
1754
1977
  // src/react/ui/modals/SellModal/_utils/getSellTransactionTitleMessage.ts
1755
1978
  var getSellTransactionTitle = (params) => {
1756
1979
  if (params.isConfirmed) {
@@ -1772,16 +1995,16 @@ var getSellTransactionMessage = (params, collectibleName) => {
1772
1995
  };
1773
1996
 
1774
1997
  // src/react/ui/modals/SellModal/index.tsx
1775
- import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
1998
+ import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
1776
1999
  var useSellModal = (defaultCallbacks) => ({
1777
2000
  show: (args) => sellModal$.open({ ...args, callbacks: defaultCallbacks }),
1778
2001
  close: sellModal$.close
1779
2002
  });
1780
2003
  var SellModal = () => {
1781
2004
  const { show: showTransactionStatusModal } = useTransactionStatusModal();
1782
- return /* @__PURE__ */ jsx21(Show3, { if: sellModal$.isOpen, children: /* @__PURE__ */ jsx21(ModalContent2, { showTransactionStatusModal }) });
2005
+ return /* @__PURE__ */ jsx22(Show4, { if: sellModal$.isOpen, children: /* @__PURE__ */ jsx22(ModalContent2, { showTransactionStatusModal }) });
1783
2006
  };
1784
- var ModalContent2 = observer9(
2007
+ var ModalContent2 = observer10(
1785
2008
  ({
1786
2009
  showTransactionStatusModal
1787
2010
  }) => {
@@ -1817,10 +2040,18 @@ var ModalContent2 = observer9(
1817
2040
  sellModal$.close();
1818
2041
  },
1819
2042
  onSuccess: (hash) => {
1820
- sellModal$.callbacks?.onSuccess?.(hash);
2043
+ if (typeof sellModal$.callbacks?.onSuccess === "function") {
2044
+ sellModal$.callbacks.onSuccess(hash);
2045
+ } else {
2046
+ console.debug("onSuccess callback not provided:", hash);
2047
+ }
1821
2048
  },
1822
2049
  onError: (error) => {
1823
- sellModal$.callbacks?.onError?.(error);
2050
+ if (typeof sellModal$.callbacks?.onError === "function") {
2051
+ sellModal$.callbacks.onError(error);
2052
+ } else {
2053
+ console.debug("onError callback not provided:", error);
2054
+ }
1824
2055
  }
1825
2056
  });
1826
2057
  const {
@@ -1836,7 +2067,7 @@ var ModalContent2 = observer9(
1836
2067
  collectionAddress
1837
2068
  });
1838
2069
  if (collectionLoading || currenciesLoading) {
1839
- return /* @__PURE__ */ jsx21(
2070
+ return /* @__PURE__ */ jsx22(
1840
2071
  LoadingModal,
1841
2072
  {
1842
2073
  store: sellModal$,
@@ -1846,7 +2077,7 @@ var ModalContent2 = observer9(
1846
2077
  );
1847
2078
  }
1848
2079
  if (collectionError || order === void 0) {
1849
- return /* @__PURE__ */ jsx21(
2080
+ return /* @__PURE__ */ jsx22(
1850
2081
  ErrorModal,
1851
2082
  {
1852
2083
  store: sellModal$,
@@ -1874,7 +2105,7 @@ var ModalContent2 = observer9(
1874
2105
  }
1875
2106
  ],
1876
2107
  children: [
1877
- /* @__PURE__ */ jsx21(
2108
+ /* @__PURE__ */ jsx22(
1878
2109
  TransactionHeader,
1879
2110
  {
1880
2111
  title: "Offer received",
@@ -1882,7 +2113,7 @@ var ModalContent2 = observer9(
1882
2113
  date: order && new Date(order.createdAt)
1883
2114
  }
1884
2115
  ),
1885
- /* @__PURE__ */ jsx21(
2116
+ /* @__PURE__ */ jsx22(
1886
2117
  TokenPreview,
1887
2118
  {
1888
2119
  collectionName: collection?.name,
@@ -1891,7 +2122,7 @@ var ModalContent2 = observer9(
1891
2122
  chainId
1892
2123
  }
1893
2124
  ),
1894
- /* @__PURE__ */ jsx21(
2125
+ /* @__PURE__ */ jsx22(
1895
2126
  TransactionDetails,
1896
2127
  {
1897
2128
  collectibleId: tokenId,
@@ -1920,12 +2151,12 @@ import {
1920
2151
  Image as Image5,
1921
2152
  Text as Text11
1922
2153
  } from "@0xsequence/design-system";
1923
- import { observer as observer10 } from "@legendapp/state/react";
2154
+ import { observer as observer11 } from "@legendapp/state/react";
1924
2155
  import { Close as Close2, Content as Content4, Overlay as Overlay2, Portal as Portal4, Root as Root4 } from "@radix-ui/react-dialog";
1925
2156
 
1926
2157
  // src/react/ui/modals/SuccessfulPurchaseModal/_store.ts
1927
- import { observable as observable6 } from "@legendapp/state";
1928
- var initialState5 = {
2158
+ import { observable as observable7 } from "@legendapp/state";
2159
+ var initialState6 = {
1929
2160
  isOpen: false,
1930
2161
  open: ({
1931
2162
  collectibles,
@@ -1951,7 +2182,7 @@ var initialState5 = {
1951
2182
  successfulPurchaseModal$.isOpen.set(false);
1952
2183
  successfulPurchaseModal$.callbacks.set(void 0);
1953
2184
  successfulPurchaseModal$.state.set({
1954
- ...initialState5.state
2185
+ ...initialState6.state
1955
2186
  });
1956
2187
  },
1957
2188
  state: {
@@ -1963,22 +2194,22 @@ var initialState5 = {
1963
2194
  },
1964
2195
  callbacks: void 0
1965
2196
  };
1966
- var successfulPurchaseModal$ = observable6(initialState5);
2197
+ var successfulPurchaseModal$ = observable7(initialState6);
1967
2198
 
1968
2199
  // src/react/ui/modals/SuccessfulPurchaseModal/index.tsx
1969
- import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
2200
+ import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
1970
2201
  var useSuccessfulPurchaseModal = (callbacks) => {
1971
2202
  return {
1972
2203
  show: (args) => successfulPurchaseModal$.open({ ...args, defaultCallbacks: callbacks }),
1973
2204
  close: () => successfulPurchaseModal$.close()
1974
2205
  };
1975
2206
  };
1976
- var SuccessfulPurchaseModal = observer10(() => {
1977
- return /* @__PURE__ */ jsx22(Root4, { open: successfulPurchaseModal$.isOpen.get(), children: /* @__PURE__ */ jsxs16(Portal4, { children: [
1978
- /* @__PURE__ */ jsx22(Overlay2, { className: dialogOverlay }),
2207
+ var SuccessfulPurchaseModal = observer11(() => {
2208
+ return /* @__PURE__ */ jsx23(Root4, { open: successfulPurchaseModal$.isOpen.get(), children: /* @__PURE__ */ jsxs16(Portal4, { children: [
2209
+ /* @__PURE__ */ jsx23(Overlay2, { className: dialogOverlay }),
1979
2210
  /* @__PURE__ */ jsxs16(Content4, { className: dialogContent.narrow, children: [
1980
2211
  /* @__PURE__ */ jsxs16(Box14, { display: "flex", flexDirection: "column", gap: "4", width: "full", children: [
1981
- /* @__PURE__ */ jsx22(
2212
+ /* @__PURE__ */ jsx23(
1982
2213
  Text11,
1983
2214
  {
1984
2215
  textAlign: "center",
@@ -1988,21 +2219,21 @@ var SuccessfulPurchaseModal = observer10(() => {
1988
2219
  children: "Successful purchase!"
1989
2220
  }
1990
2221
  ),
1991
- /* @__PURE__ */ jsx22(
2222
+ /* @__PURE__ */ jsx23(
1992
2223
  CollectiblesGrid,
1993
2224
  {
1994
2225
  collectibles: successfulPurchaseModal$.state.get().collectibles
1995
2226
  }
1996
2227
  ),
1997
2228
  /* @__PURE__ */ jsxs16(Box14, { display: "flex", alignItems: "center", gap: "1", children: [
1998
- /* @__PURE__ */ jsx22(Text11, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "You bought" }),
1999
- /* @__PURE__ */ jsx22(Text11, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().collectibles.length }),
2000
- /* @__PURE__ */ jsx22(Text11, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "items for" }),
2001
- /* @__PURE__ */ jsx22(Text11, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().totalPrice })
2229
+ /* @__PURE__ */ jsx23(Text11, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "You bought" }),
2230
+ /* @__PURE__ */ jsx23(Text11, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().collectibles.length }),
2231
+ /* @__PURE__ */ jsx23(Text11, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "items for" }),
2232
+ /* @__PURE__ */ jsx23(Text11, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().totalPrice })
2002
2233
  ] }),
2003
- /* @__PURE__ */ jsx22(SuccessfulPurchaseActions, {})
2234
+ /* @__PURE__ */ jsx23(SuccessfulPurchaseActions, {})
2004
2235
  ] }),
2005
- /* @__PURE__ */ jsx22(
2236
+ /* @__PURE__ */ jsx23(
2006
2237
  Close2,
2007
2238
  {
2008
2239
  onClick: () => {
@@ -2010,7 +2241,7 @@ var SuccessfulPurchaseModal = observer10(() => {
2010
2241
  },
2011
2242
  className: closeButton,
2012
2243
  asChild: true,
2013
- children: /* @__PURE__ */ jsx22(IconButton3, { size: "xs", "aria-label": "Close modal", icon: CloseIcon2 })
2244
+ children: /* @__PURE__ */ jsx23(IconButton3, { size: "xs", "aria-label": "Close modal", icon: CloseIcon2 })
2014
2245
  }
2015
2246
  )
2016
2247
  ] })
@@ -2018,7 +2249,7 @@ var SuccessfulPurchaseModal = observer10(() => {
2018
2249
  });
2019
2250
  function SuccessfulPurchaseActions() {
2020
2251
  return /* @__PURE__ */ jsxs16(Box14, { display: "flex", flexDirection: "column", gap: "2", children: [
2021
- successfulPurchaseModal$.state.ctaOptions.get() && /* @__PURE__ */ jsx22(
2252
+ successfulPurchaseModal$.state.ctaOptions.get() && /* @__PURE__ */ jsx23(
2022
2253
  Button3,
2023
2254
  {
2024
2255
  shape: "square",
@@ -2028,7 +2259,7 @@ function SuccessfulPurchaseActions() {
2028
2259
  onClick: successfulPurchaseModal$.state.ctaOptions.ctaOnClick.get() || void 0
2029
2260
  }
2030
2261
  ),
2031
- /* @__PURE__ */ jsx22(
2262
+ /* @__PURE__ */ jsx23(
2032
2263
  Button3,
2033
2264
  {
2034
2265
  as: "a",
@@ -2046,7 +2277,7 @@ function SuccessfulPurchaseActions() {
2046
2277
  function CollectiblesGrid({ collectibles }) {
2047
2278
  const total = collectibles.length;
2048
2279
  const shownCollectibles = total > 4 ? collectibles.slice(0, 4) : collectibles;
2049
- return /* @__PURE__ */ jsx22(Box14, { className: collectiblesGrid, display: "grid", gap: "2", children: shownCollectibles.map((collectible) => {
2280
+ return /* @__PURE__ */ jsx23(Box14, { className: collectiblesGrid, display: "grid", gap: "2", children: shownCollectibles.map((collectible) => {
2050
2281
  const showPlus = total > 4 && collectibles.indexOf(collectible) === 3;
2051
2282
  return /* @__PURE__ */ jsxs16(
2052
2283
  Box14,
@@ -2054,7 +2285,7 @@ function CollectiblesGrid({ collectibles }) {
2054
2285
  className: collectiblesGridItem,
2055
2286
  position: "relative",
2056
2287
  children: [
2057
- /* @__PURE__ */ jsx22(
2288
+ /* @__PURE__ */ jsx23(
2058
2289
  Image5,
2059
2290
  {
2060
2291
  src: collectible.image,
@@ -2065,7 +2296,7 @@ function CollectiblesGrid({ collectibles }) {
2065
2296
  borderRadius: "sm"
2066
2297
  }
2067
2298
  ),
2068
- showPlus && /* @__PURE__ */ jsx22(
2299
+ showPlus && /* @__PURE__ */ jsx23(
2069
2300
  Box14,
2070
2301
  {
2071
2302
  position: "absolute",
@@ -2107,13 +2338,13 @@ var SuccessfulPurchaseModal_default = SuccessfulPurchaseModal;
2107
2338
 
2108
2339
  // src/react/ui/modals/TransferModal/index.tsx
2109
2340
  import { CloseIcon as CloseIcon3, IconButton as IconButton4 } from "@0xsequence/design-system";
2110
- import { Show as Show4, observer as observer12 } from "@legendapp/state/react";
2341
+ import { Show as Show5, observer as observer13 } from "@legendapp/state/react";
2111
2342
  import { Close as Close3, Content as Content5, Overlay as Overlay3, Portal as Portal5, Root as Root5 } from "@radix-ui/react-dialog";
2112
- import { useAccount as useAccount4 } from "wagmi";
2343
+ import { useAccount as useAccount5 } from "wagmi";
2113
2344
 
2114
2345
  // src/react/ui/modals/TransferModal/_store.ts
2115
- import { observable as observable7 } from "@legendapp/state";
2116
- var initialState6 = {
2346
+ import { observable as observable8 } from "@legendapp/state";
2347
+ var initialState7 = {
2117
2348
  isOpen: false,
2118
2349
  open: ({ chainId, collectionAddress, tokenId }) => {
2119
2350
  transferModal$.state.set({
@@ -2127,7 +2358,7 @@ var initialState6 = {
2127
2358
  close: () => {
2128
2359
  transferModal$.isOpen.set(false);
2129
2360
  transferModal$.state.set({
2130
- ...initialState6.state
2361
+ ...initialState7.state
2131
2362
  });
2132
2363
  transferModal$.view.set("enterReceiverAddress");
2133
2364
  transferModal$.hash.set(void 0);
@@ -2142,12 +2373,13 @@ var initialState6 = {
2142
2373
  view: "enterReceiverAddress",
2143
2374
  hash: void 0
2144
2375
  };
2145
- var transferModal$ = observable7(initialState6);
2376
+ var transferModal$ = observable8(initialState7);
2146
2377
 
2147
2378
  // src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
2148
2379
  import { Box as Box15, Button as Button4, Text as Text12, TextInput } from "@0xsequence/design-system";
2380
+ import { observable as observable9 } from "@legendapp/state";
2149
2381
  import { isAddress } from "viem";
2150
- import { useAccount as useAccount3 } from "wagmi";
2382
+ import { useAccount as useAccount4 } from "wagmi";
2151
2383
 
2152
2384
  // src/react/ui/modals/TransferModal/messages.ts
2153
2385
  var baseMessages = {
@@ -2199,7 +2431,7 @@ var useHandleTransfer = () => {
2199
2431
  });
2200
2432
  async function transfer() {
2201
2433
  if (collectionType !== "ERC721" /* ERC721 */ && collectionType !== "ERC1155" /* ERC1155 */) {
2202
- throw new Error("Invalid contract type");
2434
+ throw new InvalidContractTypeError(collectionType);
2203
2435
  }
2204
2436
  if (collectionType === "ERC721" /* ERC721 */) {
2205
2437
  try {
@@ -2267,11 +2499,12 @@ var useHandleTransfer = () => {
2267
2499
  var useHandleTransfer_default = useHandleTransfer;
2268
2500
 
2269
2501
  // src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
2270
- import { Fragment, jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
2502
+ import { Fragment, jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
2271
2503
  var EnterWalletAddressView = () => {
2272
- const { address } = useAccount3();
2504
+ const { address } = useAccount4();
2273
2505
  const { collectionAddress, tokenId, chainId, collectionType } = transferModal$.state.get();
2274
2506
  const $quantity = transferModal$.state.quantity;
2507
+ const $invalidQuantity = observable9(false);
2275
2508
  const isWalletAddressValid = isAddress(
2276
2509
  transferModal$.state.receiverAddress.get()
2277
2510
  );
@@ -2300,16 +2533,16 @@ var EnterWalletAddressView = () => {
2300
2533
  transferModal$.view.set("followWalletInstructions");
2301
2534
  }
2302
2535
  return /* @__PURE__ */ jsxs17(Box15, { display: "grid", gap: "6", flexGrow: "1", children: [
2303
- /* @__PURE__ */ jsx23(Text12, { color: "white", fontSize: "large", fontWeight: "bold", children: "Transfer your item" }),
2536
+ /* @__PURE__ */ jsx24(Text12, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
2304
2537
  /* @__PURE__ */ jsxs17(Box15, { display: "flex", flexDirection: "column", gap: "3", children: [
2305
- /* @__PURE__ */ jsx23(
2538
+ /* @__PURE__ */ jsx24(
2306
2539
  AlertMessage,
2307
2540
  {
2308
2541
  message: getMessage("enterReceiverAddress"),
2309
2542
  type: "warning"
2310
2543
  }
2311
2544
  ),
2312
- /* @__PURE__ */ jsx23(
2545
+ /* @__PURE__ */ jsx24(
2313
2546
  TextInput,
2314
2547
  {
2315
2548
  label: "Wallet address",
@@ -2321,31 +2554,32 @@ var EnterWalletAddressView = () => {
2321
2554
  }
2322
2555
  ),
2323
2556
  collectionType === "ERC1155" /* ERC1155 */ && balanceAmount && /* @__PURE__ */ jsxs17(Fragment, { children: [
2324
- /* @__PURE__ */ jsx23(
2557
+ /* @__PURE__ */ jsx24(
2325
2558
  QuantityInput,
2326
2559
  {
2327
2560
  $quantity,
2328
- chainId,
2329
- collectionAddress,
2330
- collectibleId: tokenId
2561
+ $invalidQuantity,
2562
+ decimals: collection?.decimals || 0,
2563
+ maxQuantity: balanceAmount
2331
2564
  }
2332
2565
  ),
2333
- /* @__PURE__ */ jsx23(
2566
+ /* @__PURE__ */ jsx24(
2334
2567
  Text12,
2335
2568
  {
2336
2569
  color: insufficientBalance ? "negative" : "text50",
2337
2570
  fontSize: "small",
2338
2571
  fontWeight: "medium",
2572
+ fontFamily: "body",
2339
2573
  children: `You have ${balanceAmount} of this item`
2340
2574
  }
2341
2575
  )
2342
2576
  ] })
2343
2577
  ] }),
2344
- /* @__PURE__ */ jsx23(
2578
+ /* @__PURE__ */ jsx24(
2345
2579
  Button4,
2346
2580
  {
2347
2581
  onClick: handleChangeView,
2348
- disabled: !isWalletAddressValid || insufficientBalance,
2582
+ disabled: !isWalletAddressValid || insufficientBalance || !$quantity.get(),
2349
2583
  title: "Transfer",
2350
2584
  label: "Transfer",
2351
2585
  variant: "primary",
@@ -2360,20 +2594,20 @@ var EnterWalletAddressView = () => {
2360
2594
  var enterWalletAddress_default = EnterWalletAddressView;
2361
2595
 
2362
2596
  // src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx
2363
- import { observer as observer11 } from "@legendapp/state/react";
2364
2597
  import { Box as Box16, Button as Button5, Text as Text13 } from "@0xsequence/design-system";
2365
- import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
2366
- var FollowWalletInstructionsView = observer11(() => {
2598
+ import { observer as observer12 } from "@legendapp/state/react";
2599
+ import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
2600
+ var FollowWalletInstructionsView = observer12(() => {
2367
2601
  return /* @__PURE__ */ jsxs18(Box16, { display: "grid", gap: "6", flexGrow: "1", children: [
2368
- /* @__PURE__ */ jsx24(Text13, { color: "white", fontSize: "large", fontWeight: "bold", children: "Transfer your item" }),
2369
- /* @__PURE__ */ jsx24(Box16, { display: "flex", flexDirection: "column", gap: "3", children: /* @__PURE__ */ jsx24(
2602
+ /* @__PURE__ */ jsx25(Text13, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
2603
+ /* @__PURE__ */ jsx25(Box16, { display: "flex", flexDirection: "column", gap: "3", children: /* @__PURE__ */ jsx25(
2370
2604
  AlertMessage,
2371
2605
  {
2372
2606
  message: getMessage("followWalletInstructions"),
2373
2607
  type: "info"
2374
2608
  }
2375
2609
  ) }),
2376
- /* @__PURE__ */ jsx24(
2610
+ /* @__PURE__ */ jsx25(
2377
2611
  Button5,
2378
2612
  {
2379
2613
  disabled: true,
@@ -2391,9 +2625,9 @@ var FollowWalletInstructionsView = observer11(() => {
2391
2625
  var followWalletInstructions_default = FollowWalletInstructionsView;
2392
2626
 
2393
2627
  // src/react/ui/modals/TransferModal/index.tsx
2394
- import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
2628
+ import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
2395
2629
  var useTransferModal = () => {
2396
- const { chainId: accountChainId } = useAccount4();
2630
+ const { chainId: accountChainId } = useAccount5();
2397
2631
  const { show: showSwitchNetworkModal } = useSwitchChainModal();
2398
2632
  const openModal = (args) => {
2399
2633
  transferModal$.open(args);
@@ -2427,156 +2661,36 @@ var useTransferModal = () => {
2427
2661
  };
2428
2662
  };
2429
2663
  var TransferModal = () => {
2430
- return /* @__PURE__ */ jsx25(Show4, { if: transferModal$.isOpen, children: /* @__PURE__ */ jsx25(Modal3, {}) });
2664
+ return /* @__PURE__ */ jsx26(Show5, { if: transferModal$.isOpen, children: /* @__PURE__ */ jsx26(Modal3, {}) });
2431
2665
  };
2432
2666
  var Modal3 = () => {
2433
- return /* @__PURE__ */ jsx25(ModalContent3, {});
2667
+ return /* @__PURE__ */ jsx26(ModalContent3, {});
2434
2668
  };
2435
- var ModalContent3 = observer12(() => {
2436
- return /* @__PURE__ */ jsx25(Root5, { open: true, children: /* @__PURE__ */ jsxs19(Portal5, { children: [
2437
- /* @__PURE__ */ jsx25(Overlay3, { className: dialogOverlay2 }),
2669
+ var ModalContent3 = observer13(() => {
2670
+ return /* @__PURE__ */ jsx26(Root5, { open: true, children: /* @__PURE__ */ jsxs19(Portal5, { children: [
2671
+ /* @__PURE__ */ jsx26(Overlay3, { className: dialogOverlay2 }),
2438
2672
  /* @__PURE__ */ jsxs19(Content5, { className: transferModalContent, children: [
2439
- /* @__PURE__ */ jsx25(TransactionModalView, {}),
2440
- /* @__PURE__ */ jsx25(Close3, { onClick: transferModal$.close, className: closeButton2, asChild: true, children: /* @__PURE__ */ jsx25(IconButton4, { size: "xs", "aria-label": "Close modal", icon: CloseIcon3 }) })
2673
+ /* @__PURE__ */ jsx26(TransactionModalView, {}),
2674
+ /* @__PURE__ */ jsx26(Close3, { onClick: transferModal$.close, className: closeButton2, asChild: true, children: /* @__PURE__ */ jsx26(IconButton4, { size: "xs", "aria-label": "Close modal", icon: CloseIcon3 }) })
2441
2675
  ] })
2442
2676
  ] }) });
2443
2677
  });
2444
- var TransactionModalView = observer12(() => {
2678
+ var TransactionModalView = observer13(() => {
2445
2679
  const { view } = transferModal$.get();
2446
2680
  switch (view) {
2447
2681
  case "enterReceiverAddress":
2448
- return /* @__PURE__ */ jsx25(enterWalletAddress_default, {});
2682
+ return /* @__PURE__ */ jsx26(enterWalletAddress_default, {});
2449
2683
  case "followWalletInstructions":
2450
- return /* @__PURE__ */ jsx25(followWalletInstructions_default, {});
2684
+ return /* @__PURE__ */ jsx26(followWalletInstructions_default, {});
2451
2685
  default:
2452
2686
  return null;
2453
2687
  }
2454
2688
  });
2455
2689
 
2456
- // src/react/ui/modals/BuyModal/_store.ts
2457
- import { observable as observable8 } from "@legendapp/state";
2458
- var initialState7 = {
2459
- isOpen: false,
2460
- open: ({
2461
- callbacks,
2462
- defaultCallbacks,
2463
- ...args
2464
- }) => {
2465
- buyModal$.state.set({
2466
- ...buyModal$.state.get(),
2467
- order: args.order
2468
- });
2469
- buyModal$.callbacks.set(callbacks || defaultCallbacks);
2470
- buyModal$.isOpen.set(true);
2471
- },
2472
- close: () => {
2473
- buyModal$.isOpen.set(false);
2474
- buyModal$.callbacks.set(void 0);
2475
- buyModal$.state.set({
2476
- ...initialState7.state
2477
- });
2478
- },
2479
- state: {
2480
- order: void 0,
2481
- quantity: "1"
2482
- },
2483
- callbacks: void 0
2484
- };
2485
- var buyModal$ = observable8(initialState7);
2486
-
2487
- // src/react/ui/modals/BuyModal/index.tsx
2488
- import { observer as observer13, useSelector } from "@legendapp/state/react";
2489
- import { useEffect as useEffect5 } from "react";
2490
- import { Fragment as Fragment2, jsx as jsx26 } from "react/jsx-runtime";
2491
- var useBuyModal = (callbacks) => {
2492
- return {
2493
- show: (args) => buyModal$.open({ ...args, defaultCallbacks: callbacks }),
2494
- close: () => buyModal$.close()
2495
- };
2496
- };
2497
- var BuyModal = () => {
2498
- const isOpen = useSelector(buyModal$.isOpen);
2499
- const { data: collection } = useCollection({
2500
- chainId: buyModal$.state.order.chainId.get(),
2501
- collectionAddress: buyModal$.state.order.collectionContractAddress.get()
2502
- });
2503
- if (!isOpen || !collection) return null;
2504
- return collection.type === "ERC721" /* ERC721 */ ? /* @__PURE__ */ jsx26(CheckoutModal, {}) : /* @__PURE__ */ jsx26(ERC1155QuantityModal, {});
2505
- };
2506
- var CheckoutModal = observer13(() => {
2507
- const order = buyModal$.state.order.get();
2508
- const chainId = String(order.chainId);
2509
- const collectionAddress = order.collectionContractAddress;
2510
- const collectibleId = order.tokenId;
2511
- const { buy } = useBuyCollectable({
2512
- chainId,
2513
- collectionAddress
2514
- });
2515
- const { data: collectable } = useCollectible({
2516
- chainId,
2517
- collectionAddress,
2518
- collectibleId
2519
- });
2520
- useEffect5(() => {
2521
- if (!collectable) return;
2522
- buy({
2523
- orderId: order.orderId,
2524
- collectableDecimals: collectable.decimals || 0,
2525
- quantity: "1",
2526
- marketplace: order.marketplace
2527
- });
2528
- }, [order, collectable]);
2529
- return /* @__PURE__ */ jsx26(Fragment2, {});
2530
- });
2531
- var ERC1155QuantityModal = observer13(() => {
2532
- const order = buyModal$.state.order.get();
2533
- const chainId = String(order.chainId);
2534
- const collectionAddress = order.collectionContractAddress;
2535
- const collectibleId = order.tokenId;
2536
- const { buy } = useBuyCollectable({
2537
- chainId,
2538
- collectionAddress
2539
- });
2540
- const { data: collectable } = useCollectible({
2541
- chainId,
2542
- collectionAddress,
2543
- collectibleId
2544
- });
2545
- if (!order || !collectable) return null;
2546
- return /* @__PURE__ */ jsx26(
2547
- ActionModal,
2548
- {
2549
- store: buyModal$,
2550
- onClose: () => buyModal$.close(),
2551
- title: "Select Quantity",
2552
- ctas: [
2553
- {
2554
- label: "Select Quantity",
2555
- onClick: () => buy({
2556
- quantity: buyModal$.state.quantity.get(),
2557
- orderId: order.orderId,
2558
- collectableDecimals: collectable.decimals || 0,
2559
- marketplace: order.marketplace
2560
- })
2561
- }
2562
- ],
2563
- children: /* @__PURE__ */ jsx26(
2564
- QuantityInput,
2565
- {
2566
- chainId,
2567
- collectionAddress,
2568
- collectibleId,
2569
- $quantity: buyModal$.state.quantity
2570
- }
2571
- )
2572
- }
2573
- );
2574
- });
2575
-
2576
2690
  // src/react/ui/modals/modal-provider.tsx
2577
- import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
2691
+ import { Fragment as Fragment2, jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
2578
2692
  var ModalProvider = observer14(() => {
2579
- return /* @__PURE__ */ jsxs20(Fragment3, { children: [
2693
+ return /* @__PURE__ */ jsxs20(Fragment2, { children: [
2580
2694
  /* @__PURE__ */ jsx27(AccountModal, {}),
2581
2695
  /* @__PURE__ */ jsx27(CreateListingModal, {}),
2582
2696
  /* @__PURE__ */ jsx27(MakeOfferModal, {}),
@@ -2592,7 +2706,7 @@ var ModalProvider = observer14(() => {
2592
2706
  // src/react/ui/components/collectible-card/CollectibleCard.tsx
2593
2707
  import { useState as useState8 } from "react";
2594
2708
  import { Box as Box20, IconButton as IconButton6, Skeleton as Skeleton6 } from "@0xsequence/design-system";
2595
- import { useAccount as useAccount6 } from "wagmi";
2709
+ import { useAccount as useAccount7 } from "wagmi";
2596
2710
 
2597
2711
  // src/react/ui/icons/DiamondEye.tsx
2598
2712
  import { Box as Box17 } from "@0xsequence/design-system";
@@ -2648,7 +2762,7 @@ var ActionButton = observer15(
2648
2762
  const { show: showBuyModal } = useBuyModal();
2649
2763
  if (action === "Buy" /* BUY */) {
2650
2764
  if (!lowestListing)
2651
- throw new Error("lowestListing is required for BUY action");
2765
+ throw new InvalidStepError("BUY", "lowestListing is required");
2652
2766
  return /* @__PURE__ */ jsx29(
2653
2767
  ActionButtonBody,
2654
2768
  {
@@ -2664,7 +2778,7 @@ var ActionButton = observer15(
2664
2778
  }
2665
2779
  if (action === "Sell" /* SELL */) {
2666
2780
  if (!highestOffer)
2667
- throw new Error("highestOffer is required for SELL action");
2781
+ throw new InvalidStepError("SELL", "highestOffer is required");
2668
2782
  return /* @__PURE__ */ jsx29(
2669
2783
  ActionButtonBody,
2670
2784
  {
@@ -2741,7 +2855,7 @@ function ActionButtonBody({ label, onClick }) {
2741
2855
  // src/react/ui/components/collectible-card/Footer.tsx
2742
2856
  import { Box as Box19, IconButton as IconButton5, Image as Image6, Text as Text14 } from "@0xsequence/design-system";
2743
2857
  import { formatUnits as formatUnits3 } from "viem";
2744
- import { useAccount as useAccount5 } from "wagmi";
2858
+ import { useAccount as useAccount6 } from "wagmi";
2745
2859
 
2746
2860
  // src/react/ui/icons/Bell.tsx
2747
2861
  import { Box as Box18 } from "@0xsequence/design-system";
@@ -2777,14 +2891,6 @@ var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx30(
2777
2891
  );
2778
2892
  var Bell_default = SvgBellIcon;
2779
2893
 
2780
- // src/react/ui/components/collectible-card/styles.css.ts
2781
- var actionWrapper = "styles_actionWrapper__biep7a7";
2782
- var collectibleCard = "styles_collectibleCard__biep7a0";
2783
- var collectibleImage = "styles_collectibleImage__biep7a1";
2784
- var collectibleTileWrapper = "styles_collectibleTileWrapper__biep7a2";
2785
- var footer = { animated: "styles_footer_animated__biep7a5 fyvr11wl", "static": "fyvr11wl" };
2786
- var offerBellButton = "styles_offerBellButton__biep7a3";
2787
-
2788
2894
  // src/react/ui/components/collectible-card/Footer.tsx
2789
2895
  import { jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
2790
2896
  var Footer = ({
@@ -2797,7 +2903,7 @@ var Footer = ({
2797
2903
  balance,
2798
2904
  isAnimated
2799
2905
  }) => {
2800
- const { address } = useAccount5();
2906
+ const { address } = useAccount6();
2801
2907
  if (name.length > 15 && highestOffer) {
2802
2908
  name = name.substring(0, 13) + "...";
2803
2909
  }
@@ -2823,6 +2929,7 @@ var Footer = ({
2823
2929
  alignItems: "center",
2824
2930
  justifyContent: "space-between",
2825
2931
  position: "relative",
2932
+ width: "full",
2826
2933
  children: [
2827
2934
  /* @__PURE__ */ jsx31(
2828
2935
  Text14,
@@ -2838,8 +2945,12 @@ var Footer = ({
2838
2945
  highestOffer && onOfferClick && /* @__PURE__ */ jsx31(
2839
2946
  IconButton5,
2840
2947
  {
2948
+ size: "xs",
2841
2949
  variant: "primary",
2842
2950
  className: offerBellButton,
2951
+ position: "absolute",
2952
+ right: "0",
2953
+ top: "0",
2843
2954
  onClick: (e) => {
2844
2955
  e.stopPropagation();
2845
2956
  onOfferClick?.();
@@ -2870,41 +2981,31 @@ var Footer = ({
2870
2981
  }
2871
2982
  )
2872
2983
  ] }),
2873
- !!balance && type !== "ERC721" /* ERC721 */ && /* @__PURE__ */ jsxs21(
2874
- Text14,
2875
- {
2876
- background: "backgroundSecondary",
2877
- color: "text80",
2878
- fontSize: "small",
2879
- textAlign: "left",
2880
- fontFamily: "body",
2881
- paddingX: "2",
2882
- paddingY: "1",
2883
- borderRadius: "sm",
2884
- children: [
2885
- "Owned: ",
2886
- balance
2887
- ]
2888
- }
2889
- ),
2890
- type === "ERC721" /* ERC721 */ && /* @__PURE__ */ jsx31(
2891
- Text14,
2892
- {
2893
- background: "backgroundSecondary",
2894
- color: "text80",
2895
- fontSize: "small",
2896
- textAlign: "left",
2897
- fontFamily: "body",
2898
- paddingX: "2",
2899
- paddingY: "1",
2900
- borderRadius: "sm",
2901
- children: "ERC-721"
2902
- }
2903
- )
2984
+ /* @__PURE__ */ jsx31(TokenTypeBalancePill, { balance, type })
2904
2985
  ]
2905
2986
  }
2906
2987
  );
2907
2988
  };
2989
+ var TokenTypeBalancePill = ({
2990
+ balance,
2991
+ type
2992
+ }) => {
2993
+ const displayText = type === "ERC1155" /* ERC1155 */ ? !!balance ? `Owned: ${balance}` : "ERC-1155" : "ERC-721";
2994
+ return /* @__PURE__ */ jsx31(
2995
+ Text14,
2996
+ {
2997
+ background: "backgroundSecondary",
2998
+ color: "text80",
2999
+ fontSize: "small",
3000
+ textAlign: "left",
3001
+ fontFamily: "body",
3002
+ paddingX: "2",
3003
+ paddingY: "1",
3004
+ borderRadius: "sm",
3005
+ children: displayText
3006
+ }
3007
+ );
3008
+ };
2908
3009
 
2909
3010
  // src/react/ui/components/collectible-card/CollectibleCard.tsx
2910
3011
  import { jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
@@ -2954,7 +3055,7 @@ function CollectibleCard({
2954
3055
  balance,
2955
3056
  cardLoading
2956
3057
  }) {
2957
- const { address: accountAddress } = useAccount6();
3058
+ const { address: accountAddress } = useAccount7();
2958
3059
  const collectibleMetadata = lowestListing?.metadata;
2959
3060
  const [imageLoadingError, setImageLoadingError] = useState8(false);
2960
3061
  const { data: highestOffer, isLoading: highestOfferLoading } = useHighestOffer({
@@ -2991,7 +3092,7 @@ function CollectibleCard({
2991
3092
  height: "full",
2992
3093
  zIndex: "10",
2993
3094
  overflow: "hidden",
2994
- onClick: onCollectibleClick,
3095
+ onClick: () => onCollectibleClick?.(collectibleId),
2995
3096
  border: "none",
2996
3097
  cursor: "pointer",
2997
3098
  padding: "0",
@@ -3066,13 +3167,13 @@ function CollectibleCard({
3066
3167
  }
3067
3168
 
3068
3169
  export {
3170
+ useBuyModal,
3069
3171
  useCreateListingModal,
3070
3172
  useMakeOfferModal,
3071
3173
  useSellModal,
3072
3174
  useSuccessfulPurchaseModal,
3073
3175
  useTransferModal,
3074
- useBuyModal,
3075
3176
  ModalProvider,
3076
3177
  CollectibleCard
3077
3178
  };
3078
- //# sourceMappingURL=chunk-22NLQ3AS.js.map
3179
+ //# sourceMappingURL=chunk-PMDJARYX.js.map