@0xsequence/marketplace-sdk 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-7CL54NCX.js +41 -0
- package/dist/chunk-7CL54NCX.js.map +1 -0
- package/dist/{chunk-G3D572BT.js → chunk-G3YU4NQ2.js} +24 -1
- package/dist/chunk-G3YU4NQ2.js.map +1 -0
- package/dist/{chunk-SM7V6ZWI.js → chunk-GNB736ZE.js} +226 -208
- package/dist/chunk-GNB736ZE.js.map +1 -0
- package/dist/chunk-ITJEOCDV.js +1006 -0
- package/dist/chunk-ITJEOCDV.js.map +1 -0
- package/dist/{chunk-QOJXWHRZ.js → chunk-LFQB477Y.js} +3 -1
- package/dist/chunk-LFQB477Y.js.map +1 -0
- package/dist/{chunk-VPGWEMWL.js → chunk-M4MXVMAM.js} +134 -25
- package/dist/chunk-M4MXVMAM.js.map +1 -0
- package/dist/{chunk-4PFMUVE4.js → chunk-SNOEEUPZ.js} +2 -2
- package/dist/{create-config-Dz0gCiQ0.d.ts → create-config-Cto2ehcz.d.ts} +1 -1
- package/dist/index.css +4 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/{marketplace-config-DZbtyrma.d.ts → marketplace-config-Bbxl-uKX.d.ts} +2 -1
- package/dist/react/_internal/index.d.ts +4 -3
- package/dist/react/_internal/index.js +9 -1
- package/dist/react/_internal/wagmi/index.d.ts +2 -2
- package/dist/react/hooks/index.d.ts +1363 -101
- package/dist/react/hooks/index.js +13 -7
- package/dist/react/index.css +4 -1
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.ts +6 -5
- package/dist/react/index.js +28 -22
- package/dist/react/ssr/index.d.ts +2 -1
- package/dist/react/ssr/index.js +23 -0
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/index.css +4 -1
- package/dist/react/ui/index.css.map +1 -1
- package/dist/react/ui/index.d.ts +4 -4
- package/dist/react/ui/index.js +5 -5
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +2 -2
- package/dist/styles/index.css +4 -1
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/index.d.ts +2 -1
- package/dist/styles/index.js +3 -4972
- package/dist/styles/index.js.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.js +1 -1
- package/dist/types-BzZVURNL.d.ts +19 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +1 -1
- package/package.json +3 -2
- package/src/react/_internal/api/zod-schema.ts +636 -0
- package/src/react/_internal/types.ts +32 -8
- package/src/react/hooks/index.ts +1 -0
- package/src/react/hooks/useBalanceOfCollectible.tsx +43 -18
- package/src/react/hooks/useCollectible.tsx +17 -11
- package/src/react/hooks/useCollection.tsx +35 -29
- package/src/react/hooks/useCountOfCollectables.tsx +77 -0
- package/src/react/hooks/useCurrencies.tsx +23 -12
- package/src/react/hooks/useFilters.tsx +15 -9
- package/src/react/hooks/useFloorOrder.tsx +23 -8
- package/src/react/hooks/useGenerateSellTransaction.tsx +16 -9
- package/src/react/hooks/useHighestOffer.tsx +23 -13
- package/src/react/hooks/useListBalances.tsx +57 -26
- package/src/react/hooks/useListCollectibles.tsx +25 -12
- package/src/react/hooks/useListOffersForCollectible.tsx +13 -5
- package/src/react/hooks/useLowestListing.tsx +23 -14
- package/src/react/hooks/useRoyaltyPercentage.tsx +18 -8
- package/src/react/hooks/useTransferTokens.tsx +3 -3
- package/src/react/ui/modals/CreateListingModal/_store.ts +5 -5
- package/src/react/ui/modals/CreateListingModal/index.tsx +5 -4
- package/src/react/ui/modals/MakeOfferModal/_store.ts +6 -9
- package/src/react/ui/modals/MakeOfferModal/index.tsx +15 -25
- package/src/react/ui/modals/SellModal/_store.ts +28 -23
- package/src/react/ui/modals/SellModal/index.tsx +11 -10
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +8 -7
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +2 -1
- package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +3 -2
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +55 -12
- package/src/react/ui/modals/_internal/components/priceInput/styles.css.ts +4 -0
- package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +2 -1
- package/src/react/ui/modals/_internal/components/tokenPreview/index.tsx +2 -1
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +2 -2
- package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +4 -4
- package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +14 -14
- package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +5 -5
- package/src/types/marketplace-config.ts +2 -1
- package/dist/chunk-G3D572BT.js.map +0 -1
- package/dist/chunk-QOJXWHRZ.js.map +0 -1
- package/dist/chunk-SM7V6ZWI.js.map +0 -1
- package/dist/chunk-STO74F2I.js +0 -14
- package/dist/chunk-STO74F2I.js.map +0 -1
- package/dist/chunk-VPGWEMWL.js.map +0 -1
- package/dist/chunk-ZE2LNX65.js +0 -394
- package/dist/chunk-ZE2LNX65.js.map +0 -1
- package/dist/types-BrAQ8-w4.d.ts +0 -12
- package/src/react/hooks/useCollectionCounts.tsx +0 -61
- /package/dist/{chunk-4PFMUVE4.js.map → chunk-SNOEEUPZ.js.map} +0 -0
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-TZGLKJRF.js";
|
|
9
9
|
import {
|
|
10
10
|
ActionModal
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SNOEEUPZ.js";
|
|
12
12
|
import {
|
|
13
13
|
alertMessageBox,
|
|
14
14
|
alertMessageBoxVariants,
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
dialogOverlay,
|
|
27
27
|
dialogOverlay2,
|
|
28
28
|
dialogOverlay3,
|
|
29
|
+
priceInputCurrencyImage,
|
|
29
30
|
priceInputWrapper,
|
|
30
31
|
quantityInputWrapper,
|
|
31
32
|
rangeSelect,
|
|
@@ -33,24 +34,28 @@ import {
|
|
|
33
34
|
switchChainModalContent,
|
|
34
35
|
tokenPreview,
|
|
35
36
|
transferModalContent
|
|
36
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-LFQB477Y.js";
|
|
37
38
|
import {
|
|
39
|
+
stepSchema,
|
|
38
40
|
useCollectible,
|
|
39
41
|
useCollection,
|
|
40
42
|
useConfig,
|
|
41
43
|
useCurrencies,
|
|
42
44
|
useGenerateListingTransaction,
|
|
43
45
|
useGenerateOfferTransaction,
|
|
46
|
+
useListBalances,
|
|
44
47
|
useLowestListing,
|
|
45
48
|
useMarketplaceConfig,
|
|
46
49
|
useRoyaltyPercentage,
|
|
47
|
-
useTokenBalances,
|
|
48
50
|
useTransferTokens
|
|
49
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-ITJEOCDV.js";
|
|
50
52
|
import {
|
|
51
53
|
calculatePriceDifferencePercentage,
|
|
52
54
|
truncateMiddle
|
|
53
55
|
} from "./chunk-6S4FYXP6.js";
|
|
56
|
+
import {
|
|
57
|
+
ChainIdSchema
|
|
58
|
+
} from "./chunk-7CL54NCX.js";
|
|
54
59
|
import {
|
|
55
60
|
getMarketplaceClient
|
|
56
61
|
} from "./chunk-HGBEC3WX.js";
|
|
@@ -212,7 +217,74 @@ var SwitchChainModal = observer(() => {
|
|
|
212
217
|
var switchChainModal_default = SwitchChainModal;
|
|
213
218
|
|
|
214
219
|
// src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
|
|
220
|
+
import {
|
|
221
|
+
CloseIcon as CloseIcon2,
|
|
222
|
+
IconButton as IconButton2,
|
|
223
|
+
Skeleton,
|
|
224
|
+
Text as Text6
|
|
225
|
+
} from "@0xsequence/design-system";
|
|
215
226
|
import { observer as observer3 } from "@legendapp/state/react";
|
|
227
|
+
import { Close as Close2, Content as Content2, Overlay as Overlay2, Portal as Portal2, Root as Root2 } from "@radix-ui/react-dialog";
|
|
228
|
+
import { useTransactionReceipt } from "wagmi";
|
|
229
|
+
|
|
230
|
+
// src/react/ui/modals/_internal/components/transaction-footer/index.tsx
|
|
231
|
+
import { Box as Box2, Spinner as Spinner2, Text as Text3 } from "@0xsequence/design-system";
|
|
232
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
233
|
+
function TransactionFooter({
|
|
234
|
+
transactionHash,
|
|
235
|
+
isConfirming,
|
|
236
|
+
isConfirmed,
|
|
237
|
+
isFailed
|
|
238
|
+
}) {
|
|
239
|
+
const icon = isConfirming && /* @__PURE__ */ jsx3(Spinner2, { size: "md" }) || isConfirmed && /* @__PURE__ */ jsx3(PositiveCircleIcon_default, { size: "md" });
|
|
240
|
+
const title = isConfirming && "Processing transaction" || isConfirmed && "Transaction complete" || isFailed && "Transaction failed";
|
|
241
|
+
return /* @__PURE__ */ jsxs3(Box2, { display: "flex", alignItems: "center", children: [
|
|
242
|
+
icon,
|
|
243
|
+
/* @__PURE__ */ jsx3(Text3, { color: "text50", fontSize: "normal", fontWeight: "medium", marginLeft: "2", children: title }),
|
|
244
|
+
/* @__PURE__ */ jsx3(
|
|
245
|
+
Text3,
|
|
246
|
+
{
|
|
247
|
+
color: "polygonLight",
|
|
248
|
+
flexGrow: "1",
|
|
249
|
+
textAlign: "right",
|
|
250
|
+
fontSize: "normal",
|
|
251
|
+
fontWeight: "medium",
|
|
252
|
+
marginLeft: "2",
|
|
253
|
+
children: truncateMiddle(transactionHash, 4, 4)
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
] });
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// src/react/ui/modals/_internal/components/transactionPreview/index.tsx
|
|
260
|
+
import { Box as Box4, Image, NetworkImage, Text as Text5 } from "@0xsequence/design-system";
|
|
261
|
+
import { observer as observer2 } from "@legendapp/state/react";
|
|
262
|
+
import { formatUnits } from "viem";
|
|
263
|
+
|
|
264
|
+
// src/react/ui/modals/_internal/components/timeAgo/index.tsx
|
|
265
|
+
import { Box as Box3, Text as Text4 } from "@0xsequence/design-system";
|
|
266
|
+
import { formatDistanceToNow } from "date-fns";
|
|
267
|
+
import { useState, useEffect } from "react";
|
|
268
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
269
|
+
function TimeAgo({ date }) {
|
|
270
|
+
const [timeAgo, setTimeAgo] = useState("");
|
|
271
|
+
useEffect(() => {
|
|
272
|
+
const interval = setInterval(() => {
|
|
273
|
+
setTimeAgo(formatDistanceToNow(date));
|
|
274
|
+
}, 1e3);
|
|
275
|
+
return () => clearInterval(interval);
|
|
276
|
+
}, [date]);
|
|
277
|
+
return /* @__PURE__ */ jsx4(
|
|
278
|
+
Box3,
|
|
279
|
+
{
|
|
280
|
+
flexGrow: "1",
|
|
281
|
+
display: "flex",
|
|
282
|
+
alignItems: "center",
|
|
283
|
+
justifyContent: "flex-end",
|
|
284
|
+
children: /* @__PURE__ */ jsx4(Text4, { color: "text50", fontSize: "small", children: timeAgo })
|
|
285
|
+
}
|
|
286
|
+
);
|
|
287
|
+
}
|
|
216
288
|
|
|
217
289
|
// src/react/ui/modals/_internal/components/transactionStatusModal/store.ts
|
|
218
290
|
import { observable as observable2 } from "@legendapp/state";
|
|
@@ -261,53 +333,6 @@ var initialState2 = {
|
|
|
261
333
|
};
|
|
262
334
|
var transactionStatusModal$ = observable2(initialState2);
|
|
263
335
|
|
|
264
|
-
// src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
|
|
265
|
-
import { Close as Close2, Content as Content2, Overlay as Overlay2, Portal as Portal2, Root as Root2 } from "@radix-ui/react-dialog";
|
|
266
|
-
|
|
267
|
-
// src/react/ui/modals/_internal/components/transactionStatusModal/styles.css.ts
|
|
268
|
-
var closeButton4 = "fyvr11lw fyvr1tc fyvr1mo";
|
|
269
|
-
var dialogOverlay4 = "fyvr1m0 fyvr1o8 fyvr1qg fyvr1so fyvr11xl fyvr11m0 fyvr11rs";
|
|
270
|
-
var transactionStatusModalContent = "modal_dialogContent_wide__1ypl6nt3 modal_dialogContentBase__1ypl6nt1 fyvr11hg fyvr11i4 fyvr11g4 fyvr11gs fyvr11l8 fyvr11wl fyvr11m0 fyvr11rs fyvr1vo fyvr1xs fyvr1zw fyvr1120 fyvr11lc fyvr11mc fyvr11cw";
|
|
271
|
-
|
|
272
|
-
// src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
|
|
273
|
-
import {
|
|
274
|
-
CloseIcon as CloseIcon2,
|
|
275
|
-
IconButton as IconButton2,
|
|
276
|
-
Skeleton,
|
|
277
|
-
Text as Text6
|
|
278
|
-
} from "@0xsequence/design-system";
|
|
279
|
-
|
|
280
|
-
// src/react/ui/modals/_internal/components/transactionPreview/index.tsx
|
|
281
|
-
import { Box as Box3, Image, NetworkImage, Text as Text4 } from "@0xsequence/design-system";
|
|
282
|
-
|
|
283
|
-
// src/react/ui/modals/_internal/components/timeAgo/index.tsx
|
|
284
|
-
import { Box as Box2, Text as Text3 } from "@0xsequence/design-system";
|
|
285
|
-
import { formatDistanceToNow } from "date-fns";
|
|
286
|
-
import { useState, useEffect } from "react";
|
|
287
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
288
|
-
function TimeAgo({ date }) {
|
|
289
|
-
const [timeAgo, setTimeAgo] = useState("");
|
|
290
|
-
useEffect(() => {
|
|
291
|
-
const interval = setInterval(() => {
|
|
292
|
-
setTimeAgo(formatDistanceToNow(date));
|
|
293
|
-
}, 1e3);
|
|
294
|
-
return () => clearInterval(interval);
|
|
295
|
-
}, [date]);
|
|
296
|
-
return /* @__PURE__ */ jsx3(
|
|
297
|
-
Box2,
|
|
298
|
-
{
|
|
299
|
-
flexGrow: "1",
|
|
300
|
-
display: "flex",
|
|
301
|
-
alignItems: "center",
|
|
302
|
-
justifyContent: "flex-end",
|
|
303
|
-
children: /* @__PURE__ */ jsx3(Text3, { color: "text50", fontSize: "small", children: timeAgo })
|
|
304
|
-
}
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// src/react/ui/modals/_internal/components/transactionPreview/index.tsx
|
|
309
|
-
import { observer as observer2 } from "@legendapp/state/react";
|
|
310
|
-
|
|
311
336
|
// src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx
|
|
312
337
|
import { useMemo } from "react";
|
|
313
338
|
|
|
@@ -354,8 +379,7 @@ function useTransactionPreviewTitle(status, type) {
|
|
|
354
379
|
}
|
|
355
380
|
|
|
356
381
|
// src/react/ui/modals/_internal/components/transactionPreview/index.tsx
|
|
357
|
-
import {
|
|
358
|
-
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
382
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
359
383
|
var TransactionPreview = observer2(
|
|
360
384
|
({
|
|
361
385
|
price,
|
|
@@ -379,10 +403,10 @@ var TransactionPreview = observer2(
|
|
|
379
403
|
const collectibleName = collectible.name;
|
|
380
404
|
const collectionName = collection?.name;
|
|
381
405
|
const priceFormatted = price ? formatUnits(BigInt(price.amountRaw), price.currency.decimals) : void 0;
|
|
382
|
-
return /* @__PURE__ */
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
|
|
406
|
+
return /* @__PURE__ */ jsxs4(Box4, { padding: "3", background: "backgroundSecondary", borderRadius: "md", children: [
|
|
407
|
+
/* @__PURE__ */ jsxs4(Box4, { display: "flex", alignItems: "center", children: [
|
|
408
|
+
/* @__PURE__ */ jsx5(
|
|
409
|
+
Text5,
|
|
386
410
|
{
|
|
387
411
|
color: "text50",
|
|
388
412
|
fontSize: "small",
|
|
@@ -391,11 +415,11 @@ var TransactionPreview = observer2(
|
|
|
391
415
|
children: title
|
|
392
416
|
}
|
|
393
417
|
),
|
|
394
|
-
/* @__PURE__ */
|
|
395
|
-
isConfirming && /* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ jsx5(NetworkImage, { chainId: Number(chainId), size: "xs" }),
|
|
419
|
+
isConfirming && /* @__PURE__ */ jsx5(TimeAgo, { date: /* @__PURE__ */ new Date() })
|
|
396
420
|
] }),
|
|
397
|
-
/* @__PURE__ */
|
|
398
|
-
/* @__PURE__ */
|
|
421
|
+
/* @__PURE__ */ jsxs4(Box4, { display: "flex", alignItems: "center", marginTop: "2", children: [
|
|
422
|
+
/* @__PURE__ */ jsx5(
|
|
399
423
|
Image,
|
|
400
424
|
{
|
|
401
425
|
src: collectibleImage,
|
|
@@ -406,21 +430,21 @@ var TransactionPreview = observer2(
|
|
|
406
430
|
marginRight: "3"
|
|
407
431
|
}
|
|
408
432
|
),
|
|
409
|
-
/* @__PURE__ */
|
|
410
|
-
|
|
433
|
+
/* @__PURE__ */ jsxs4(
|
|
434
|
+
Box4,
|
|
411
435
|
{
|
|
412
436
|
display: "flex",
|
|
413
437
|
flexDirection: "column",
|
|
414
438
|
alignItems: "flex-start",
|
|
415
439
|
gap: "0.5",
|
|
416
440
|
children: [
|
|
417
|
-
/* @__PURE__ */
|
|
418
|
-
/* @__PURE__ */
|
|
441
|
+
/* @__PURE__ */ jsx5(Text5, { color: "text80", fontSize: "small", fontWeight: "medium", children: collectibleName }),
|
|
442
|
+
/* @__PURE__ */ jsx5(Text5, { color: "text100", fontSize: "small", children: collectionName })
|
|
419
443
|
]
|
|
420
444
|
}
|
|
421
445
|
),
|
|
422
|
-
price && /* @__PURE__ */
|
|
423
|
-
|
|
446
|
+
price && /* @__PURE__ */ jsxs4(
|
|
447
|
+
Box4,
|
|
424
448
|
{
|
|
425
449
|
flexGrow: "1",
|
|
426
450
|
display: "flex",
|
|
@@ -428,8 +452,8 @@ var TransactionPreview = observer2(
|
|
|
428
452
|
justifyContent: "flex-end",
|
|
429
453
|
gap: "1",
|
|
430
454
|
children: [
|
|
431
|
-
/* @__PURE__ */
|
|
432
|
-
/* @__PURE__ */
|
|
455
|
+
/* @__PURE__ */ jsx5(NetworkImage, { chainId: Number(chainId), size: "xs" }),
|
|
456
|
+
/* @__PURE__ */ jsxs4(Text5, { color: "text80", fontSize: "small", fontWeight: "medium", children: [
|
|
433
457
|
priceFormatted,
|
|
434
458
|
" ",
|
|
435
459
|
price.currency.symbol
|
|
@@ -443,37 +467,12 @@ var TransactionPreview = observer2(
|
|
|
443
467
|
);
|
|
444
468
|
var transactionPreview_default = TransactionPreview;
|
|
445
469
|
|
|
446
|
-
// src/react/ui/modals/_internal/components/
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
transactionHash,
|
|
451
|
-
isConfirming,
|
|
452
|
-
isConfirmed,
|
|
453
|
-
isFailed
|
|
454
|
-
}) {
|
|
455
|
-
const icon = isConfirming && /* @__PURE__ */ jsx5(Spinner2, { size: "md" }) || isConfirmed && /* @__PURE__ */ jsx5(PositiveCircleIcon_default, { size: "md" });
|
|
456
|
-
const title = isConfirming && "Processing transaction" || isConfirmed && "Transaction complete" || isFailed && "Transaction failed";
|
|
457
|
-
return /* @__PURE__ */ jsxs4(Box4, { display: "flex", alignItems: "center", children: [
|
|
458
|
-
icon,
|
|
459
|
-
/* @__PURE__ */ jsx5(Text5, { color: "text50", fontSize: "normal", fontWeight: "medium", marginLeft: "2", children: title }),
|
|
460
|
-
/* @__PURE__ */ jsx5(
|
|
461
|
-
Text5,
|
|
462
|
-
{
|
|
463
|
-
color: "polygonLight",
|
|
464
|
-
flexGrow: "1",
|
|
465
|
-
textAlign: "right",
|
|
466
|
-
fontSize: "normal",
|
|
467
|
-
fontWeight: "medium",
|
|
468
|
-
marginLeft: "2",
|
|
469
|
-
children: truncateMiddle(transactionHash, 4, 4)
|
|
470
|
-
}
|
|
471
|
-
)
|
|
472
|
-
] });
|
|
473
|
-
}
|
|
470
|
+
// src/react/ui/modals/_internal/components/transactionStatusModal/styles.css.ts
|
|
471
|
+
var closeButton4 = "fyvr11lw fyvr1tc fyvr1mo";
|
|
472
|
+
var dialogOverlay4 = "fyvr1m0 fyvr1o8 fyvr1qg fyvr1so fyvr11xl fyvr11m0 fyvr11rs";
|
|
473
|
+
var transactionStatusModalContent = "modal_dialogContent_wide__1ypl6nt3 modal_dialogContentBase__1ypl6nt1 fyvr11hg fyvr11i4 fyvr11g4 fyvr11gs fyvr11l8 fyvr11wl fyvr11m0 fyvr11rs fyvr1vo fyvr1xs fyvr1zw fyvr1120 fyvr11lc fyvr11mc fyvr11cw";
|
|
474
474
|
|
|
475
475
|
// src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
|
|
476
|
-
import { useTransactionReceipt } from "wagmi";
|
|
477
476
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
478
477
|
var useTransactionStatusModal = () => {
|
|
479
478
|
return {
|
|
@@ -566,6 +565,7 @@ var AccountModal = observer4(function AccountModal2() {
|
|
|
566
565
|
// src/react/ui/modals/CreateListingModal/index.tsx
|
|
567
566
|
import { Box as Box12 } from "@0xsequence/design-system";
|
|
568
567
|
import { Show, observer as observer8 } from "@legendapp/state/react";
|
|
568
|
+
import { useAccount as useAccount4 } from "wagmi";
|
|
569
569
|
|
|
570
570
|
// src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
|
|
571
571
|
import { useState as useState2 } from "react";
|
|
@@ -804,11 +804,6 @@ function FloorPriceText({
|
|
|
804
804
|
);
|
|
805
805
|
}
|
|
806
806
|
|
|
807
|
-
// src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
808
|
-
import { Box as Box8, NumericInput, TokenImage } from "@0xsequence/design-system";
|
|
809
|
-
import { observer as observer7 } from "@legendapp/state/react";
|
|
810
|
-
import { useState as useState4 } from "react";
|
|
811
|
-
|
|
812
807
|
// src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx
|
|
813
808
|
import { Box as Box7, Select as Select2, Skeleton as Skeleton2 } from "@0xsequence/design-system";
|
|
814
809
|
import { observer as observer6 } from "@legendapp/state/react";
|
|
@@ -858,29 +853,56 @@ var CurrencyOptionsSelect = observer6(function CurrencyOptionsSelect2({
|
|
|
858
853
|
var currencyOptionsSelect_default = CurrencyOptionsSelect;
|
|
859
854
|
|
|
860
855
|
// src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
861
|
-
import {
|
|
856
|
+
import { Box as Box8, NumericInput, TokenImage } from "@0xsequence/design-system";
|
|
857
|
+
import { observer as observer7 } from "@legendapp/state/react";
|
|
858
|
+
import { useState as useState4 } from "react";
|
|
859
|
+
import { erc20Abi, formatUnits as formatUnits2, parseUnits } from "viem";
|
|
860
|
+
import { useAccount as useAccount2, useReadContract } from "wagmi";
|
|
862
861
|
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
863
862
|
var PriceInput = observer7(function PriceInput2({
|
|
864
863
|
chainId,
|
|
865
864
|
collectionAddress,
|
|
866
865
|
$listingPrice,
|
|
867
|
-
|
|
866
|
+
checkBalance
|
|
868
867
|
}) {
|
|
869
|
-
const [
|
|
868
|
+
const [balanceError, setBalanceError] = useState4("");
|
|
869
|
+
const { address: accountAddress } = useAccount2();
|
|
870
|
+
const { data: balance, isSuccess: isBalanceSuccess } = useReadContract({
|
|
871
|
+
address: $listingPrice.currency.contractAddress.get(),
|
|
872
|
+
abi: erc20Abi,
|
|
873
|
+
functionName: "balanceOf",
|
|
874
|
+
args: [accountAddress],
|
|
875
|
+
query: {
|
|
876
|
+
enabled: checkBalance?.enabled
|
|
877
|
+
}
|
|
878
|
+
});
|
|
879
|
+
const listingPriceAmountRaw = $listingPrice.amountRaw.get();
|
|
880
|
+
const currencyDecimals = $listingPrice.currency.decimals.get();
|
|
881
|
+
const checkInsufficientBalance = (priceAmountRaw) => {
|
|
882
|
+
const hasInsufficientBalance = isBalanceSuccess && priceAmountRaw && currencyDecimals && BigInt(priceAmountRaw) > (balance || 0);
|
|
883
|
+
if (!checkBalance) return;
|
|
884
|
+
if (hasInsufficientBalance) {
|
|
885
|
+
setBalanceError("Insufficient balance");
|
|
886
|
+
checkBalance.callback(true);
|
|
887
|
+
} else {
|
|
888
|
+
setBalanceError("");
|
|
889
|
+
checkBalance.callback(false);
|
|
890
|
+
}
|
|
891
|
+
};
|
|
870
892
|
const changeListingPrice = (value) => {
|
|
871
|
-
setInputPrice(value);
|
|
872
893
|
const parsedAmount = parseUnits(
|
|
873
894
|
value,
|
|
874
895
|
Number($listingPrice.currency.decimals.get())
|
|
875
896
|
);
|
|
876
897
|
$listingPrice.amountRaw.set(parsedAmount.toString());
|
|
898
|
+
checkBalance && checkInsufficientBalance(parsedAmount.toString());
|
|
877
899
|
};
|
|
878
900
|
return /* @__PURE__ */ jsxs9(Box8, { className: priceInputWrapper, position: "relative", children: [
|
|
879
901
|
/* @__PURE__ */ jsx13(
|
|
880
902
|
Box8,
|
|
881
903
|
{
|
|
904
|
+
className: priceInputCurrencyImage,
|
|
882
905
|
position: "absolute",
|
|
883
|
-
bottom: "3",
|
|
884
906
|
left: "2",
|
|
885
907
|
display: "flex",
|
|
886
908
|
alignItems: "center",
|
|
@@ -904,12 +926,15 @@ var PriceInput = observer7(function PriceInput2({
|
|
|
904
926
|
}
|
|
905
927
|
),
|
|
906
928
|
numeric: true,
|
|
907
|
-
value:
|
|
929
|
+
value: listingPriceAmountRaw ? formatUnits2(
|
|
930
|
+
BigInt(listingPriceAmountRaw),
|
|
931
|
+
Number(currencyDecimals)
|
|
932
|
+
) : "",
|
|
908
933
|
onChange: (event) => changeListingPrice(event.target.value),
|
|
909
934
|
width: "full"
|
|
910
935
|
}
|
|
911
936
|
),
|
|
912
|
-
|
|
937
|
+
balanceError && /* @__PURE__ */ jsx13(Box8, { color: "negative", fontSize: "small", children: balanceError })
|
|
913
938
|
] });
|
|
914
939
|
});
|
|
915
940
|
var priceInput_default = PriceInput;
|
|
@@ -1084,7 +1109,7 @@ function TokenPreview({
|
|
|
1084
1109
|
|
|
1085
1110
|
// src/react/ui/modals/_internal/components/transactionDetails/index.tsx
|
|
1086
1111
|
import { Box as Box11, NetworkImage as NetworkImage2, Skeleton as Skeleton4, Text as Text11 } from "@0xsequence/design-system";
|
|
1087
|
-
import { formatUnits as
|
|
1112
|
+
import { formatUnits as formatUnits3 } from "viem";
|
|
1088
1113
|
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1089
1114
|
var DEFAULT_MARKETPLACE_FEE_PERCENTAGE = 2.5;
|
|
1090
1115
|
function TransactionDetails({
|
|
@@ -1103,7 +1128,7 @@ function TransactionDetails({
|
|
|
1103
1128
|
collectibleId
|
|
1104
1129
|
});
|
|
1105
1130
|
const priceLoading = !price || marketplaceConfigLoading || royaltyPercentageLoading;
|
|
1106
|
-
let formattedAmount = price &&
|
|
1131
|
+
let formattedAmount = price && formatUnits3(BigInt(price.amountRaw), price.currency.decimals);
|
|
1107
1132
|
if (royaltyPercentage !== void 0 && formattedAmount) {
|
|
1108
1133
|
formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * Number(royaltyPercentage) / 100).toString();
|
|
1109
1134
|
}
|
|
@@ -1136,7 +1161,7 @@ function TransactionDetails({
|
|
|
1136
1161
|
import { observable as observable4, when } from "@legendapp/state";
|
|
1137
1162
|
import { useMount, useSelector } from "@legendapp/state/react";
|
|
1138
1163
|
import { addDays as addDays2 } from "date-fns/addDays";
|
|
1139
|
-
import { useAccount as
|
|
1164
|
+
import { useAccount as useAccount3, useSendTransaction } from "wagmi";
|
|
1140
1165
|
|
|
1141
1166
|
// src/react/ui/modals/CreateListingModal/_utils/getCreateListingTransactionTitleMessage.ts
|
|
1142
1167
|
var getCreateListingTransactionTitle = (params) => {
|
|
@@ -1229,7 +1254,7 @@ var useHydrate = () => {
|
|
|
1229
1254
|
chainId,
|
|
1230
1255
|
onSuccess: onListingSuccess
|
|
1231
1256
|
});
|
|
1232
|
-
const { connector, address: userAddress } =
|
|
1257
|
+
const { connector, address: userAddress } = useAccount3();
|
|
1233
1258
|
useMount(() => {
|
|
1234
1259
|
const setSteps = async () => {
|
|
1235
1260
|
const createListingTransactionSteps = await generateListingTransactionAsync({
|
|
@@ -1284,7 +1309,7 @@ var useTokenApprovalHandler = (chainId) => {
|
|
|
1284
1309
|
};
|
|
1285
1310
|
var useCreateListingHandler = (chainId) => {
|
|
1286
1311
|
const { collectibleId, collectionAddress } = createListingModal$.state.get();
|
|
1287
|
-
const { connector, address } =
|
|
1312
|
+
const { connector, address } = useAccount3();
|
|
1288
1313
|
const {
|
|
1289
1314
|
generateListingTransactionAsync,
|
|
1290
1315
|
isPending: generateListingTransactionPending,
|
|
@@ -1298,7 +1323,7 @@ var useCreateListingHandler = (chainId) => {
|
|
|
1298
1323
|
const {
|
|
1299
1324
|
onUnknownError,
|
|
1300
1325
|
onSuccess
|
|
1301
|
-
} = createListingModal$.state.get().messages?.
|
|
1326
|
+
} = createListingModal$.state.get().messages?.createListing || {};
|
|
1302
1327
|
const { sendTransactionAsync, isPending: sendTransactionPending } = useSendTransaction();
|
|
1303
1328
|
const { show: showTransactionStatusModal } = useTransactionStatusModal();
|
|
1304
1329
|
createListingModal$.steps.createListing.set({
|
|
@@ -1377,10 +1402,9 @@ var useShowTransactionStatusModal = () => {
|
|
|
1377
1402
|
};
|
|
1378
1403
|
|
|
1379
1404
|
// src/react/ui/modals/CreateListingModal/index.tsx
|
|
1380
|
-
import { useAccount as useAccount3 } from "wagmi";
|
|
1381
1405
|
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1382
1406
|
var useCreateListingModal = () => {
|
|
1383
|
-
const { chainId: accountChainId } =
|
|
1407
|
+
const { chainId: accountChainId } = useAccount4();
|
|
1384
1408
|
const { show: showSwitchNetworkModal } = useSwitchChainModal();
|
|
1385
1409
|
const openModal = (args) => {
|
|
1386
1410
|
createListingModal$.open(args);
|
|
@@ -1496,15 +1520,14 @@ var ModalContent = observer8(() => {
|
|
|
1496
1520
|
|
|
1497
1521
|
// src/react/ui/modals/MakeOfferModal/index.tsx
|
|
1498
1522
|
import { Show as Show2, observer as observer9 } from "@legendapp/state/react";
|
|
1499
|
-
import {
|
|
1500
|
-
import { useAccount as
|
|
1523
|
+
import { useState as useState5 } from "react";
|
|
1524
|
+
import { useAccount as useAccount6 } from "wagmi";
|
|
1501
1525
|
|
|
1502
1526
|
// src/react/ui/modals/MakeOfferModal/_store.ts
|
|
1503
1527
|
import { observable as observable5, when as when2 } from "@legendapp/state";
|
|
1504
1528
|
import { useMount as useMount2, useSelector as useSelector2 } from "@legendapp/state/react";
|
|
1505
1529
|
import { addDays as addDays3 } from "date-fns/addDays";
|
|
1506
|
-
import {
|
|
1507
|
-
import { useAccount as useAccount4, useSendTransaction as useSendTransaction2 } from "wagmi";
|
|
1530
|
+
import { useAccount as useAccount5, useSendTransaction as useSendTransaction2 } from "wagmi";
|
|
1508
1531
|
|
|
1509
1532
|
// src/react/ui/modals/MakeOfferModal/_utils/getMakeOfferTransactionTitleMessage.ts
|
|
1510
1533
|
var getMakeOfferTransactionTitle = (params) => {
|
|
@@ -1599,7 +1622,7 @@ var useHydrate2 = () => {
|
|
|
1599
1622
|
chainId,
|
|
1600
1623
|
onSuccess: onOfferSuccess
|
|
1601
1624
|
});
|
|
1602
|
-
const { connector, address: userAddress } =
|
|
1625
|
+
const { connector, address: userAddress } = useAccount5();
|
|
1603
1626
|
useMount2(() => {
|
|
1604
1627
|
const setSteps = async () => {
|
|
1605
1628
|
const makeOfferTransactionData = await generateOfferTransactionAsync({
|
|
@@ -1654,7 +1677,7 @@ var useTokenApprovalHandler2 = (chainId) => {
|
|
|
1654
1677
|
};
|
|
1655
1678
|
var useCreateOfferHandler = (chainId) => {
|
|
1656
1679
|
const { collectibleId, collectionAddress } = makeOfferModal$.state.get();
|
|
1657
|
-
const { connector, address } =
|
|
1680
|
+
const { connector, address } = useAccount5();
|
|
1658
1681
|
const {
|
|
1659
1682
|
generateOfferTransactionAsync,
|
|
1660
1683
|
isPending: generateOfferTransactionPending,
|
|
@@ -1686,10 +1709,7 @@ var useCreateOfferHandler = (chainId) => {
|
|
|
1686
1709
|
quantity: makeOfferModal$.state.quantity.get(),
|
|
1687
1710
|
expiry: makeOfferModal$.state.expiry.get(),
|
|
1688
1711
|
currencyAddress: makeOfferModal$.state.offerPrice.currency.contractAddress.get(),
|
|
1689
|
-
pricePerToken:
|
|
1690
|
-
makeOfferModal$.state.offerPrice.amountRaw.get(),
|
|
1691
|
-
makeOfferModal$.state.offerPrice.currency.decimals.get()
|
|
1692
|
-
).toString()
|
|
1712
|
+
pricePerToken: makeOfferModal$.state.offerPrice.amountRaw.get()
|
|
1693
1713
|
}
|
|
1694
1714
|
}).then(async (steps) => {
|
|
1695
1715
|
const step = steps.find((s) => s.id === "createOffer" /* createOffer */);
|
|
@@ -1727,7 +1747,7 @@ var useCreateOfferHandler = (chainId) => {
|
|
|
1727
1747
|
// src/react/ui/modals/MakeOfferModal/index.tsx
|
|
1728
1748
|
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1729
1749
|
var useMakeOfferModal = () => {
|
|
1730
|
-
const { chainId: accountChainId } =
|
|
1750
|
+
const { chainId: accountChainId } = useAccount6();
|
|
1731
1751
|
const { show: showSwitchNetworkModal } = useSwitchChainModal();
|
|
1732
1752
|
const openModal = (args) => {
|
|
1733
1753
|
makeOfferModal$.open(args);
|
|
@@ -1757,6 +1777,7 @@ var Modal3 = () => {
|
|
|
1757
1777
|
return /* @__PURE__ */ jsx18(ModalContent2, {});
|
|
1758
1778
|
};
|
|
1759
1779
|
var ModalContent2 = observer9(() => {
|
|
1780
|
+
const [insufficientBalance, setInsufficientBalance] = useState5(false);
|
|
1760
1781
|
const {
|
|
1761
1782
|
chainId,
|
|
1762
1783
|
collectionAddress,
|
|
@@ -1766,17 +1787,6 @@ var ModalContent2 = observer9(() => {
|
|
|
1766
1787
|
offerPrice
|
|
1767
1788
|
} = makeOfferModal$.state.get();
|
|
1768
1789
|
const { steps } = makeOfferModal$.get();
|
|
1769
|
-
const { address: accountAddress } = useAccount5();
|
|
1770
|
-
const { data: balance, isSuccess: isBalanceSuccess } = useReadContract({
|
|
1771
|
-
address: makeOfferModal$.state.offerPrice.currency.contractAddress.get(),
|
|
1772
|
-
abi: erc20Abi,
|
|
1773
|
-
functionName: "balanceOf",
|
|
1774
|
-
args: [accountAddress]
|
|
1775
|
-
});
|
|
1776
|
-
let balanceError = "";
|
|
1777
|
-
if (isBalanceSuccess && parseUnits3(offerPrice.amountRaw, offerPrice.currency.decimals) > (balance || 0)) {
|
|
1778
|
-
balanceError = "Insufficient balance";
|
|
1779
|
-
}
|
|
1780
1790
|
const ctas = [
|
|
1781
1791
|
{
|
|
1782
1792
|
label: "Approve TOKEN",
|
|
@@ -1789,7 +1799,7 @@ var ModalContent2 = observer9(() => {
|
|
|
1789
1799
|
label: "Make offer",
|
|
1790
1800
|
onClick: steps.createOffer.execute,
|
|
1791
1801
|
pending: steps.createOffer.pending,
|
|
1792
|
-
disabled: steps.tokenApproval.isNeeded() || offerPrice.amountRaw === "0"
|
|
1802
|
+
disabled: steps.tokenApproval.isNeeded() || offerPrice.amountRaw === "0" || insufficientBalance
|
|
1793
1803
|
}
|
|
1794
1804
|
];
|
|
1795
1805
|
return /* @__PURE__ */ jsxs14(
|
|
@@ -1817,7 +1827,10 @@ var ModalContent2 = observer9(() => {
|
|
|
1817
1827
|
chainId,
|
|
1818
1828
|
collectionAddress,
|
|
1819
1829
|
$listingPrice: makeOfferModal$.state.offerPrice,
|
|
1820
|
-
|
|
1830
|
+
checkBalance: {
|
|
1831
|
+
enabled: true,
|
|
1832
|
+
callback: (state) => setInsufficientBalance(state)
|
|
1833
|
+
}
|
|
1821
1834
|
}
|
|
1822
1835
|
),
|
|
1823
1836
|
collectionType === "ERC1155" /* ERC1155 */ && /* @__PURE__ */ jsx18(
|
|
@@ -1844,34 +1857,28 @@ var ModalContent2 = observer9(() => {
|
|
|
1844
1857
|
);
|
|
1845
1858
|
});
|
|
1846
1859
|
|
|
1847
|
-
// src/react/ui/modals/SellModal/
|
|
1848
|
-
import {
|
|
1849
|
-
import {
|
|
1850
|
-
|
|
1851
|
-
// src/react/hooks/useGenerateSellTransaction.tsx
|
|
1852
|
-
import { useMutation } from "@tanstack/react-query";
|
|
1853
|
-
var generateSellTransaction = async (args, config, chainId) => {
|
|
1854
|
-
console.log("generateSellTransaction");
|
|
1855
|
-
console.log(args);
|
|
1856
|
-
console.log(chainId);
|
|
1857
|
-
const marketplaceClient = getMarketplaceClient(chainId, config);
|
|
1858
|
-
return marketplaceClient.generateSellTransaction(args);
|
|
1859
|
-
};
|
|
1860
|
-
var useGenerateSellTransaction = (params) => {
|
|
1861
|
-
const config = useConfig();
|
|
1862
|
-
const { mutate, mutateAsync, ...result } = useMutation({
|
|
1863
|
-
onSuccess: params.onSuccess,
|
|
1864
|
-
mutationFn: (args) => generateSellTransaction(args, config, params.chainId)
|
|
1865
|
-
});
|
|
1866
|
-
return {
|
|
1867
|
-
...result,
|
|
1868
|
-
generateSellTransaction: mutate,
|
|
1869
|
-
generateSellTransactionAsync: mutateAsync
|
|
1870
|
-
};
|
|
1871
|
-
};
|
|
1860
|
+
// src/react/ui/modals/SellModal/index.tsx
|
|
1861
|
+
import { Show as Show3, observer as observer10 } from "@legendapp/state/react";
|
|
1862
|
+
import { useAccount as useAccount8 } from "wagmi";
|
|
1872
1863
|
|
|
1873
|
-
// src/react/ui/modals/
|
|
1874
|
-
import {
|
|
1864
|
+
// src/react/ui/modals/_internal/components/transactionHeader/index.tsx
|
|
1865
|
+
import { Box as Box13, NetworkImage as NetworkImage3, Skeleton as Skeleton5, Text as Text12 } from "@0xsequence/design-system";
|
|
1866
|
+
import { formatDistanceToNow as formatDistanceToNow2 } from "date-fns";
|
|
1867
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1868
|
+
function TransactionHeader({
|
|
1869
|
+
title,
|
|
1870
|
+
chainId,
|
|
1871
|
+
date
|
|
1872
|
+
}) {
|
|
1873
|
+
return /* @__PURE__ */ jsxs15(Box13, { display: "flex", alignItems: "center", width: "full", children: [
|
|
1874
|
+
/* @__PURE__ */ jsx19(Text12, { fontSize: "small", fontWeight: "medium", color: "text80", marginRight: "1", children: title }),
|
|
1875
|
+
/* @__PURE__ */ jsx19(NetworkImage3, { size: "xs", chainId }),
|
|
1876
|
+
date && /* @__PURE__ */ jsxs15(Text12, { fontSize: "small", color: "text50", flexGrow: "1", textAlign: "right", children: [
|
|
1877
|
+
formatDistanceToNow2(date),
|
|
1878
|
+
" ago"
|
|
1879
|
+
] }) || /* @__PURE__ */ jsx19(Skeleton5, { width: "8", height: "4" })
|
|
1880
|
+
] });
|
|
1881
|
+
}
|
|
1875
1882
|
|
|
1876
1883
|
// src/react/ui/modals/SellModal/_utils/getSellTransactionTitleMessage.ts
|
|
1877
1884
|
var getSellTransactionTitle = (params) => {
|
|
@@ -1894,6 +1901,36 @@ var getSellTransactionMessage = (params, collectibleName) => {
|
|
|
1894
1901
|
};
|
|
1895
1902
|
|
|
1896
1903
|
// src/react/ui/modals/SellModal/_store.ts
|
|
1904
|
+
import { observable as observable6, when as when3 } from "@legendapp/state";
|
|
1905
|
+
import { useMount as useMount3, useSelector as useSelector3 } from "@legendapp/state/react";
|
|
1906
|
+
|
|
1907
|
+
// src/react/hooks/useGenerateSellTransaction.tsx
|
|
1908
|
+
import { useMutation } from "@tanstack/react-query";
|
|
1909
|
+
import { z } from "zod";
|
|
1910
|
+
var UserGeneratSellTransactionArgsSchema = z.object({
|
|
1911
|
+
chainId: ChainIdSchema.pipe(z.coerce.string()),
|
|
1912
|
+
onSuccess: z.function().args(stepSchema.array().optional()).optional()
|
|
1913
|
+
});
|
|
1914
|
+
var generateSellTransaction = async (args, config, chainId) => {
|
|
1915
|
+
const parsedChainId = ChainIdSchema.pipe(z.coerce.string()).parse(chainId);
|
|
1916
|
+
const marketplaceClient = getMarketplaceClient(parsedChainId, config);
|
|
1917
|
+
return marketplaceClient.generateSellTransaction(args).then((data) => data.steps);
|
|
1918
|
+
};
|
|
1919
|
+
var useGenerateSellTransaction = (params) => {
|
|
1920
|
+
const config = useConfig();
|
|
1921
|
+
const { mutate, mutateAsync, ...result } = useMutation({
|
|
1922
|
+
onSuccess: params.onSuccess,
|
|
1923
|
+
mutationFn: (args) => generateSellTransaction(args, config, params.chainId)
|
|
1924
|
+
});
|
|
1925
|
+
return {
|
|
1926
|
+
...result,
|
|
1927
|
+
generateSellTransaction: mutate,
|
|
1928
|
+
generateSellTransactionAsync: mutateAsync
|
|
1929
|
+
};
|
|
1930
|
+
};
|
|
1931
|
+
|
|
1932
|
+
// src/react/ui/modals/SellModal/_store.ts
|
|
1933
|
+
import { useAccount as useAccount7, useSendTransaction as useSendTransaction3 } from "wagmi";
|
|
1897
1934
|
var initialState5 = {
|
|
1898
1935
|
isOpen: false,
|
|
1899
1936
|
open: ({
|
|
@@ -1944,7 +1981,7 @@ var useHydrate3 = () => {
|
|
|
1944
1981
|
const { generateSellTransactionAsync } = useGenerateSellTransaction({
|
|
1945
1982
|
chainId
|
|
1946
1983
|
});
|
|
1947
|
-
const { connector, address } =
|
|
1984
|
+
const { connector, address } = useAccount7();
|
|
1948
1985
|
useMount3(() => {
|
|
1949
1986
|
const setSteps = async () => {
|
|
1950
1987
|
const sellTransactionData = await generateSellTransactionAsync({
|
|
@@ -1961,7 +1998,7 @@ var useHydrate3 = () => {
|
|
|
1961
1998
|
],
|
|
1962
1999
|
additionalFees: []
|
|
1963
2000
|
});
|
|
1964
|
-
sellModal$.steps.stepsData.set(sellTransactionData
|
|
2001
|
+
sellModal$.steps.stepsData.set(sellTransactionData);
|
|
1965
2002
|
};
|
|
1966
2003
|
when3(() => !!order && !!connector, setSteps);
|
|
1967
2004
|
});
|
|
@@ -1998,7 +2035,7 @@ var useTokenApprovalHandler3 = (chainId) => {
|
|
|
1998
2035
|
}
|
|
1999
2036
|
};
|
|
2000
2037
|
var useSellHandler = (chainId) => {
|
|
2001
|
-
const { address } =
|
|
2038
|
+
const { address } = useAccount7();
|
|
2002
2039
|
const { tokenId, collectionAddress } = sellModal$.state.get();
|
|
2003
2040
|
const {
|
|
2004
2041
|
generateSellTransactionAsync,
|
|
@@ -2035,14 +2072,14 @@ var useSellHandler = (chainId) => {
|
|
|
2035
2072
|
quantity: "1"
|
|
2036
2073
|
}
|
|
2037
2074
|
],
|
|
2038
|
-
additionalFees: [
|
|
2075
|
+
additionalFees: order?.feeBreakdown ? [
|
|
2039
2076
|
{
|
|
2040
2077
|
amount: String(order.feeBps),
|
|
2041
|
-
receiver: order.feeBreakdown[0]
|
|
2078
|
+
receiver: order.feeBreakdown?.[0]?.recipientAddress
|
|
2042
2079
|
}
|
|
2043
|
-
]
|
|
2080
|
+
] : []
|
|
2044
2081
|
}).then(async (response) => {
|
|
2045
|
-
const step = response.
|
|
2082
|
+
const step = response.find((s) => s.id === "sell" /* sell */);
|
|
2046
2083
|
if (!step) throw new Error("No steps found");
|
|
2047
2084
|
try {
|
|
2048
2085
|
const hash = await sendTransactionAsync({
|
|
@@ -2071,6 +2108,7 @@ var useSellHandler = (chainId) => {
|
|
|
2071
2108
|
sellModal$.close();
|
|
2072
2109
|
onSuccess && onSuccess();
|
|
2073
2110
|
} catch (error) {
|
|
2111
|
+
onUnknownError && onUnknownError(error);
|
|
2074
2112
|
}
|
|
2075
2113
|
}).catch((error) => {
|
|
2076
2114
|
onUnknownError && onUnknownError(error);
|
|
@@ -2085,32 +2123,9 @@ var useSellHandler = (chainId) => {
|
|
|
2085
2123
|
};
|
|
2086
2124
|
|
|
2087
2125
|
// src/react/ui/modals/SellModal/index.tsx
|
|
2088
|
-
import { observer as observer10, Show as Show3 } from "@legendapp/state/react";
|
|
2089
|
-
|
|
2090
|
-
// src/react/ui/modals/_internal/components/transactionHeader/index.tsx
|
|
2091
|
-
import { Box as Box13, NetworkImage as NetworkImage3, Skeleton as Skeleton5, Text as Text12 } from "@0xsequence/design-system";
|
|
2092
|
-
import { formatDistanceToNow as formatDistanceToNow2 } from "date-fns";
|
|
2093
|
-
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2094
|
-
function TransactionHeader({
|
|
2095
|
-
title,
|
|
2096
|
-
chainId,
|
|
2097
|
-
date
|
|
2098
|
-
}) {
|
|
2099
|
-
return /* @__PURE__ */ jsxs15(Box13, { display: "flex", alignItems: "center", width: "full", children: [
|
|
2100
|
-
/* @__PURE__ */ jsx19(Text12, { fontSize: "small", fontWeight: "medium", color: "text80", marginRight: "1", children: title }),
|
|
2101
|
-
/* @__PURE__ */ jsx19(NetworkImage3, { size: "xs", chainId }),
|
|
2102
|
-
date && /* @__PURE__ */ jsxs15(Text12, { fontSize: "small", color: "text50", flexGrow: "1", textAlign: "right", children: [
|
|
2103
|
-
formatDistanceToNow2(date),
|
|
2104
|
-
" ago"
|
|
2105
|
-
] }) || /* @__PURE__ */ jsx19(Skeleton5, { width: "8", height: "4" })
|
|
2106
|
-
] });
|
|
2107
|
-
}
|
|
2108
|
-
|
|
2109
|
-
// src/react/ui/modals/SellModal/index.tsx
|
|
2110
|
-
import { useAccount as useAccount7 } from "wagmi";
|
|
2111
2126
|
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2112
2127
|
var useSellModal = () => {
|
|
2113
|
-
const { chainId: accountChainId } =
|
|
2128
|
+
const { chainId: accountChainId } = useAccount8();
|
|
2114
2129
|
const { show: showSwitchNetworkModal } = useSwitchChainModal();
|
|
2115
2130
|
const openModal = (args) => {
|
|
2116
2131
|
sellModal$.open(args);
|
|
@@ -2431,6 +2446,11 @@ var transferModal$ = observable8(initialState7);
|
|
|
2431
2446
|
import { CloseIcon as CloseIcon4, IconButton as IconButton5 } from "@0xsequence/design-system";
|
|
2432
2447
|
import { observer as observer13, Show as Show4 } from "@legendapp/state/react";
|
|
2433
2448
|
import { Close as Close4, Content as Content5, Overlay as Overlay4, Portal as Portal5, Root as Root5 } from "@radix-ui/react-dialog";
|
|
2449
|
+
import { useAccount as useAccount10 } from "wagmi";
|
|
2450
|
+
|
|
2451
|
+
// src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
|
|
2452
|
+
import { Box as Box15, Button as Button5, Text as Text14, TextInput } from "@0xsequence/design-system";
|
|
2453
|
+
import { isAddress } from "viem";
|
|
2434
2454
|
import { useAccount as useAccount9 } from "wagmi";
|
|
2435
2455
|
|
|
2436
2456
|
// src/react/ui/modals/TransferModal/messages.ts
|
|
@@ -2443,22 +2463,20 @@ function getMessage(key) {
|
|
|
2443
2463
|
}
|
|
2444
2464
|
|
|
2445
2465
|
// src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
|
|
2446
|
-
import { Box as Box15, Button as Button5, Text as Text14, TextInput } from "@0xsequence/design-system";
|
|
2447
|
-
import { isAddress } from "viem";
|
|
2448
|
-
import { useAccount as useAccount8 } from "wagmi";
|
|
2449
2466
|
import { Fragment, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2450
2467
|
var EnterWalletAddressView = () => {
|
|
2451
|
-
const { address } =
|
|
2468
|
+
const { address } = useAccount9();
|
|
2452
2469
|
const { collectionAddress, chainId, tokenId, collectionType } = transferModal$.state.get();
|
|
2453
2470
|
const $quantity = transferModal$.state.quantity;
|
|
2454
2471
|
const isWalletAddressValid = isAddress(
|
|
2455
2472
|
transferModal$.state.receiverAddress.get()
|
|
2456
2473
|
);
|
|
2457
|
-
const { data: tokenBalance } =
|
|
2474
|
+
const { data: tokenBalance } = useListBalances({
|
|
2458
2475
|
chainId,
|
|
2459
2476
|
contractAddress: collectionAddress,
|
|
2460
2477
|
tokenId,
|
|
2461
|
-
accountAddress: address
|
|
2478
|
+
accountAddress: address,
|
|
2479
|
+
query: { enabled: !!address }
|
|
2462
2480
|
});
|
|
2463
2481
|
const balanceAmount = tokenBalance?.pages[0].balances[0].balance;
|
|
2464
2482
|
const { data: collection } = useCollection({
|
|
@@ -2665,7 +2683,7 @@ var followWalletInstructions_default = FollowWalletInstructionsView;
|
|
|
2665
2683
|
// src/react/ui/modals/TransferModal/index.tsx
|
|
2666
2684
|
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2667
2685
|
var useTransferModal = () => {
|
|
2668
|
-
const { chainId: accountChainId } =
|
|
2686
|
+
const { chainId: accountChainId } = useAccount10();
|
|
2669
2687
|
const { show: showSwitchNetworkModal } = useSwitchChainModal();
|
|
2670
2688
|
const openModal = (args) => {
|
|
2671
2689
|
transferModal$.open(args);
|
|
@@ -2737,4 +2755,4 @@ export {
|
|
|
2737
2755
|
useTransferModal,
|
|
2738
2756
|
ModalProvider
|
|
2739
2757
|
};
|
|
2740
|
-
//# sourceMappingURL=chunk-
|
|
2758
|
+
//# sourceMappingURL=chunk-GNB736ZE.js.map
|