@0xsequence/marketplace-sdk 0.3.11 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3LOJQCTV.js → chunk-5GDO4ZBC.js} +5 -4
- package/dist/{chunk-3LOJQCTV.js.map → chunk-5GDO4ZBC.js.map} +1 -1
- package/dist/{chunk-E3ZFT6WR.js → chunk-EVRILXOH.js} +12 -2
- package/dist/chunk-EVRILXOH.js.map +1 -0
- package/dist/{chunk-N5F6IEAK.js → chunk-GSDUAHL3.js} +1 -1
- package/dist/chunk-GSDUAHL3.js.map +1 -0
- package/dist/{chunk-IRN77TJW.js → chunk-IOTKCWOB.js} +925 -667
- package/dist/chunk-IOTKCWOB.js.map +1 -0
- package/dist/{chunk-KRMV6FJE.js → chunk-KNX2LER4.js} +5 -6
- package/dist/{chunk-4FC3IG7C.js.map → chunk-KNX2LER4.js.map} +1 -1
- package/dist/{chunk-SBVLWSRZ.js → chunk-LF44FCG5.js} +2 -2
- package/dist/{chunk-SBVLWSRZ.js.map → chunk-LF44FCG5.js.map} +1 -1
- package/dist/{chunk-4FC3IG7C.js → chunk-LSMQVX77.js} +5 -6
- package/dist/{chunk-KRMV6FJE.js.map → chunk-LSMQVX77.js.map} +1 -1
- package/dist/{chunk-B3LFJJVS.js → chunk-MIYMMP2K.js} +90 -40
- package/dist/chunk-MIYMMP2K.js.map +1 -0
- package/dist/{chunk-Z7NLKEXF.js → chunk-QMO2CUNM.js} +2 -2
- package/dist/{chunk-L6GSYPCR.js → chunk-RZSZNVEH.js} +5 -5
- package/dist/{chunk-L6GSYPCR.js.map → chunk-RZSZNVEH.js.map} +1 -1
- package/dist/chunk-T5T6JNB2.js +171 -0
- package/dist/chunk-T5T6JNB2.js.map +1 -0
- package/dist/chunk-UPLTM63S.js +435 -0
- package/dist/chunk-UPLTM63S.js.map +1 -0
- package/dist/{chunk-Y7YO5TLE.js → chunk-XXML5K3X.js} +5 -2
- package/dist/chunk-XXML5K3X.js.map +1 -0
- package/dist/{create-config-CgtmCzvb.d.ts → create-config-8sffBvlt.d.ts} +1 -1
- package/dist/index.js +5 -5
- package/dist/react/_internal/api/index.js +2 -2
- package/dist/react/_internal/index.d.ts +1 -1
- package/dist/react/_internal/index.js +3 -3
- package/dist/react/_internal/wagmi/index.d.ts +1 -1
- package/dist/react/_internal/wagmi/index.js +2 -2
- package/dist/react/hooks/index.d.ts +666 -77
- package/dist/react/hooks/index.js +8 -8
- package/dist/react/index.css +17 -0
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +12 -12
- package/dist/react/ssr/index.js +1 -1
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/index.css +17 -0
- package/dist/react/ui/components/index.css.map +1 -1
- package/dist/react/ui/components/index.js +12 -12
- package/dist/react/ui/icons/index.js +4 -4
- package/dist/react/ui/icons/index.js.map +1 -1
- package/dist/react/ui/index.css +17 -0
- package/dist/react/ui/index.css.map +1 -1
- package/dist/react/ui/index.js +12 -12
- package/dist/react/ui/modals/_internal/components/actionModal/index.css +22 -0
- package/dist/react/ui/modals/_internal/components/actionModal/index.css.map +1 -1
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +17 -9
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +8 -4
- package/dist/react/ui/styles/index.d.ts +1 -1
- package/dist/styles/index.d.ts +1 -1
- package/dist/styles/index.js +2 -2
- package/dist/types/index.js +3 -3
- package/dist/utils/index.js +2 -2
- package/package.json +25 -25
- package/src/react/_internal/api/marketplace-api.ts +3 -2
- package/src/react/_internal/transaction-machine/execute-transaction.ts +41 -19
- package/src/react/_internal/transaction-machine/useTransactionMachine.ts +43 -8
- package/src/react/hooks/useBuyCollectable.tsx +15 -8
- package/src/react/hooks/useCancelOrder.tsx +15 -7
- package/src/react/hooks/useCreateListing.tsx +75 -11
- package/src/react/hooks/useCurrencies.tsx +1 -2
- package/src/react/hooks/useCurrencyBalance.tsx +1 -1
- package/src/react/hooks/useCurrencyOptions.tsx +1 -1
- package/src/react/hooks/useMakeOffer.tsx +74 -12
- package/src/react/hooks/useSell.tsx +73 -12
- package/src/react/ui/components/_internals/action-button/ActionButton.tsx +1 -7
- package/src/react/ui/components/_internals/action-button/types.ts +7 -0
- package/src/react/ui/components/_internals/custom-select/CustomSelect.tsx +18 -15
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +5 -7
- package/src/react/ui/components/collectible-card/Footer.tsx +5 -7
- package/src/react/ui/components/collectible-card/styles.css.ts +1 -1
- package/src/react/ui/icons/ArrowUp.tsx +3 -0
- package/src/react/ui/icons/Bell.tsx +3 -0
- package/src/react/ui/icons/CalendarIcon.tsx +3 -0
- package/src/react/ui/icons/DiamondEye.tsx +3 -0
- package/src/react/ui/icons/InfoIcon.tsx +3 -0
- package/src/react/ui/icons/InventoryIcon.tsx +3 -0
- package/src/react/ui/icons/MinusIcon.tsx +3 -0
- package/src/react/ui/icons/PlusIcon.tsx +3 -0
- package/src/react/ui/icons/PositiveCircleIcon.tsx +3 -0
- package/src/react/ui/modals/BuyModal/index.tsx +25 -8
- package/src/react/ui/modals/CreateListingModal/_store.ts +5 -2
- package/src/react/ui/modals/CreateListingModal/index.tsx +66 -25
- package/src/react/ui/modals/MakeOfferModal/_store.ts +5 -2
- package/src/react/ui/modals/MakeOfferModal/index.tsx +87 -67
- package/src/react/ui/modals/SellModal/index.tsx +107 -57
- package/src/react/ui/modals/TransferModal/_store.ts +1 -1
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +4 -2
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx +5 -5
- package/src/react/ui/modals/TransferModal/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +29 -8
- package/src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx +15 -5
- package/src/react/ui/modals/_internal/components/actionModal/LoadingModal.tsx +15 -5
- package/src/react/ui/modals/_internal/components/actionModal/store.ts +6 -0
- package/src/react/ui/modals/_internal/components/calendar/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/currencyImage/index.tsx +3 -3
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +11 -16
- package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +14 -19
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +34 -12
- package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +3 -3
- package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +7 -4
- package/src/react/ui/modals/_internal/components/tokenPreview/index.tsx +1 -0
- package/src/react/ui/modals/_internal/components/transaction-footer/index.tsx +10 -8
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +9 -5
- package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +7 -4
- package/src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx +9 -11
- package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +60 -31
- package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +6 -2
- package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getFormattedType.ts +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getMessage.ts +8 -2
- package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getTitle.ts +12 -3
- package/src/react/ui/modals/_internal/components/waasFeeOptionsBox/index.tsx +146 -0
- package/src/react/ui/modals/_internal/components/waasFeeOptionsBox/store.ts +12 -0
- package/src/react/ui/modals/_internal/components/waasFeeOptionsBox/styles.css.ts +53 -0
- package/src/react/ui/modals/_internal/components/waasFeeOptionsSelect/WaasFeeOptionsSelect.tsx +117 -0
- package/src/utils/_internal/error/transaction.ts +12 -2
- package/src/utils/price.ts +3 -4
- package/tsconfig.json +1 -21
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/chunk-B3LFJJVS.js.map +0 -1
- package/dist/chunk-E3ZFT6WR.js.map +0 -1
- package/dist/chunk-FFCNYF3S.js +0 -153
- package/dist/chunk-FFCNYF3S.js.map +0 -1
- package/dist/chunk-IRN77TJW.js.map +0 -1
- package/dist/chunk-N5F6IEAK.js.map +0 -1
- package/dist/chunk-NMCGA2TB.js +0 -98
- package/dist/chunk-NMCGA2TB.js.map +0 -1
- package/dist/chunk-Y7YO5TLE.js.map +0 -1
- /package/dist/{chunk-Z7NLKEXF.js.map → chunk-QMO2CUNM.js.map} +0 -0
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
import {
|
|
3
|
-
ActionModal
|
|
4
|
-
|
|
3
|
+
ActionModal,
|
|
4
|
+
CustomSelect,
|
|
5
|
+
useCurrencyBalance
|
|
6
|
+
} from "./chunk-UPLTM63S.js";
|
|
5
7
|
import {
|
|
6
8
|
CalendarIcon_default,
|
|
7
9
|
MinusIcon_default,
|
|
8
10
|
PlusIcon_default,
|
|
9
11
|
PositiveCircleIcon_default
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-T5T6JNB2.js";
|
|
11
13
|
import {
|
|
12
14
|
actionWrapper,
|
|
13
15
|
closeButton,
|
|
@@ -31,7 +33,7 @@ import {
|
|
|
31
33
|
quantityInputWrapper,
|
|
32
34
|
tokenPreview,
|
|
33
35
|
transferModalContent
|
|
34
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-RZSZNVEH.js";
|
|
35
37
|
import {
|
|
36
38
|
AlertMessage,
|
|
37
39
|
switchChainModal_default,
|
|
@@ -49,24 +51,24 @@ import {
|
|
|
49
51
|
useSwitchChainModal,
|
|
50
52
|
useTransactionMachine,
|
|
51
53
|
useTransferTokens
|
|
52
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-MIYMMP2K.js";
|
|
53
55
|
import {
|
|
54
56
|
iconVariants
|
|
55
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-LF44FCG5.js";
|
|
56
58
|
import {
|
|
57
59
|
calculatePriceDifferencePercentage,
|
|
58
60
|
getPublicRpcClient,
|
|
59
61
|
truncateMiddle
|
|
60
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-KNX2LER4.js";
|
|
61
63
|
import {
|
|
62
64
|
balanceQueries,
|
|
63
65
|
collectableKeys,
|
|
64
66
|
getQueryClient
|
|
65
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-5GDO4ZBC.js";
|
|
66
68
|
import {
|
|
67
69
|
InvalidContractTypeError,
|
|
68
70
|
InvalidStepError
|
|
69
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-EVRILXOH.js";
|
|
70
72
|
|
|
71
73
|
// src/react/ui/modals/modal-provider.tsx
|
|
72
74
|
import { observer as observer14 } from "@legendapp/state/react";
|
|
@@ -93,6 +95,7 @@ var AccountModal = observer(function AccountModal2() {
|
|
|
93
95
|
import { Box as Box3, Text as Text2, TokenImage } from "@0xsequence/design-system";
|
|
94
96
|
import { Show, observer as observer2, useSelector } from "@legendapp/state/react";
|
|
95
97
|
import { useEffect } from "react";
|
|
98
|
+
import { formatUnits, parseUnits } from "viem";
|
|
96
99
|
|
|
97
100
|
// src/react/ui/modals/_internal/components/quantityInput/index.tsx
|
|
98
101
|
import { Box as Box2, IconButton, NumericInput } from "@0xsequence/design-system";
|
|
@@ -108,14 +111,14 @@ function QuantityInput({
|
|
|
108
111
|
const decimalParts = sanitizedValue.split(".");
|
|
109
112
|
let formattedValue = sanitizedValue;
|
|
110
113
|
if (decimalParts.length > 2) {
|
|
111
|
-
formattedValue = decimalParts[0]
|
|
114
|
+
formattedValue = `${decimalParts[0]}.${decimalParts[1]}`;
|
|
112
115
|
}
|
|
113
116
|
const finalValue = formatQuantity(formattedValue);
|
|
114
117
|
$quantity.set(finalValue);
|
|
115
118
|
validateQuantity(finalValue);
|
|
116
119
|
}
|
|
117
120
|
function validateQuantity(value) {
|
|
118
|
-
if (!value || value.trim() === "" || isNaN(Number(value))) {
|
|
121
|
+
if (!value || value.trim() === "" || Number.isNaN(Number(value))) {
|
|
119
122
|
$invalidQuantity.set(true);
|
|
120
123
|
return;
|
|
121
124
|
}
|
|
@@ -128,7 +131,7 @@ function QuantityInput({
|
|
|
128
131
|
$invalidQuantity.set(numValue <= 0 || numValue > Number(maxQuantity));
|
|
129
132
|
}
|
|
130
133
|
function formatQuantity(value) {
|
|
131
|
-
if (!value || isNaN(Number(value))) {
|
|
134
|
+
if (!value || Number.isNaN(Number(value))) {
|
|
132
135
|
return "0";
|
|
133
136
|
}
|
|
134
137
|
const decimalParts = value.split(".");
|
|
@@ -238,7 +241,6 @@ var initialState = {
|
|
|
238
241
|
var buyModal$ = observable2(initialState);
|
|
239
242
|
|
|
240
243
|
// src/react/ui/modals/BuyModal/index.tsx
|
|
241
|
-
import { formatUnits, parseUnits } from "viem";
|
|
242
244
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
243
245
|
var useBuyModal = (callbacks) => {
|
|
244
246
|
return {
|
|
@@ -254,6 +256,7 @@ var BuyModalContent = () => {
|
|
|
254
256
|
);
|
|
255
257
|
const collectibleId = useSelector(buyModal$.state.order.tokenId);
|
|
256
258
|
const modalId = useSelector(buyModal$.state.modalId);
|
|
259
|
+
const callbacks = useSelector(buyModal$.callbacks);
|
|
257
260
|
const { data: collection } = useCollection({
|
|
258
261
|
chainId,
|
|
259
262
|
collectionAddress
|
|
@@ -261,9 +264,23 @@ var BuyModalContent = () => {
|
|
|
261
264
|
const { buy, isLoading } = useBuyCollectable({
|
|
262
265
|
chainId,
|
|
263
266
|
collectionAddress,
|
|
264
|
-
|
|
267
|
+
enabled: buyModal$.isOpen.get(),
|
|
268
|
+
onSwitchChainRefused: () => {
|
|
269
|
+
buyModal$.close();
|
|
270
|
+
},
|
|
271
|
+
onError: (error) => {
|
|
272
|
+
if (callbacks?.onError) {
|
|
273
|
+
callbacks.onError(error);
|
|
274
|
+
} else {
|
|
275
|
+
console.debug("onError callback not provided", error);
|
|
276
|
+
}
|
|
277
|
+
},
|
|
265
278
|
onSuccess: (hash) => {
|
|
266
|
-
|
|
279
|
+
if (callbacks?.onSuccess) {
|
|
280
|
+
callbacks.onSuccess(hash);
|
|
281
|
+
} else {
|
|
282
|
+
console.debug("onSuccess callback not provided", hash);
|
|
283
|
+
}
|
|
267
284
|
buyModal$.close();
|
|
268
285
|
}
|
|
269
286
|
});
|
|
@@ -272,7 +289,7 @@ var BuyModalContent = () => {
|
|
|
272
289
|
collectionAddress,
|
|
273
290
|
collectibleId
|
|
274
291
|
});
|
|
275
|
-
if (modalId
|
|
292
|
+
if (modalId === 0 || !collection || !collectable || !buy) return null;
|
|
276
293
|
return collection.type === "ERC721" /* ERC721 */ ? /* @__PURE__ */ jsx3(
|
|
277
294
|
CheckoutModal,
|
|
278
295
|
{
|
|
@@ -336,7 +353,8 @@ var ERC1155QuantityModal = observer2(
|
|
|
336
353
|
return /* @__PURE__ */ jsx3(
|
|
337
354
|
ActionModal,
|
|
338
355
|
{
|
|
339
|
-
|
|
356
|
+
isOpen: buyModal$.isOpen.get(),
|
|
357
|
+
chainId: order.chainId,
|
|
340
358
|
onClose: () => buyModal$.close(),
|
|
341
359
|
title: "Select Quantity",
|
|
342
360
|
ctas: [
|
|
@@ -382,6 +400,7 @@ var ERC1155QuantityModal = observer2(
|
|
|
382
400
|
// src/react/ui/modals/CreateListingModal/index.tsx
|
|
383
401
|
import { Box as Box14 } from "@0xsequence/design-system";
|
|
384
402
|
import { Show as Show2, observer as observer8 } from "@legendapp/state/react";
|
|
403
|
+
import { useEffect as useEffect6, useState as useState7 } from "react";
|
|
385
404
|
import { parseUnits as parseUnits3 } from "viem";
|
|
386
405
|
import { useAccount as useAccount3 } from "wagmi";
|
|
387
406
|
|
|
@@ -391,19 +410,36 @@ var useCreateListing = ({
|
|
|
391
410
|
onSuccess,
|
|
392
411
|
onError,
|
|
393
412
|
onTransactionSent,
|
|
413
|
+
onApprovalSuccess,
|
|
414
|
+
onSwitchChainRefused,
|
|
415
|
+
enabled,
|
|
394
416
|
...config
|
|
395
417
|
}) => {
|
|
396
418
|
const [isLoading, setIsLoading] = useState(false);
|
|
397
419
|
const [steps, setSteps] = useState(null);
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
420
|
+
const [executionState, setExecutionState] = useState(null);
|
|
421
|
+
const machineConfig = {
|
|
422
|
+
...config,
|
|
423
|
+
type: "LISTING" /* LISTING */
|
|
424
|
+
};
|
|
425
|
+
const { machine, isLoading: isMachineLoading } = useTransactionMachine({
|
|
426
|
+
config: machineConfig,
|
|
427
|
+
enabled,
|
|
428
|
+
onSuccess: (hash) => {
|
|
429
|
+
setExecutionState(null);
|
|
430
|
+
onSuccess?.(hash);
|
|
402
431
|
},
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
432
|
+
onError: (error) => {
|
|
433
|
+
setExecutionState(null);
|
|
434
|
+
onError?.(error);
|
|
435
|
+
},
|
|
436
|
+
onTransactionSent,
|
|
437
|
+
onApprovalSuccess: (hash) => {
|
|
438
|
+
setExecutionState(null);
|
|
439
|
+
onApprovalSuccess?.(hash);
|
|
440
|
+
},
|
|
441
|
+
onSwitchChainRefused
|
|
442
|
+
});
|
|
407
443
|
const loadSteps = useCallback(
|
|
408
444
|
async (props) => {
|
|
409
445
|
if (!machine) return;
|
|
@@ -413,16 +449,54 @@ var useCreateListing = ({
|
|
|
413
449
|
setIsLoading(false);
|
|
414
450
|
return;
|
|
415
451
|
}
|
|
416
|
-
setSteps(
|
|
452
|
+
setSteps({
|
|
453
|
+
...generatedSteps,
|
|
454
|
+
approval: {
|
|
455
|
+
...generatedSteps.approval,
|
|
456
|
+
isExecuting: executionState === "approval"
|
|
457
|
+
},
|
|
458
|
+
transaction: {
|
|
459
|
+
...generatedSteps.transaction,
|
|
460
|
+
isExecuting: executionState === "listing"
|
|
461
|
+
}
|
|
462
|
+
});
|
|
417
463
|
setIsLoading(false);
|
|
418
464
|
},
|
|
419
|
-
[machine,
|
|
465
|
+
[machine, executionState]
|
|
466
|
+
);
|
|
467
|
+
const handleStepExecution = useCallback(
|
|
468
|
+
async (type, execute) => {
|
|
469
|
+
if (!type) return;
|
|
470
|
+
setExecutionState(type);
|
|
471
|
+
try {
|
|
472
|
+
await execute();
|
|
473
|
+
} catch (error) {
|
|
474
|
+
setExecutionState(null);
|
|
475
|
+
throw error;
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
[]
|
|
420
479
|
);
|
|
421
480
|
return {
|
|
422
481
|
createListing: (props) => machine?.start(props),
|
|
423
482
|
getListingSteps: (props) => ({
|
|
424
483
|
isLoading,
|
|
425
|
-
steps
|
|
484
|
+
steps: steps ? {
|
|
485
|
+
...steps,
|
|
486
|
+
approval: {
|
|
487
|
+
...steps.approval,
|
|
488
|
+
isExecuting: executionState === "approval",
|
|
489
|
+
execute: () => handleStepExecution("approval", () => steps.approval.execute())
|
|
490
|
+
},
|
|
491
|
+
transaction: {
|
|
492
|
+
...steps.transaction,
|
|
493
|
+
isExecuting: executionState === "listing",
|
|
494
|
+
execute: () => handleStepExecution(
|
|
495
|
+
"listing",
|
|
496
|
+
() => steps.transaction.execute()
|
|
497
|
+
)
|
|
498
|
+
}
|
|
499
|
+
} : null,
|
|
426
500
|
refreshSteps: () => loadSteps(props)
|
|
427
501
|
}),
|
|
428
502
|
isLoading: isMachineLoading
|
|
@@ -432,73 +506,60 @@ var useCreateListing = ({
|
|
|
432
506
|
// src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx
|
|
433
507
|
import { Box as Box4 } from "@0xsequence/design-system";
|
|
434
508
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
435
|
-
var ErrorModal = ({
|
|
509
|
+
var ErrorModal = ({
|
|
510
|
+
isOpen,
|
|
511
|
+
chainId,
|
|
512
|
+
onClose,
|
|
513
|
+
title
|
|
514
|
+
}) => /* @__PURE__ */ jsx4(
|
|
515
|
+
ActionModal,
|
|
516
|
+
{
|
|
517
|
+
isOpen,
|
|
518
|
+
chainId,
|
|
519
|
+
onClose,
|
|
520
|
+
title,
|
|
521
|
+
ctas: [],
|
|
522
|
+
children: /* @__PURE__ */ jsx4(Box4, { display: "flex", justifyContent: "center", alignItems: "center", padding: "4", children: "Error loading item details" })
|
|
523
|
+
}
|
|
524
|
+
);
|
|
436
525
|
|
|
437
526
|
// src/react/ui/modals/_internal/components/actionModal/LoadingModal.tsx
|
|
438
527
|
import { Box as Box5, Spinner } from "@0xsequence/design-system";
|
|
439
528
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
440
|
-
var LoadingModal = ({
|
|
529
|
+
var LoadingModal = ({
|
|
530
|
+
isOpen,
|
|
531
|
+
chainId,
|
|
532
|
+
onClose,
|
|
533
|
+
title
|
|
534
|
+
}) => /* @__PURE__ */ jsx5(
|
|
535
|
+
ActionModal,
|
|
536
|
+
{
|
|
537
|
+
isOpen,
|
|
538
|
+
chainId,
|
|
539
|
+
onClose,
|
|
540
|
+
title,
|
|
541
|
+
ctas: [],
|
|
542
|
+
children: /* @__PURE__ */ jsx5(Box5, { display: "flex", justifyContent: "center", alignItems: "center", padding: "4", children: /* @__PURE__ */ jsx5(Spinner, { size: "lg" }) })
|
|
543
|
+
}
|
|
544
|
+
);
|
|
441
545
|
|
|
442
546
|
// src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
|
|
443
|
-
import { useState as useState2 } from "react";
|
|
444
547
|
import { Box as Box6, Skeleton, Text as Text3 } from "@0xsequence/design-system";
|
|
445
548
|
import { observer as observer3 } from "@legendapp/state/react";
|
|
446
|
-
import { addDays
|
|
447
|
-
|
|
448
|
-
// src/react/ui/components/_internals/custom-select/CustomSelect.tsx
|
|
449
|
-
import { CheckmarkIcon, ChevronDownIcon } from "@0xsequence/design-system";
|
|
450
|
-
import * as Select from "@radix-ui/react-select";
|
|
451
|
-
import React from "react";
|
|
452
|
-
|
|
453
|
-
// src/react/ui/components/_internals/custom-select/styles.css.ts
|
|
454
|
-
var content = "fyvr11eg fyvr11es fyvr11f4 fyvr11fg fyvr11hc fyvr11i0 fyvr11g0 fyvr11go fyvr11q0 fyvr11qg fyvr12q3 fyvr12ir fyvr1243 fyvr12bf fyvr12rr fyvr12kf fyvr125r fyvr12d3 fyvr11xx fyvr11r0 fyvr11rt";
|
|
455
|
-
var item = "styles_item__1ddtujk2 fyvr11h0 fyvr11ho fyvr11fo fyvr11gc fyvr1v4 fyvr1x8 fyvr1zs fyvr111g fyvr11ik fyvr12w9 fyvr11l8 fyvr11ow fyvr14g fyvr11m4 fyvr11rc fyvr12zf";
|
|
456
|
-
var itemIndicator = "fyvr11lw fyvr1qk fyvr11lk fyvr11ow fyvr11no";
|
|
457
|
-
var trigger = "fyvr11hk fyvr11i8 fyvr11g8 fyvr11gw fyvr1zg fyvr111k fyvr11lk fyvr11ow fyvr11no fyvr11ik fyvr14g fyvr11cg fyvr11wr fyvr12w9 fyvr12zf fyvr12s9 fyvr11a4";
|
|
458
|
-
|
|
459
|
-
// src/react/ui/components/_internals/custom-select/CustomSelect.tsx
|
|
460
|
-
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
461
|
-
var CustomSelectItem = React.forwardRef(({ children, ...props }, forwardedRef) => {
|
|
462
|
-
return /* @__PURE__ */ jsxs4(Select.Item, { className: item, ...props, ref: forwardedRef, children: [
|
|
463
|
-
/* @__PURE__ */ jsx6(Select.ItemText, { children }),
|
|
464
|
-
/* @__PURE__ */ jsx6(Select.ItemIndicator, { className: itemIndicator, children: /* @__PURE__ */ jsx6(CheckmarkIcon, { size: "xs" }) })
|
|
465
|
-
] });
|
|
466
|
-
});
|
|
467
|
-
var CustomSelect = ({
|
|
468
|
-
items,
|
|
469
|
-
value,
|
|
470
|
-
onValueChange,
|
|
471
|
-
defaultValue
|
|
472
|
-
}) => {
|
|
473
|
-
return /* @__PURE__ */ jsxs4(Select.Root, { onValueChange, defaultValue, children: [
|
|
474
|
-
/* @__PURE__ */ jsxs4(Select.Trigger, { className: trigger, value, children: [
|
|
475
|
-
/* @__PURE__ */ jsx6(Select.Value, {}),
|
|
476
|
-
/* @__PURE__ */ jsx6(Select.Icon, { children: /* @__PURE__ */ jsx6(ChevronDownIcon, { size: "xs" }) })
|
|
477
|
-
] }),
|
|
478
|
-
/* @__PURE__ */ jsx6(Select.Portal, { children: /* @__PURE__ */ jsx6(Select.Content, { className: content, children: /* @__PURE__ */ jsx6(Select.Viewport, { children: items.map((item2, index) => /* @__PURE__ */ jsx6(
|
|
479
|
-
CustomSelectItem,
|
|
480
|
-
{
|
|
481
|
-
value: item2.value,
|
|
482
|
-
disabled: item2.disabled,
|
|
483
|
-
children: item2.label
|
|
484
|
-
},
|
|
485
|
-
index
|
|
486
|
-
)) }) }) })
|
|
487
|
-
] });
|
|
488
|
-
};
|
|
549
|
+
import { addDays } from "date-fns";
|
|
489
550
|
|
|
490
551
|
// src/react/ui/modals/_internal/components/calendarPopover/index.tsx
|
|
491
552
|
import { Button as Button2 } from "@0xsequence/design-system";
|
|
492
|
-
import { Content
|
|
553
|
+
import { Content, Portal, Root, Trigger } from "@radix-ui/react-popover";
|
|
493
554
|
import { format } from "date-fns";
|
|
494
555
|
|
|
495
556
|
// src/react/ui/modals/_internal/components/calendar/index.tsx
|
|
496
557
|
import { DayPicker } from "react-day-picker";
|
|
497
558
|
import "react-day-picker/style.css";
|
|
498
|
-
import { jsx as
|
|
559
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
499
560
|
function Calendar({ ...props }) {
|
|
500
561
|
const { selectedDate, setSelectedDate } = props;
|
|
501
|
-
return /* @__PURE__ */
|
|
562
|
+
return /* @__PURE__ */ jsx6(
|
|
502
563
|
DayPicker,
|
|
503
564
|
{
|
|
504
565
|
disabled: {
|
|
@@ -520,7 +581,7 @@ function Calendar({ ...props }) {
|
|
|
520
581
|
margin: 0,
|
|
521
582
|
color: "hsl(var(--foreground))",
|
|
522
583
|
background: "hsl(var(--background))",
|
|
523
|
-
border:
|
|
584
|
+
border: "1px solid hsl(var(--border))",
|
|
524
585
|
borderRadius: "var(--radius)",
|
|
525
586
|
padding: "0.5rem",
|
|
526
587
|
position: "relative"
|
|
@@ -546,13 +607,13 @@ Calendar.displayName = "Calendar";
|
|
|
546
607
|
var calendar_default = Calendar;
|
|
547
608
|
|
|
548
609
|
// src/react/ui/modals/_internal/components/calendarPopover/index.tsx
|
|
549
|
-
import { jsx as
|
|
610
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
550
611
|
function CalendarPopover({
|
|
551
612
|
selectedDate,
|
|
552
613
|
setSelectedDate
|
|
553
614
|
}) {
|
|
554
|
-
return /* @__PURE__ */
|
|
555
|
-
/* @__PURE__ */
|
|
615
|
+
return /* @__PURE__ */ jsxs4(Root, { children: [
|
|
616
|
+
/* @__PURE__ */ jsx7(Trigger, { asChild: true, children: /* @__PURE__ */ jsx7(
|
|
556
617
|
Button2,
|
|
557
618
|
{
|
|
558
619
|
leftIcon: CalendarIcon_default,
|
|
@@ -562,7 +623,7 @@ function CalendarPopover({
|
|
|
562
623
|
shape: "square"
|
|
563
624
|
}
|
|
564
625
|
) }),
|
|
565
|
-
/* @__PURE__ */
|
|
626
|
+
/* @__PURE__ */ jsx7(Portal, { children: /* @__PURE__ */ jsx7(Content, { className: dateSelectPopoverContent, sideOffset: 5, children: /* @__PURE__ */ jsx7(
|
|
566
627
|
calendar_default,
|
|
567
628
|
{
|
|
568
629
|
selectedDate,
|
|
@@ -574,7 +635,8 @@ function CalendarPopover({
|
|
|
574
635
|
}
|
|
575
636
|
|
|
576
637
|
// src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
|
|
577
|
-
import {
|
|
638
|
+
import { useState as useState2 } from "react";
|
|
639
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
578
640
|
var PRESET_RANGES = {
|
|
579
641
|
TODAY: {
|
|
580
642
|
label: "Today",
|
|
@@ -607,12 +669,12 @@ var ExpirationDateSelect = observer3(function ExpirationDateSelect2({
|
|
|
607
669
|
$date
|
|
608
670
|
}) {
|
|
609
671
|
const defaultRange = "1_week";
|
|
610
|
-
const [
|
|
611
|
-
function handleSelectPresetRange(
|
|
612
|
-
setRange(range2);
|
|
672
|
+
const [selectedRange, setSelectedRange] = useState2(defaultRange);
|
|
673
|
+
function handleSelectPresetRange(range) {
|
|
613
674
|
const presetRange = Object.values(PRESET_RANGES).find(
|
|
614
|
-
(preset) => preset.value ===
|
|
675
|
+
(preset) => preset.value === range
|
|
615
676
|
);
|
|
677
|
+
setSelectedRange(range);
|
|
616
678
|
if (!presetRange) {
|
|
617
679
|
return;
|
|
618
680
|
}
|
|
@@ -620,19 +682,13 @@ var ExpirationDateSelect = observer3(function ExpirationDateSelect2({
|
|
|
620
682
|
$date.set(newDate);
|
|
621
683
|
}
|
|
622
684
|
function handleDateValueChange(date) {
|
|
623
|
-
const presetRange = Object.values(PRESET_RANGES).find(
|
|
624
|
-
(preset) => isSameDay(new Date(date), addDays(/* @__PURE__ */ new Date(), preset.offset))
|
|
625
|
-
);
|
|
626
|
-
if (presetRange) {
|
|
627
|
-
setRange(presetRange.value);
|
|
628
|
-
}
|
|
629
685
|
$date.set(date);
|
|
630
686
|
}
|
|
631
687
|
if (!$date.get()) {
|
|
632
|
-
return /* @__PURE__ */
|
|
688
|
+
return /* @__PURE__ */ jsx8(Skeleton, { borderRadius: "lg", width: "20", height: "7", marginRight: "3" });
|
|
633
689
|
}
|
|
634
|
-
return /* @__PURE__ */
|
|
635
|
-
/* @__PURE__ */
|
|
690
|
+
return /* @__PURE__ */ jsxs5(Box6, { width: "full", position: "relative", children: [
|
|
691
|
+
/* @__PURE__ */ jsx8(
|
|
636
692
|
Text3,
|
|
637
693
|
{
|
|
638
694
|
fontSize: "small",
|
|
@@ -644,7 +700,7 @@ var ExpirationDateSelect = observer3(function ExpirationDateSelect2({
|
|
|
644
700
|
children: "Set expiry"
|
|
645
701
|
}
|
|
646
702
|
),
|
|
647
|
-
/* @__PURE__ */
|
|
703
|
+
/* @__PURE__ */ jsxs5(
|
|
648
704
|
Box6,
|
|
649
705
|
{
|
|
650
706
|
className,
|
|
@@ -654,28 +710,31 @@ var ExpirationDateSelect = observer3(function ExpirationDateSelect2({
|
|
|
654
710
|
gap: "2",
|
|
655
711
|
marginTop: "0.5",
|
|
656
712
|
children: [
|
|
657
|
-
/* @__PURE__ */
|
|
713
|
+
/* @__PURE__ */ jsx8(
|
|
658
714
|
Box6,
|
|
659
715
|
{
|
|
660
716
|
position: "absolute",
|
|
661
717
|
right: "0",
|
|
662
718
|
onClick: (e) => e.stopPropagation(),
|
|
663
719
|
zIndex: "10",
|
|
664
|
-
children: /* @__PURE__ */
|
|
720
|
+
children: /* @__PURE__ */ jsx8(
|
|
665
721
|
CustomSelect,
|
|
666
722
|
{
|
|
667
723
|
items: Object.values(PRESET_RANGES).map((preset) => ({
|
|
668
724
|
label: preset.label,
|
|
669
|
-
value: preset.value
|
|
725
|
+
value: preset.value,
|
|
726
|
+
content: preset.label
|
|
670
727
|
})),
|
|
671
|
-
value: range,
|
|
672
728
|
onValueChange: (value) => handleSelectPresetRange(value),
|
|
673
|
-
defaultValue:
|
|
729
|
+
defaultValue: {
|
|
730
|
+
value: selectedRange,
|
|
731
|
+
content: selectedRange
|
|
732
|
+
}
|
|
674
733
|
}
|
|
675
734
|
)
|
|
676
735
|
}
|
|
677
736
|
),
|
|
678
|
-
/* @__PURE__ */
|
|
737
|
+
/* @__PURE__ */ jsx8(
|
|
679
738
|
CalendarPopover,
|
|
680
739
|
{
|
|
681
740
|
selectedDate: $date.get(),
|
|
@@ -691,7 +750,7 @@ var expirationDateSelect_default = ExpirationDateSelect;
|
|
|
691
750
|
|
|
692
751
|
// src/react/ui/modals/_internal/components/floorPriceText/index.tsx
|
|
693
752
|
import { Text as Text4 } from "@0xsequence/design-system";
|
|
694
|
-
import { jsx as
|
|
753
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
695
754
|
function FloorPriceText({
|
|
696
755
|
chainId,
|
|
697
756
|
collectionAddress,
|
|
@@ -716,7 +775,7 @@ function FloorPriceText({
|
|
|
716
775
|
decimals: price.currency.decimals
|
|
717
776
|
});
|
|
718
777
|
const floorPriceDifferenceText = floorPriceRaw === price.amountRaw ? "Same as floor price" : `${floorPriceDifference}% ${floorPriceRaw > price.amountRaw ? "below" : "above"} floor price`;
|
|
719
|
-
return /* @__PURE__ */
|
|
778
|
+
return /* @__PURE__ */ jsx9(
|
|
720
779
|
Text4,
|
|
721
780
|
{
|
|
722
781
|
fontSize: "small",
|
|
@@ -731,12 +790,59 @@ function FloorPriceText({
|
|
|
731
790
|
}
|
|
732
791
|
|
|
733
792
|
// src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
734
|
-
import { Box as Box8, NumericInput as NumericInput2 } from "@0xsequence/design-system";
|
|
793
|
+
import { Box as Box8, NumericInput as NumericInput2, Text as Text5 } from "@0xsequence/design-system";
|
|
735
794
|
import { observer as observer5 } from "@legendapp/state/react";
|
|
736
|
-
import { useState as useState4 } from "react";
|
|
795
|
+
import { useEffect as useEffect3, useState as useState4 } from "react";
|
|
737
796
|
import { parseUnits as parseUnits2 } from "viem";
|
|
738
797
|
import { useAccount as useAccount2 } from "wagmi";
|
|
739
798
|
|
|
799
|
+
// src/react/ui/modals/_internal/components/currencyImage/index.tsx
|
|
800
|
+
import { Box as Box7, TokenImage as TokenImage2 } from "@0xsequence/design-system";
|
|
801
|
+
import { useState as useState3 } from "react";
|
|
802
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
803
|
+
function CurrencyImage({
|
|
804
|
+
$listingPrice
|
|
805
|
+
}) {
|
|
806
|
+
const [imageLoadErrorCurrencyAddresses, setImageLoadErrorCurrencyAddresses] = useState3(null);
|
|
807
|
+
if (imageLoadErrorCurrencyAddresses?.includes(
|
|
808
|
+
$listingPrice.currency.contractAddress.get()
|
|
809
|
+
)) {
|
|
810
|
+
return /* @__PURE__ */ jsx10(
|
|
811
|
+
Box7,
|
|
812
|
+
{
|
|
813
|
+
width: "3",
|
|
814
|
+
height: "3",
|
|
815
|
+
borderRadius: "circle",
|
|
816
|
+
background: "backgroundSecondary"
|
|
817
|
+
}
|
|
818
|
+
);
|
|
819
|
+
}
|
|
820
|
+
return /* @__PURE__ */ jsx10(
|
|
821
|
+
TokenImage2,
|
|
822
|
+
{
|
|
823
|
+
src: $listingPrice.currency.imageUrl.get(),
|
|
824
|
+
onError: () => {
|
|
825
|
+
const listingPrice = $listingPrice?.get();
|
|
826
|
+
if (listingPrice) {
|
|
827
|
+
setImageLoadErrorCurrencyAddresses((prev) => {
|
|
828
|
+
if (!prev)
|
|
829
|
+
return [listingPrice.currency.contractAddress];
|
|
830
|
+
if (!prev.includes(listingPrice.currency.contractAddress)) {
|
|
831
|
+
return [
|
|
832
|
+
...prev,
|
|
833
|
+
listingPrice.currency.contractAddress
|
|
834
|
+
];
|
|
835
|
+
}
|
|
836
|
+
return prev;
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
size: "xs"
|
|
841
|
+
}
|
|
842
|
+
);
|
|
843
|
+
}
|
|
844
|
+
var currencyImage_default = CurrencyImage;
|
|
845
|
+
|
|
740
846
|
// src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx
|
|
741
847
|
import { Skeleton as Skeleton2 } from "@0xsequence/design-system";
|
|
742
848
|
import { observer as observer4 } from "@legendapp/state/react";
|
|
@@ -755,22 +861,17 @@ var CurrencyOptionsSelect = observer4(function CurrencyOptionsSelect2({
|
|
|
755
861
|
});
|
|
756
862
|
useEffect2(() => {
|
|
757
863
|
if (currencies && currencies.length > 0 && !selectedCurrency$.get()?.contractAddress) {
|
|
758
|
-
console.debug("Setting default currency", currencies[0]);
|
|
759
864
|
selectedCurrency$.set(currencies[0]);
|
|
760
865
|
}
|
|
761
866
|
}, [currencies]);
|
|
762
|
-
console.debug("CurrencyOptionsSelect", {
|
|
763
|
-
currencies,
|
|
764
|
-
currenciesLoading,
|
|
765
|
-
currency
|
|
766
|
-
});
|
|
767
867
|
if (!currencies || currenciesLoading || !currency.symbol) {
|
|
768
868
|
return /* @__PURE__ */ jsx11(Skeleton2, { borderRadius: "lg", width: "20", height: "7", marginRight: "3" });
|
|
769
869
|
}
|
|
770
870
|
const options = currencies.map(
|
|
771
871
|
(currency2) => ({
|
|
772
872
|
label: currency2.symbol,
|
|
773
|
-
value: currency2.contractAddress
|
|
873
|
+
value: currency2.contractAddress,
|
|
874
|
+
content: currency2.symbol
|
|
774
875
|
})
|
|
775
876
|
);
|
|
776
877
|
const onChange = (value) => {
|
|
@@ -783,111 +884,23 @@ var CurrencyOptionsSelect = observer4(function CurrencyOptionsSelect2({
|
|
|
783
884
|
CustomSelect,
|
|
784
885
|
{
|
|
785
886
|
items: options,
|
|
786
|
-
value: currency.symbol,
|
|
787
887
|
onValueChange: onChange,
|
|
788
|
-
defaultValue:
|
|
888
|
+
defaultValue: {
|
|
889
|
+
value: currency.contractAddress,
|
|
890
|
+
content: currency.symbol
|
|
891
|
+
}
|
|
789
892
|
}
|
|
790
893
|
);
|
|
791
894
|
});
|
|
792
895
|
var currencyOptionsSelect_default = CurrencyOptionsSelect;
|
|
793
896
|
|
|
794
|
-
// src/react/hooks/useCurrencyBalance.tsx
|
|
795
|
-
import { useQuery } from "@tanstack/react-query";
|
|
796
|
-
import { erc20Abi, formatUnits as formatUnits2, zeroAddress } from "viem";
|
|
797
|
-
function useCurrencyBalance({
|
|
798
|
-
currencyAddress,
|
|
799
|
-
chainId,
|
|
800
|
-
userAddress
|
|
801
|
-
}) {
|
|
802
|
-
const publicClient = getPublicRpcClient(chainId);
|
|
803
|
-
return useQuery({
|
|
804
|
-
queryKey: ["balance", currencyAddress, chainId, userAddress],
|
|
805
|
-
queryFn: async () => {
|
|
806
|
-
if (!userAddress) return null;
|
|
807
|
-
if (currencyAddress === zeroAddress) {
|
|
808
|
-
const balance2 = await publicClient.getBalance({
|
|
809
|
-
address: userAddress
|
|
810
|
-
});
|
|
811
|
-
return {
|
|
812
|
-
value: balance2,
|
|
813
|
-
formatted: formatUnits2(balance2, 18)
|
|
814
|
-
};
|
|
815
|
-
}
|
|
816
|
-
const [balance, decimals] = await Promise.all([
|
|
817
|
-
publicClient.readContract({
|
|
818
|
-
address: currencyAddress,
|
|
819
|
-
abi: erc20Abi,
|
|
820
|
-
functionName: "balanceOf",
|
|
821
|
-
args: [userAddress]
|
|
822
|
-
}),
|
|
823
|
-
publicClient.readContract({
|
|
824
|
-
address: currencyAddress,
|
|
825
|
-
abi: erc20Abi,
|
|
826
|
-
functionName: "decimals"
|
|
827
|
-
})
|
|
828
|
-
]);
|
|
829
|
-
return {
|
|
830
|
-
value: balance,
|
|
831
|
-
formatted: formatUnits2(balance, decimals)
|
|
832
|
-
};
|
|
833
|
-
},
|
|
834
|
-
enabled: !!userAddress && !!chainId && !!currencyAddress
|
|
835
|
-
});
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
// src/react/ui/modals/_internal/components/currencyImage/index.tsx
|
|
839
|
-
import { Box as Box7, TokenImage as TokenImage2 } from "@0xsequence/design-system";
|
|
840
|
-
import { useState as useState3 } from "react";
|
|
841
|
-
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
842
|
-
function CurrencyImage({
|
|
843
|
-
$listingPrice
|
|
844
|
-
}) {
|
|
845
|
-
const [imageLoadErrorCurrencyAddresses, setImageLoadErrorCurrencyAddresses] = useState3(null);
|
|
846
|
-
if (imageLoadErrorCurrencyAddresses?.includes(
|
|
847
|
-
$listingPrice.currency.contractAddress.get()
|
|
848
|
-
)) {
|
|
849
|
-
return /* @__PURE__ */ jsx12(
|
|
850
|
-
Box7,
|
|
851
|
-
{
|
|
852
|
-
width: "3",
|
|
853
|
-
height: "3",
|
|
854
|
-
borderRadius: "circle",
|
|
855
|
-
background: "backgroundSecondary"
|
|
856
|
-
}
|
|
857
|
-
);
|
|
858
|
-
}
|
|
859
|
-
return /* @__PURE__ */ jsx12(
|
|
860
|
-
TokenImage2,
|
|
861
|
-
{
|
|
862
|
-
src: $listingPrice.currency.imageUrl.get(),
|
|
863
|
-
onError: () => {
|
|
864
|
-
const listingPrice = $listingPrice?.get();
|
|
865
|
-
if (listingPrice) {
|
|
866
|
-
setImageLoadErrorCurrencyAddresses((prev) => {
|
|
867
|
-
if (!prev)
|
|
868
|
-
return [listingPrice.currency.contractAddress];
|
|
869
|
-
if (!prev.includes(listingPrice.currency.contractAddress)) {
|
|
870
|
-
return [
|
|
871
|
-
...prev,
|
|
872
|
-
listingPrice.currency.contractAddress
|
|
873
|
-
];
|
|
874
|
-
}
|
|
875
|
-
return prev;
|
|
876
|
-
});
|
|
877
|
-
}
|
|
878
|
-
},
|
|
879
|
-
size: "xs"
|
|
880
|
-
}
|
|
881
|
-
);
|
|
882
|
-
}
|
|
883
|
-
var currencyImage_default = CurrencyImage;
|
|
884
|
-
|
|
885
897
|
// src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
886
|
-
import { jsx as
|
|
898
|
+
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
887
899
|
var PriceInput = observer5(function PriceInput2({
|
|
888
900
|
chainId,
|
|
889
901
|
collectionAddress,
|
|
890
902
|
$listingPrice,
|
|
903
|
+
onPriceChange,
|
|
891
904
|
checkBalance
|
|
892
905
|
}) {
|
|
893
906
|
const [balanceError, setBalanceError] = useState4("");
|
|
@@ -899,6 +912,16 @@ var PriceInput = observer5(function PriceInput2({
|
|
|
899
912
|
});
|
|
900
913
|
const currencyDecimals = $listingPrice.currency.decimals.get();
|
|
901
914
|
const [value, setValue] = useState4("");
|
|
915
|
+
const changeListingPrice = (value2) => {
|
|
916
|
+
setValue(value2);
|
|
917
|
+
try {
|
|
918
|
+
const parsedAmount = parseUnits2(value2, Number(currencyDecimals));
|
|
919
|
+
$listingPrice.amountRaw.set(parsedAmount.toString());
|
|
920
|
+
onPriceChange?.();
|
|
921
|
+
} catch {
|
|
922
|
+
$listingPrice.amountRaw.set("0");
|
|
923
|
+
}
|
|
924
|
+
};
|
|
902
925
|
const checkInsufficientBalance = (priceAmountRaw) => {
|
|
903
926
|
const hasInsufficientBalance = isBalanceSuccess && priceAmountRaw && currencyDecimals && BigInt(priceAmountRaw) > (balance?.value || 0);
|
|
904
927
|
if (!checkBalance) return;
|
|
@@ -910,14 +933,14 @@ var PriceInput = observer5(function PriceInput2({
|
|
|
910
933
|
checkBalance.callback(false);
|
|
911
934
|
}
|
|
912
935
|
};
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
};
|
|
919
|
-
return /* @__PURE__ */
|
|
920
|
-
/* @__PURE__ */
|
|
936
|
+
useEffect3(() => {
|
|
937
|
+
const priceAmountRaw = $listingPrice.amountRaw.get();
|
|
938
|
+
if (priceAmountRaw && priceAmountRaw !== "0") {
|
|
939
|
+
checkInsufficientBalance(priceAmountRaw);
|
|
940
|
+
}
|
|
941
|
+
}, [$listingPrice.currency.get()]);
|
|
942
|
+
return /* @__PURE__ */ jsxs6(Box8, { className: priceInputWrapper, position: "relative", children: [
|
|
943
|
+
/* @__PURE__ */ jsx12(
|
|
921
944
|
Box8,
|
|
922
945
|
{
|
|
923
946
|
className: priceInputCurrencyImage,
|
|
@@ -925,17 +948,17 @@ var PriceInput = observer5(function PriceInput2({
|
|
|
925
948
|
left: "2",
|
|
926
949
|
display: "flex",
|
|
927
950
|
alignItems: "center",
|
|
928
|
-
children: /* @__PURE__ */
|
|
951
|
+
children: /* @__PURE__ */ jsx12(currencyImage_default, { $listingPrice })
|
|
929
952
|
}
|
|
930
953
|
),
|
|
931
|
-
/* @__PURE__ */
|
|
954
|
+
/* @__PURE__ */ jsx12(
|
|
932
955
|
NumericInput2,
|
|
933
956
|
{
|
|
934
957
|
name: "listingPrice",
|
|
935
958
|
decimals: currencyDecimals,
|
|
936
959
|
label: "Enter price",
|
|
937
960
|
labelLocation: "top",
|
|
938
|
-
controls: /* @__PURE__ */
|
|
961
|
+
controls: /* @__PURE__ */ jsx12(
|
|
939
962
|
currencyOptionsSelect_default,
|
|
940
963
|
{
|
|
941
964
|
selectedCurrency$: $listingPrice?.currency,
|
|
@@ -948,19 +971,30 @@ var PriceInput = observer5(function PriceInput2({
|
|
|
948
971
|
width: "full"
|
|
949
972
|
}
|
|
950
973
|
),
|
|
951
|
-
balanceError && /* @__PURE__ */
|
|
974
|
+
balanceError && /* @__PURE__ */ jsx12(
|
|
975
|
+
Text5,
|
|
976
|
+
{
|
|
977
|
+
color: "negative",
|
|
978
|
+
fontSize: "xsmall",
|
|
979
|
+
fontFamily: "body",
|
|
980
|
+
fontWeight: "semibold",
|
|
981
|
+
position: "absolute",
|
|
982
|
+
style: { bottom: "-13px" },
|
|
983
|
+
children: balanceError
|
|
984
|
+
}
|
|
985
|
+
)
|
|
952
986
|
] });
|
|
953
987
|
});
|
|
954
988
|
var priceInput_default = PriceInput;
|
|
955
989
|
|
|
956
990
|
// src/react/ui/modals/_internal/components/tokenPreview/index.tsx
|
|
957
|
-
import { Box as Box9, Image, Skeleton as Skeleton3, Text as
|
|
991
|
+
import { Box as Box9, Image, Skeleton as Skeleton3, Text as Text6 } from "@0xsequence/design-system";
|
|
958
992
|
|
|
959
993
|
// src/react/ui/images/chess-tile.png
|
|
960
994
|
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==";
|
|
961
995
|
|
|
962
996
|
// src/react/ui/modals/_internal/components/tokenPreview/index.tsx
|
|
963
|
-
import { jsx as
|
|
997
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
964
998
|
function TokenPreview({
|
|
965
999
|
collectionName,
|
|
966
1000
|
collectionAddress,
|
|
@@ -973,28 +1007,29 @@ function TokenPreview({
|
|
|
973
1007
|
collectibleId
|
|
974
1008
|
});
|
|
975
1009
|
if (collectibleLoading) {
|
|
976
|
-
return /* @__PURE__ */
|
|
977
|
-
/* @__PURE__ */
|
|
978
|
-
/* @__PURE__ */
|
|
979
|
-
/* @__PURE__ */
|
|
980
|
-
/* @__PURE__ */
|
|
1010
|
+
return /* @__PURE__ */ jsxs7(Box9, { display: "flex", alignItems: "center", gap: "3", width: "full", children: [
|
|
1011
|
+
/* @__PURE__ */ jsx13(Skeleton3, { width: "9", height: "9", borderRadius: "xs" }),
|
|
1012
|
+
/* @__PURE__ */ jsxs7(Box9, { display: "flex", flexGrow: "1", gap: "1", flexDirection: "column", children: [
|
|
1013
|
+
/* @__PURE__ */ jsx13(Skeleton3, { width: "1/3", height: "3" }),
|
|
1014
|
+
/* @__PURE__ */ jsx13(Skeleton3, { width: "1/2", height: "3" })
|
|
981
1015
|
] })
|
|
982
1016
|
] });
|
|
983
1017
|
}
|
|
984
|
-
return /* @__PURE__ */
|
|
985
|
-
/* @__PURE__ */
|
|
1018
|
+
return /* @__PURE__ */ jsxs7(Box9, { className: tokenPreview, children: [
|
|
1019
|
+
/* @__PURE__ */ jsx13(
|
|
986
1020
|
Image,
|
|
987
1021
|
{
|
|
988
1022
|
src: collectable?.image || chess_tile_default,
|
|
989
1023
|
alt: collectable?.name,
|
|
990
1024
|
width: "9",
|
|
991
1025
|
height: "9",
|
|
992
|
-
borderRadius: "xs"
|
|
1026
|
+
borderRadius: "xs",
|
|
1027
|
+
style: { objectFit: "cover" }
|
|
993
1028
|
}
|
|
994
1029
|
),
|
|
995
|
-
/* @__PURE__ */
|
|
996
|
-
/* @__PURE__ */
|
|
997
|
-
|
|
1030
|
+
/* @__PURE__ */ jsxs7(Box9, { display: "flex", flexDirection: "column", marginLeft: "3", children: [
|
|
1031
|
+
/* @__PURE__ */ jsx13(
|
|
1032
|
+
Text6,
|
|
998
1033
|
{
|
|
999
1034
|
fontSize: "small",
|
|
1000
1035
|
color: "text80",
|
|
@@ -1003,8 +1038,8 @@ function TokenPreview({
|
|
|
1003
1038
|
children: collectionName
|
|
1004
1039
|
}
|
|
1005
1040
|
),
|
|
1006
|
-
/* @__PURE__ */
|
|
1007
|
-
|
|
1041
|
+
/* @__PURE__ */ jsx13(
|
|
1042
|
+
Text6,
|
|
1008
1043
|
{
|
|
1009
1044
|
fontSize: "small",
|
|
1010
1045
|
fontWeight: "bold",
|
|
@@ -1018,15 +1053,16 @@ function TokenPreview({
|
|
|
1018
1053
|
}
|
|
1019
1054
|
|
|
1020
1055
|
// src/react/ui/modals/_internal/components/transactionDetails/index.tsx
|
|
1021
|
-
import { Box as Box10, Image as Image2, Skeleton as Skeleton4, Text as
|
|
1022
|
-
import { formatUnits as
|
|
1023
|
-
import { jsx as
|
|
1056
|
+
import { Box as Box10, Image as Image2, Skeleton as Skeleton4, Text as Text7 } from "@0xsequence/design-system";
|
|
1057
|
+
import { formatUnits as formatUnits2 } from "viem";
|
|
1058
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1024
1059
|
var DEFAULT_MARKETPLACE_FEE_PERCENTAGE = 2.5;
|
|
1025
1060
|
function TransactionDetails({
|
|
1026
1061
|
collectibleId,
|
|
1027
1062
|
collectionAddress,
|
|
1028
1063
|
chainId,
|
|
1029
1064
|
price,
|
|
1065
|
+
showPlaceholderPrice,
|
|
1030
1066
|
currencyImageUrl
|
|
1031
1067
|
}) {
|
|
1032
1068
|
const { data, isLoading: marketplaceConfigLoading } = useMarketplaceConfig();
|
|
@@ -1039,14 +1075,14 @@ function TransactionDetails({
|
|
|
1039
1075
|
collectibleId
|
|
1040
1076
|
});
|
|
1041
1077
|
const priceLoading = !price || marketplaceConfigLoading || royaltyPercentageLoading;
|
|
1042
|
-
let formattedAmount = price &&
|
|
1043
|
-
if (royaltyPercentage !== void 0 && formattedAmount) {
|
|
1044
|
-
formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * Number(royaltyPercentage) / 100).
|
|
1078
|
+
let formattedAmount = price && formatUnits2(BigInt(price.amountRaw), price.currency.decimals);
|
|
1079
|
+
if (royaltyPercentage !== void 0 && formattedAmount && price) {
|
|
1080
|
+
formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * Number(royaltyPercentage) / 100).toFixed(price.currency.decimals);
|
|
1045
1081
|
}
|
|
1046
|
-
if (marketplaceFeePercentage !== void 0 && formattedAmount) {
|
|
1047
|
-
formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * marketplaceFeePercentage / 100).
|
|
1082
|
+
if (marketplaceFeePercentage !== void 0 && formattedAmount && price) {
|
|
1083
|
+
formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * marketplaceFeePercentage / 100).toFixed(price.currency.decimals);
|
|
1048
1084
|
}
|
|
1049
|
-
return /* @__PURE__ */
|
|
1085
|
+
return /* @__PURE__ */ jsxs8(
|
|
1050
1086
|
Box10,
|
|
1051
1087
|
{
|
|
1052
1088
|
width: "full",
|
|
@@ -1054,11 +1090,11 @@ function TransactionDetails({
|
|
|
1054
1090
|
justifyContent: "space-between",
|
|
1055
1091
|
alignItems: "center",
|
|
1056
1092
|
children: [
|
|
1057
|
-
/* @__PURE__ */
|
|
1058
|
-
/* @__PURE__ */
|
|
1059
|
-
/* @__PURE__ */
|
|
1060
|
-
priceLoading ? /* @__PURE__ */
|
|
1061
|
-
formattedAmount,
|
|
1093
|
+
/* @__PURE__ */ jsx14(Text7, { fontSize: "small", color: "text50", fontFamily: "body", children: "Total earnings" }),
|
|
1094
|
+
/* @__PURE__ */ jsxs8(Box10, { display: "flex", alignItems: "center", gap: "2", children: [
|
|
1095
|
+
/* @__PURE__ */ jsx14(Image2, { src: currencyImageUrl, width: "3", height: "3" }),
|
|
1096
|
+
priceLoading ? /* @__PURE__ */ jsx14(Skeleton4, { width: "16", height: "4" }) : /* @__PURE__ */ jsxs8(Text7, { fontSize: "small", color: "text100", fontFamily: "body", children: [
|
|
1097
|
+
showPlaceholderPrice ? "0" : formattedAmount,
|
|
1062
1098
|
" ",
|
|
1063
1099
|
price.currency.symbol
|
|
1064
1100
|
] })
|
|
@@ -1073,32 +1109,34 @@ import {
|
|
|
1073
1109
|
CloseIcon,
|
|
1074
1110
|
IconButton as IconButton2,
|
|
1075
1111
|
Skeleton as Skeleton6,
|
|
1076
|
-
Text as
|
|
1112
|
+
Text as Text11
|
|
1077
1113
|
} from "@0xsequence/design-system";
|
|
1114
|
+
import { TRANSACTION_CONFIRMATIONS_DEFAULT } from "@0xsequence/kit";
|
|
1078
1115
|
import { observer as observer7 } from "@legendapp/state/react";
|
|
1079
|
-
import { Close, Content as
|
|
1080
|
-
import { useEffect as
|
|
1116
|
+
import { Close, Content as Content2, Overlay, Portal as Portal2, Root as Root2 } from "@radix-ui/react-dialog";
|
|
1117
|
+
import { useEffect as useEffect5, useState as useState6 } from "react";
|
|
1081
1118
|
import { WaitForTransactionReceiptTimeoutError } from "viem";
|
|
1082
1119
|
|
|
1083
1120
|
// src/react/ui/modals/_internal/components/transaction-footer/index.tsx
|
|
1084
1121
|
import { networks } from "@0xsequence/network";
|
|
1085
|
-
import { Box as Box11,
|
|
1086
|
-
import { jsx as
|
|
1122
|
+
import { Box as Box11, Text as Text8, Spinner as Spinner2 } from "@0xsequence/design-system";
|
|
1123
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1087
1124
|
function TransactionFooter({
|
|
1088
1125
|
transactionHash,
|
|
1126
|
+
orderId,
|
|
1089
1127
|
isConfirming,
|
|
1090
1128
|
isConfirmed,
|
|
1091
1129
|
isFailed,
|
|
1092
1130
|
isTimeout,
|
|
1093
1131
|
chainId
|
|
1094
1132
|
}) {
|
|
1095
|
-
const icon =
|
|
1096
|
-
const title =
|
|
1133
|
+
const icon = (isConfirmed || orderId) && /* @__PURE__ */ jsx15(PositiveCircleIcon_default, { size: "md" }) || isConfirming && /* @__PURE__ */ jsx15(Spinner2, { size: "md" });
|
|
1134
|
+
const title = (isConfirmed || orderId) && "Transaction complete" || isConfirming && "Processing transaction" || isFailed && "Transaction failed" || isTimeout && "Transaction took longer than expected";
|
|
1097
1135
|
const transactionUrl = `${networks[chainId]?.blockExplorer?.rootUrl}tx/${transactionHash}`;
|
|
1098
|
-
return /* @__PURE__ */
|
|
1136
|
+
return /* @__PURE__ */ jsxs9(Box11, { display: "flex", alignItems: "center", children: [
|
|
1099
1137
|
icon,
|
|
1100
|
-
/* @__PURE__ */
|
|
1101
|
-
|
|
1138
|
+
/* @__PURE__ */ jsx15(
|
|
1139
|
+
Text8,
|
|
1102
1140
|
{
|
|
1103
1141
|
color: "text50",
|
|
1104
1142
|
fontSize: "normal",
|
|
@@ -1108,7 +1146,7 @@ function TransactionFooter({
|
|
|
1108
1146
|
children: title
|
|
1109
1147
|
}
|
|
1110
1148
|
),
|
|
1111
|
-
/* @__PURE__ */
|
|
1149
|
+
/* @__PURE__ */ jsx15(
|
|
1112
1150
|
Box11,
|
|
1113
1151
|
{
|
|
1114
1152
|
as: "a",
|
|
@@ -1119,15 +1157,15 @@ function TransactionFooter({
|
|
|
1119
1157
|
rel: "noopener noreferrer",
|
|
1120
1158
|
textAlign: "right",
|
|
1121
1159
|
textDecoration: "none",
|
|
1122
|
-
children: /* @__PURE__ */
|
|
1123
|
-
|
|
1160
|
+
children: /* @__PURE__ */ jsx15(
|
|
1161
|
+
Text8,
|
|
1124
1162
|
{
|
|
1125
1163
|
color: "polygonLight",
|
|
1126
1164
|
textAlign: "right",
|
|
1127
1165
|
fontSize: "normal",
|
|
1128
1166
|
fontWeight: "medium",
|
|
1129
1167
|
fontFamily: "body",
|
|
1130
|
-
children: truncateMiddle(transactionHash, 4, 4)
|
|
1168
|
+
children: transactionHash && truncateMiddle(transactionHash, 4, 4)
|
|
1131
1169
|
}
|
|
1132
1170
|
)
|
|
1133
1171
|
}
|
|
@@ -1141,32 +1179,32 @@ import {
|
|
|
1141
1179
|
Image as Image3,
|
|
1142
1180
|
NetworkImage,
|
|
1143
1181
|
Skeleton as Skeleton5,
|
|
1144
|
-
Text as
|
|
1182
|
+
Text as Text10
|
|
1145
1183
|
} from "@0xsequence/design-system";
|
|
1146
1184
|
import { observer as observer6 } from "@legendapp/state/react";
|
|
1147
|
-
import { formatUnits as
|
|
1185
|
+
import { formatUnits as formatUnits3 } from "viem";
|
|
1148
1186
|
|
|
1149
1187
|
// src/react/ui/modals/_internal/components/timeAgo/index.tsx
|
|
1150
|
-
import { Box as Box12, Text as
|
|
1188
|
+
import { Box as Box12, Text as Text9 } from "@0xsequence/design-system";
|
|
1151
1189
|
import { formatDistanceToNow } from "date-fns";
|
|
1152
|
-
import { useEffect as
|
|
1153
|
-
import { jsx as
|
|
1190
|
+
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
1191
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1154
1192
|
function TimeAgo({ date }) {
|
|
1155
1193
|
const [timeAgo, setTimeAgo] = useState5("");
|
|
1156
|
-
|
|
1194
|
+
useEffect4(() => {
|
|
1157
1195
|
const interval = setInterval(() => {
|
|
1158
1196
|
setTimeAgo(formatDistanceToNow(date));
|
|
1159
1197
|
}, 1e3);
|
|
1160
1198
|
return () => clearInterval(interval);
|
|
1161
1199
|
}, [date]);
|
|
1162
|
-
return /* @__PURE__ */
|
|
1200
|
+
return /* @__PURE__ */ jsx16(
|
|
1163
1201
|
Box12,
|
|
1164
1202
|
{
|
|
1165
1203
|
flexGrow: "1",
|
|
1166
1204
|
display: "flex",
|
|
1167
1205
|
alignItems: "center",
|
|
1168
1206
|
justifyContent: "flex-end",
|
|
1169
|
-
children: /* @__PURE__ */
|
|
1207
|
+
children: /* @__PURE__ */ jsx16(Text9, { color: "text50", fontSize: "small", children: timeAgo })
|
|
1170
1208
|
}
|
|
1171
1209
|
);
|
|
1172
1210
|
}
|
|
@@ -1177,6 +1215,7 @@ var initialState2 = {
|
|
|
1177
1215
|
isOpen: false,
|
|
1178
1216
|
open: ({
|
|
1179
1217
|
hash,
|
|
1218
|
+
orderId,
|
|
1180
1219
|
price,
|
|
1181
1220
|
collectionAddress,
|
|
1182
1221
|
chainId,
|
|
@@ -1190,6 +1229,7 @@ var initialState2 = {
|
|
|
1190
1229
|
transactionStatusModal$.state.set({
|
|
1191
1230
|
...transactionStatusModal$.state.get(),
|
|
1192
1231
|
hash,
|
|
1232
|
+
orderId,
|
|
1193
1233
|
price,
|
|
1194
1234
|
collectionAddress,
|
|
1195
1235
|
chainId,
|
|
@@ -1210,6 +1250,7 @@ var initialState2 = {
|
|
|
1210
1250
|
},
|
|
1211
1251
|
state: {
|
|
1212
1252
|
hash: void 0,
|
|
1253
|
+
orderId: void 0,
|
|
1213
1254
|
status: "PENDING",
|
|
1214
1255
|
price: void 0,
|
|
1215
1256
|
collectionAddress: "",
|
|
@@ -1224,9 +1265,6 @@ var initialState2 = {
|
|
|
1224
1265
|
};
|
|
1225
1266
|
var transactionStatusModal$ = observable3(initialState2);
|
|
1226
1267
|
|
|
1227
|
-
// src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx
|
|
1228
|
-
import { useMemo } from "react";
|
|
1229
|
-
|
|
1230
1268
|
// src/react/ui/modals/_internal/components/transactionPreview/consts.ts
|
|
1231
1269
|
var TRANSACTION_TITLES = {
|
|
1232
1270
|
SELL: {
|
|
@@ -1262,22 +1300,21 @@ var TRANSACTION_TITLES = {
|
|
|
1262
1300
|
};
|
|
1263
1301
|
|
|
1264
1302
|
// src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx
|
|
1265
|
-
function useTransactionPreviewTitle(status, type) {
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
return "";
|
|
1274
|
-
}, [status, type]);
|
|
1303
|
+
function useTransactionPreviewTitle(orderId, status, type) {
|
|
1304
|
+
if (!type) return "";
|
|
1305
|
+
const { isConfirming, isConfirmed, isFailed } = status;
|
|
1306
|
+
const titles = TRANSACTION_TITLES[type];
|
|
1307
|
+
if (isConfirmed || orderId) return titles.confirmed;
|
|
1308
|
+
if (isConfirming) return titles.confirming;
|
|
1309
|
+
if (isFailed) return titles.failed;
|
|
1310
|
+
return "";
|
|
1275
1311
|
}
|
|
1276
1312
|
|
|
1277
1313
|
// src/react/ui/modals/_internal/components/transactionPreview/index.tsx
|
|
1278
|
-
import { jsx as
|
|
1314
|
+
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1279
1315
|
var TransactionPreview = observer6(
|
|
1280
1316
|
({
|
|
1317
|
+
orderId,
|
|
1281
1318
|
price,
|
|
1282
1319
|
collectionAddress,
|
|
1283
1320
|
chainId,
|
|
@@ -1291,6 +1328,7 @@ var TransactionPreview = observer6(
|
|
|
1291
1328
|
}) => {
|
|
1292
1329
|
const { type } = transactionStatusModal$.state.get();
|
|
1293
1330
|
const title = useTransactionPreviewTitle(
|
|
1331
|
+
orderId,
|
|
1294
1332
|
{ isConfirmed, isConfirming, isFailed, isTimeout },
|
|
1295
1333
|
type
|
|
1296
1334
|
);
|
|
@@ -1301,14 +1339,14 @@ var TransactionPreview = observer6(
|
|
|
1301
1339
|
const collectibleImage2 = collectible?.image;
|
|
1302
1340
|
const collectibleName = collectible?.name;
|
|
1303
1341
|
const collectionName = collection?.name;
|
|
1304
|
-
const priceFormatted = price ?
|
|
1342
|
+
const priceFormatted = price ? formatUnits3(BigInt(price?.amountRaw), price?.currency.decimals) : void 0;
|
|
1305
1343
|
if (collectibleLoading || collectionLoading) {
|
|
1306
|
-
return /* @__PURE__ */
|
|
1344
|
+
return /* @__PURE__ */ jsx17(Box13, { style: { height: 83 }, width: "full", borderRadius: "md", children: /* @__PURE__ */ jsx17(Skeleton5, { style: { width: "100%", height: "100%" } }) });
|
|
1307
1345
|
}
|
|
1308
|
-
return /* @__PURE__ */
|
|
1309
|
-
/* @__PURE__ */
|
|
1310
|
-
/* @__PURE__ */
|
|
1311
|
-
|
|
1346
|
+
return /* @__PURE__ */ jsxs10(Box13, { padding: "3", background: "backgroundSecondary", borderRadius: "md", children: [
|
|
1347
|
+
/* @__PURE__ */ jsxs10(Box13, { display: "flex", alignItems: "center", children: [
|
|
1348
|
+
/* @__PURE__ */ jsx17(
|
|
1349
|
+
Text10,
|
|
1312
1350
|
{
|
|
1313
1351
|
color: "text50",
|
|
1314
1352
|
fontSize: "small",
|
|
@@ -1318,11 +1356,11 @@ var TransactionPreview = observer6(
|
|
|
1318
1356
|
children: title
|
|
1319
1357
|
}
|
|
1320
1358
|
),
|
|
1321
|
-
/* @__PURE__ */
|
|
1322
|
-
isConfirming && /* @__PURE__ */
|
|
1359
|
+
/* @__PURE__ */ jsx17(NetworkImage, { chainId: Number(chainId), size: "xs" }),
|
|
1360
|
+
isConfirming && /* @__PURE__ */ jsx17(TimeAgo, { date: /* @__PURE__ */ new Date() })
|
|
1323
1361
|
] }),
|
|
1324
|
-
/* @__PURE__ */
|
|
1325
|
-
/* @__PURE__ */
|
|
1362
|
+
/* @__PURE__ */ jsxs10(Box13, { display: "flex", alignItems: "center", marginTop: "2", children: [
|
|
1363
|
+
/* @__PURE__ */ jsx17(
|
|
1326
1364
|
Image3,
|
|
1327
1365
|
{
|
|
1328
1366
|
src: collectibleImage2 || chess_tile_default,
|
|
@@ -1334,7 +1372,7 @@ var TransactionPreview = observer6(
|
|
|
1334
1372
|
style: { objectFit: "cover" }
|
|
1335
1373
|
}
|
|
1336
1374
|
),
|
|
1337
|
-
/* @__PURE__ */
|
|
1375
|
+
/* @__PURE__ */ jsxs10(
|
|
1338
1376
|
Box13,
|
|
1339
1377
|
{
|
|
1340
1378
|
display: "flex",
|
|
@@ -1342,8 +1380,8 @@ var TransactionPreview = observer6(
|
|
|
1342
1380
|
alignItems: "flex-start",
|
|
1343
1381
|
gap: "0.5",
|
|
1344
1382
|
children: [
|
|
1345
|
-
/* @__PURE__ */
|
|
1346
|
-
|
|
1383
|
+
/* @__PURE__ */ jsx17(
|
|
1384
|
+
Text10,
|
|
1347
1385
|
{
|
|
1348
1386
|
color: "text80",
|
|
1349
1387
|
fontSize: "small",
|
|
@@ -1352,11 +1390,11 @@ var TransactionPreview = observer6(
|
|
|
1352
1390
|
children: collectibleName
|
|
1353
1391
|
}
|
|
1354
1392
|
),
|
|
1355
|
-
/* @__PURE__ */
|
|
1393
|
+
/* @__PURE__ */ jsx17(Text10, { color: "text100", fontSize: "small", fontFamily: "body", children: collectionName })
|
|
1356
1394
|
]
|
|
1357
1395
|
}
|
|
1358
1396
|
),
|
|
1359
|
-
price && /* @__PURE__ */
|
|
1397
|
+
price && /* @__PURE__ */ jsxs10(
|
|
1360
1398
|
Box13,
|
|
1361
1399
|
{
|
|
1362
1400
|
flexGrow: "1",
|
|
@@ -1365,9 +1403,9 @@ var TransactionPreview = observer6(
|
|
|
1365
1403
|
justifyContent: "flex-end",
|
|
1366
1404
|
gap: "1",
|
|
1367
1405
|
children: [
|
|
1368
|
-
/* @__PURE__ */
|
|
1369
|
-
/* @__PURE__ */
|
|
1370
|
-
|
|
1406
|
+
/* @__PURE__ */ jsx17(Image3, { src: currencyImageUrl, width: "3", height: "3" }),
|
|
1407
|
+
/* @__PURE__ */ jsxs10(
|
|
1408
|
+
Text10,
|
|
1371
1409
|
{
|
|
1372
1410
|
color: "text80",
|
|
1373
1411
|
fontSize: "small",
|
|
@@ -1376,7 +1414,7 @@ var TransactionPreview = observer6(
|
|
|
1376
1414
|
children: [
|
|
1377
1415
|
priceFormatted,
|
|
1378
1416
|
" ",
|
|
1379
|
-
price
|
|
1417
|
+
price?.currency.symbol
|
|
1380
1418
|
]
|
|
1381
1419
|
}
|
|
1382
1420
|
)
|
|
@@ -1394,9 +1432,6 @@ var closeButton3 = "fyvr11lw fyvr1tc fyvr1mo";
|
|
|
1394
1432
|
var dialogOverlay3 = "fyvr1m0 fyvr1o8 fyvr1qg fyvr1so fyvr11xl fyvr11m0 fyvr11rs";
|
|
1395
1433
|
var transactionStatusModalContent = "modal_dialogContent_wide__1ypl6nt3 modal_dialogContentBase__1ypl6nt1 fyvr11hg fyvr11i4 fyvr11g4 fyvr11gs fyvr11l8 fyvr11wl fyvr11m0 fyvr11rs fyvr1vo fyvr1xs fyvr1zw fyvr1120 fyvr11lc fyvr11mc fyvr11cw";
|
|
1396
1434
|
|
|
1397
|
-
// src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
|
|
1398
|
-
import { TRANSACTION_CONFIRMATIONS_DEFAULT } from "@0xsequence/kit";
|
|
1399
|
-
|
|
1400
1435
|
// src/react/ui/modals/_internal/components/transactionStatusModal/util/getFormattedType.ts
|
|
1401
1436
|
function getFormattedType(transactionType, verb = false) {
|
|
1402
1437
|
switch (transactionType) {
|
|
@@ -1417,48 +1452,59 @@ function getFormattedType(transactionType, verb = false) {
|
|
|
1417
1452
|
}
|
|
1418
1453
|
}
|
|
1419
1454
|
|
|
1420
|
-
// src/react/ui/modals/_internal/components/transactionStatusModal/util/
|
|
1421
|
-
function
|
|
1455
|
+
// src/react/ui/modals/_internal/components/transactionStatusModal/util/getMessage.ts
|
|
1456
|
+
function getTransactionStatusModalMessage({
|
|
1422
1457
|
transactionStatus,
|
|
1423
|
-
transactionType
|
|
1458
|
+
transactionType,
|
|
1459
|
+
collectibleName,
|
|
1460
|
+
orderId
|
|
1424
1461
|
}) {
|
|
1462
|
+
const hideCollectibleName = transactionType === "CANCEL";
|
|
1463
|
+
if (orderId) {
|
|
1464
|
+
return `You just ${getFormattedType(transactionType, true)}${!hideCollectibleName ? ` ${collectibleName}` : ""}. It's been confirmed on the blockchain!`;
|
|
1465
|
+
}
|
|
1425
1466
|
switch (transactionStatus) {
|
|
1426
1467
|
case "PENDING":
|
|
1427
|
-
return `
|
|
1468
|
+
return `You just ${getFormattedType(transactionType, true)}${!hideCollectibleName ? ` ${collectibleName}` : ""}. It should be confirmed on the blockchain shortly.`;
|
|
1428
1469
|
case "SUCCESS":
|
|
1429
|
-
return `
|
|
1470
|
+
return `You just ${getFormattedType(transactionType, true)}${!hideCollectibleName ? ` ${collectibleName}` : ""}. It\u2019s been confirmed on the blockchain!`;
|
|
1430
1471
|
case "FAILED":
|
|
1431
|
-
return `Your ${getFormattedType(transactionType)} has failed
|
|
1472
|
+
return `Your ${getFormattedType(transactionType)} has failed.`;
|
|
1432
1473
|
case "TIMEOUT":
|
|
1433
|
-
return `Your ${getFormattedType(transactionType)} takes too long
|
|
1474
|
+
return `Your ${getFormattedType(transactionType)} takes too long. Click the link below to track it on the explorer.`;
|
|
1434
1475
|
default:
|
|
1435
1476
|
return "Your transaction is processing";
|
|
1436
1477
|
}
|
|
1437
1478
|
}
|
|
1438
1479
|
|
|
1439
|
-
// src/react/ui/modals/_internal/components/transactionStatusModal/util/
|
|
1440
|
-
function
|
|
1480
|
+
// src/react/ui/modals/_internal/components/transactionStatusModal/util/getTitle.ts
|
|
1481
|
+
function getTransactionStatusModalTitle({
|
|
1441
1482
|
transactionStatus,
|
|
1442
1483
|
transactionType,
|
|
1443
|
-
|
|
1484
|
+
orderId
|
|
1444
1485
|
}) {
|
|
1445
|
-
|
|
1486
|
+
if (transactionType === void 0) {
|
|
1487
|
+
return "";
|
|
1488
|
+
}
|
|
1489
|
+
if (orderId) {
|
|
1490
|
+
return `Your ${getFormattedType(transactionType)} has processed`;
|
|
1491
|
+
}
|
|
1446
1492
|
switch (transactionStatus) {
|
|
1447
1493
|
case "PENDING":
|
|
1448
|
-
return `
|
|
1494
|
+
return `Your ${getFormattedType(transactionType)} is processing`;
|
|
1449
1495
|
case "SUCCESS":
|
|
1450
|
-
return `
|
|
1496
|
+
return `Your ${getFormattedType(transactionType)} has processed`;
|
|
1451
1497
|
case "FAILED":
|
|
1452
|
-
return `Your ${getFormattedType(transactionType)} has failed
|
|
1498
|
+
return `Your ${getFormattedType(transactionType)} has failed`;
|
|
1453
1499
|
case "TIMEOUT":
|
|
1454
|
-
return `Your ${getFormattedType(transactionType)} takes too long
|
|
1500
|
+
return `Your ${getFormattedType(transactionType)} takes too long`;
|
|
1455
1501
|
default:
|
|
1456
1502
|
return "Your transaction is processing";
|
|
1457
1503
|
}
|
|
1458
1504
|
}
|
|
1459
1505
|
|
|
1460
1506
|
// src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
|
|
1461
|
-
import { jsx as
|
|
1507
|
+
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1462
1508
|
var useTransactionStatusModal = () => {
|
|
1463
1509
|
return {
|
|
1464
1510
|
show: (args) => {
|
|
@@ -1472,6 +1518,7 @@ var TransactionStatusModal = observer7(() => {
|
|
|
1472
1518
|
const {
|
|
1473
1519
|
type,
|
|
1474
1520
|
hash,
|
|
1521
|
+
orderId,
|
|
1475
1522
|
price,
|
|
1476
1523
|
collectionAddress,
|
|
1477
1524
|
chainId,
|
|
@@ -1485,32 +1532,28 @@ var TransactionStatusModal = observer7(() => {
|
|
|
1485
1532
|
chainId,
|
|
1486
1533
|
collectibleId
|
|
1487
1534
|
});
|
|
1488
|
-
const [transactionStatus, setTransactionStatus] = useState6(
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
});
|
|
1493
|
-
const message = getTransactionStatusModalMessage({
|
|
1494
|
-
transactionStatus,
|
|
1495
|
-
transactionType: type,
|
|
1496
|
-
collectibleName: collectible?.name || ""
|
|
1497
|
-
});
|
|
1498
|
-
const { onError, onSuccess } = callbacks || {};
|
|
1499
|
-
const queryClient = getQueryClient();
|
|
1500
|
-
const publicClient = chainId ? getPublicRpcClient(chainId) : null;
|
|
1501
|
-
const waitForTransactionReceiptPromise = publicClient?.waitForTransactionReceipt({
|
|
1502
|
-
confirmations: confirmations || TRANSACTION_CONFIRMATIONS_DEFAULT,
|
|
1503
|
-
hash
|
|
1504
|
-
});
|
|
1505
|
-
useEffect4(() => {
|
|
1535
|
+
const [transactionStatus, setTransactionStatus] = useState6(
|
|
1536
|
+
orderId ? "SUCCESS" : "PENDING"
|
|
1537
|
+
);
|
|
1538
|
+
useEffect5(() => {
|
|
1506
1539
|
if (!transactionStatusModal$.isOpen.get()) return;
|
|
1507
1540
|
console.log("Waiting for transaction receipt ...");
|
|
1508
1541
|
waitForTransactionReceiptPromise?.then((receipt) => {
|
|
1509
1542
|
if (receipt.status === "success") {
|
|
1510
1543
|
console.log("receipt", receipt);
|
|
1511
1544
|
setTransactionStatus("SUCCESS");
|
|
1545
|
+
if (callbacks?.onSuccess) {
|
|
1546
|
+
callbacks.onSuccess(hash || "0x");
|
|
1547
|
+
} else {
|
|
1548
|
+
console.debug("onSuccess callback not provided:", hash);
|
|
1549
|
+
}
|
|
1512
1550
|
}
|
|
1513
1551
|
}).catch((error) => {
|
|
1552
|
+
if (callbacks?.onError) {
|
|
1553
|
+
callbacks.onError(error);
|
|
1554
|
+
} else {
|
|
1555
|
+
console.debug("onError callback not provided:", error);
|
|
1556
|
+
}
|
|
1514
1557
|
if (error instanceof WaitForTransactionReceiptTimeoutError) {
|
|
1515
1558
|
setTransactionStatus("TIMEOUT");
|
|
1516
1559
|
return;
|
|
@@ -1523,12 +1566,36 @@ var TransactionStatusModal = observer7(() => {
|
|
|
1523
1566
|
return () => {
|
|
1524
1567
|
setTransactionStatus("PENDING");
|
|
1525
1568
|
};
|
|
1526
|
-
}, [
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1569
|
+
}, [
|
|
1570
|
+
callbacks?.onSuccess,
|
|
1571
|
+
callbacks?.onError,
|
|
1572
|
+
transactionStatusModal$.isOpen.get()
|
|
1573
|
+
]);
|
|
1574
|
+
if (!type) {
|
|
1575
|
+
return null;
|
|
1576
|
+
}
|
|
1577
|
+
const title = getTransactionStatusModalTitle({
|
|
1578
|
+
transactionStatus,
|
|
1579
|
+
transactionType: type,
|
|
1580
|
+
orderId
|
|
1581
|
+
});
|
|
1582
|
+
const message = getTransactionStatusModalMessage({
|
|
1583
|
+
transactionStatus,
|
|
1584
|
+
transactionType: type,
|
|
1585
|
+
collectibleName: collectible?.name || "",
|
|
1586
|
+
orderId
|
|
1587
|
+
});
|
|
1588
|
+
const queryClient = getQueryClient();
|
|
1589
|
+
const publicClient = chainId ? getPublicRpcClient(chainId) : null;
|
|
1590
|
+
const waitForTransactionReceiptPromise = publicClient?.waitForTransactionReceipt({
|
|
1591
|
+
confirmations: confirmations || TRANSACTION_CONFIRMATIONS_DEFAULT,
|
|
1592
|
+
hash: hash || "0x"
|
|
1593
|
+
});
|
|
1594
|
+
return /* @__PURE__ */ jsx18(Root2, { open: transactionStatusModal$.isOpen.get(), children: /* @__PURE__ */ jsxs11(Portal2, { children: [
|
|
1595
|
+
/* @__PURE__ */ jsx18(Overlay, { className: dialogOverlay3 }),
|
|
1596
|
+
/* @__PURE__ */ jsxs11(Content2, { className: transactionStatusModalContent, children: [
|
|
1597
|
+
title ? /* @__PURE__ */ jsx18(
|
|
1598
|
+
Text11,
|
|
1532
1599
|
{
|
|
1533
1600
|
fontSize: "large",
|
|
1534
1601
|
fontWeight: "bold",
|
|
@@ -1536,11 +1603,12 @@ var TransactionStatusModal = observer7(() => {
|
|
|
1536
1603
|
fontFamily: "body",
|
|
1537
1604
|
children: title
|
|
1538
1605
|
}
|
|
1539
|
-
) : /* @__PURE__ */
|
|
1540
|
-
message ? /* @__PURE__ */
|
|
1541
|
-
/* @__PURE__ */
|
|
1606
|
+
) : /* @__PURE__ */ jsx18(Skeleton6, { width: "16", height: "6" }),
|
|
1607
|
+
message ? /* @__PURE__ */ jsx18(Text11, { fontSize: "small", color: "text80", fontFamily: "body", children: message }) : /* @__PURE__ */ jsx18(Skeleton6, { width: "20", height: "4" }),
|
|
1608
|
+
/* @__PURE__ */ jsx18(
|
|
1542
1609
|
transactionPreview_default,
|
|
1543
1610
|
{
|
|
1611
|
+
orderId,
|
|
1544
1612
|
price,
|
|
1545
1613
|
collectionAddress,
|
|
1546
1614
|
chainId,
|
|
@@ -1553,10 +1621,11 @@ var TransactionStatusModal = observer7(() => {
|
|
|
1553
1621
|
isTimeout: transactionStatus === "TIMEOUT"
|
|
1554
1622
|
}
|
|
1555
1623
|
),
|
|
1556
|
-
/* @__PURE__ */
|
|
1624
|
+
/* @__PURE__ */ jsx18(
|
|
1557
1625
|
TransactionFooter,
|
|
1558
1626
|
{
|
|
1559
1627
|
transactionHash: hash,
|
|
1628
|
+
orderId,
|
|
1560
1629
|
isConfirming: transactionStatus === "PENDING",
|
|
1561
1630
|
isConfirmed: transactionStatus === "SUCCESS",
|
|
1562
1631
|
isFailed: transactionStatus === "FAILED",
|
|
@@ -1564,7 +1633,7 @@ var TransactionStatusModal = observer7(() => {
|
|
|
1564
1633
|
chainId
|
|
1565
1634
|
}
|
|
1566
1635
|
),
|
|
1567
|
-
/* @__PURE__ */
|
|
1636
|
+
/* @__PURE__ */ jsx18(
|
|
1568
1637
|
Close,
|
|
1569
1638
|
{
|
|
1570
1639
|
onClick: () => {
|
|
@@ -1572,7 +1641,7 @@ var TransactionStatusModal = observer7(() => {
|
|
|
1572
1641
|
},
|
|
1573
1642
|
className: closeButton3,
|
|
1574
1643
|
asChild: true,
|
|
1575
|
-
children: /* @__PURE__ */
|
|
1644
|
+
children: /* @__PURE__ */ jsx18(IconButton2, { size: "xs", "aria-label": "Close modal", icon: CloseIcon })
|
|
1576
1645
|
}
|
|
1577
1646
|
)
|
|
1578
1647
|
] })
|
|
@@ -1592,9 +1661,12 @@ var initialState3 = {
|
|
|
1592
1661
|
collectionName: "",
|
|
1593
1662
|
collectionType: void 0,
|
|
1594
1663
|
listingPrice: {
|
|
1595
|
-
|
|
1664
|
+
// to see if approval is needed when modal opens
|
|
1665
|
+
amountRaw: "1",
|
|
1596
1666
|
currency: {}
|
|
1597
1667
|
},
|
|
1668
|
+
// to track if the user has changed the price, so we know if it's 1 default or user input
|
|
1669
|
+
listingPriceChanged: false,
|
|
1598
1670
|
quantity: "1",
|
|
1599
1671
|
invalidQuantity: false,
|
|
1600
1672
|
expiry: new Date(addDays2(/* @__PURE__ */ new Date(), 7).toJSON()),
|
|
@@ -1619,7 +1691,7 @@ var initialState3 = {
|
|
|
1619
1691
|
var createListingModal$ = observable4(initialState3);
|
|
1620
1692
|
|
|
1621
1693
|
// src/react/ui/modals/CreateListingModal/index.tsx
|
|
1622
|
-
import { jsx as
|
|
1694
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1623
1695
|
var useCreateListingModal = (callbacks) => {
|
|
1624
1696
|
return {
|
|
1625
1697
|
show: (args) => createListingModal$.open({ ...args, defaultCallbacks: callbacks }),
|
|
@@ -1628,7 +1700,7 @@ var useCreateListingModal = (callbacks) => {
|
|
|
1628
1700
|
};
|
|
1629
1701
|
var CreateListingModal = () => {
|
|
1630
1702
|
const { show: showTransactionStatusModal } = useTransactionStatusModal();
|
|
1631
|
-
return /* @__PURE__ */
|
|
1703
|
+
return /* @__PURE__ */ jsx19(Show2, { if: createListingModal$.isOpen, children: /* @__PURE__ */ jsx19(Modal2, { showTransactionStatusModal }) });
|
|
1632
1704
|
};
|
|
1633
1705
|
var Modal2 = observer8(
|
|
1634
1706
|
({
|
|
@@ -1639,9 +1711,12 @@ var Modal2 = observer8(
|
|
|
1639
1711
|
collectionAddress,
|
|
1640
1712
|
chainId,
|
|
1641
1713
|
listingPrice,
|
|
1714
|
+
listingPriceChanged,
|
|
1642
1715
|
collectibleId,
|
|
1643
|
-
orderbookKind
|
|
1716
|
+
orderbookKind,
|
|
1717
|
+
callbacks
|
|
1644
1718
|
} = state;
|
|
1719
|
+
const currencyAddress = listingPrice.currency.contractAddress;
|
|
1645
1720
|
const {
|
|
1646
1721
|
data: collectible,
|
|
1647
1722
|
isLoading: collectableIsLoading,
|
|
@@ -1659,62 +1734,71 @@ var Modal2 = observer8(
|
|
|
1659
1734
|
chainId,
|
|
1660
1735
|
collectionAddress
|
|
1661
1736
|
});
|
|
1737
|
+
const [approvalExecutedSuccess, setApprovalExecutedSuccess] = useState7(false);
|
|
1662
1738
|
const { address } = useAccount3();
|
|
1663
1739
|
const { data: balance } = useBalanceOfCollectible({
|
|
1664
1740
|
chainId,
|
|
1665
1741
|
collectionAddress,
|
|
1666
1742
|
collectableId: collectibleId,
|
|
1667
|
-
userAddress: address
|
|
1743
|
+
userAddress: address ?? void 0
|
|
1668
1744
|
});
|
|
1669
|
-
const { getListingSteps, isLoading: machineLoading } = useCreateListing({
|
|
1745
|
+
const { getListingSteps, isLoading: machineLoading, createListing } = useCreateListing({
|
|
1670
1746
|
orderbookKind,
|
|
1671
1747
|
chainId,
|
|
1672
1748
|
collectionAddress,
|
|
1673
|
-
|
|
1674
|
-
|
|
1749
|
+
enabled: createListingModal$.isOpen.get(),
|
|
1750
|
+
onSwitchChainRefused: () => createListingModal$.close(),
|
|
1751
|
+
onApprovalSuccess: () => setApprovalExecutedSuccess(true),
|
|
1752
|
+
onTransactionSent: (hash, orderId) => {
|
|
1753
|
+
if (!hash && !orderId) return;
|
|
1675
1754
|
showTransactionStatusModal({
|
|
1676
1755
|
hash,
|
|
1756
|
+
orderId,
|
|
1677
1757
|
collectionAddress,
|
|
1678
1758
|
chainId,
|
|
1679
1759
|
price: createListingModal$.listingPrice.get(),
|
|
1680
1760
|
collectibleId,
|
|
1681
1761
|
type: "LISTING" /* LISTING */,
|
|
1682
|
-
queriesToInvalidate: collectableKeys.all
|
|
1762
|
+
queriesToInvalidate: collectableKeys.all,
|
|
1763
|
+
callbacks
|
|
1683
1764
|
});
|
|
1684
1765
|
createListingModal$.close();
|
|
1685
|
-
},
|
|
1686
|
-
onError: (error) => {
|
|
1687
|
-
if (typeof createListingModal$.callbacks?.onError === "function") {
|
|
1688
|
-
createListingModal$.onError(error);
|
|
1689
|
-
} else {
|
|
1690
|
-
console.debug("onError callback not provided:", error);
|
|
1691
|
-
}
|
|
1692
1766
|
}
|
|
1693
1767
|
});
|
|
1768
|
+
useEffect6(() => {
|
|
1769
|
+
if (!currencyAddress) return;
|
|
1770
|
+
refreshSteps();
|
|
1771
|
+
}, [currencyAddress]);
|
|
1694
1772
|
const handleStepExecution = async (execute) => {
|
|
1695
1773
|
if (!execute) return;
|
|
1696
1774
|
try {
|
|
1697
1775
|
await refreshSteps();
|
|
1698
1776
|
await execute();
|
|
1699
1777
|
} catch (error) {
|
|
1700
|
-
|
|
1778
|
+
if (callbacks?.onError) {
|
|
1779
|
+
callbacks.onError(error);
|
|
1780
|
+
} else {
|
|
1781
|
+
console.debug("onError callback not provided:", error);
|
|
1782
|
+
}
|
|
1701
1783
|
}
|
|
1702
1784
|
};
|
|
1703
1785
|
if (collectableIsLoading || collectionIsLoading || machineLoading) {
|
|
1704
|
-
return /* @__PURE__ */
|
|
1786
|
+
return /* @__PURE__ */ jsx19(
|
|
1705
1787
|
LoadingModal,
|
|
1706
1788
|
{
|
|
1707
|
-
|
|
1789
|
+
isOpen: createListingModal$.isOpen.get(),
|
|
1790
|
+
chainId: Number(chainId),
|
|
1708
1791
|
onClose: createListingModal$.close,
|
|
1709
1792
|
title: "List item for sale"
|
|
1710
1793
|
}
|
|
1711
1794
|
);
|
|
1712
1795
|
}
|
|
1713
1796
|
if (collectableIsError || collectionIsError) {
|
|
1714
|
-
return /* @__PURE__ */
|
|
1797
|
+
return /* @__PURE__ */ jsx19(
|
|
1715
1798
|
ErrorModal,
|
|
1716
1799
|
{
|
|
1717
|
-
|
|
1800
|
+
isOpen: createListingModal$.isOpen.get(),
|
|
1801
|
+
chainId: Number(chainId),
|
|
1718
1802
|
onClose: createListingModal$.close,
|
|
1719
1803
|
title: "List item for sale"
|
|
1720
1804
|
}
|
|
@@ -1722,7 +1806,7 @@ var Modal2 = observer8(
|
|
|
1722
1806
|
}
|
|
1723
1807
|
const dateToUnixTime = (date) => Math.floor(date.getTime() / 1e3).toString();
|
|
1724
1808
|
const { isLoading, steps, refreshSteps } = getListingSteps({
|
|
1725
|
-
contractType: collection
|
|
1809
|
+
contractType: collection?.type,
|
|
1726
1810
|
listing: {
|
|
1727
1811
|
tokenId: collectibleId,
|
|
1728
1812
|
quantity: parseUnits3(
|
|
@@ -1734,31 +1818,45 @@ var Modal2 = observer8(
|
|
|
1734
1818
|
pricePerToken: listingPrice.amountRaw
|
|
1735
1819
|
}
|
|
1736
1820
|
});
|
|
1821
|
+
const approvalNeeded = steps?.approval.isPending;
|
|
1737
1822
|
const ctas = [
|
|
1738
1823
|
{
|
|
1739
1824
|
label: "Approve TOKEN",
|
|
1740
1825
|
onClick: () => handleStepExecution(() => steps?.approval.execute()),
|
|
1741
|
-
hidden: !
|
|
1742
|
-
pending: steps?.approval.isExecuting,
|
|
1826
|
+
hidden: !approvalNeeded || approvalExecutedSuccess,
|
|
1827
|
+
pending: steps?.approval.isExecuting || isLoading,
|
|
1743
1828
|
variant: "glass",
|
|
1744
|
-
disabled: createListingModal$.invalidQuantity.get()
|
|
1829
|
+
disabled: createListingModal$.invalidQuantity.get() || isLoading || !listingPriceChanged || listingPrice.amountRaw === "0" || steps?.transaction.isExecuting
|
|
1745
1830
|
},
|
|
1746
1831
|
{
|
|
1747
1832
|
label: "List item for sale",
|
|
1748
|
-
onClick: () =>
|
|
1833
|
+
onClick: () => createListing({
|
|
1834
|
+
contractType: collection?.type,
|
|
1835
|
+
listing: {
|
|
1836
|
+
tokenId: collectibleId,
|
|
1837
|
+
quantity: parseUnits3(
|
|
1838
|
+
createListingModal$.quantity.get(),
|
|
1839
|
+
collectible?.decimals || 0
|
|
1840
|
+
).toString(),
|
|
1841
|
+
expiry: dateToUnixTime(createListingModal$.expiry.get()),
|
|
1842
|
+
currencyAddress: listingPrice.currency.contractAddress,
|
|
1843
|
+
pricePerToken: listingPrice.amountRaw
|
|
1844
|
+
}
|
|
1845
|
+
}),
|
|
1749
1846
|
pending: steps?.transaction.isExecuting || isLoading,
|
|
1750
|
-
disabled:
|
|
1847
|
+
disabled: !approvalExecutedSuccess && approvalNeeded || listingPrice.amountRaw === "0" || isLoading || createListingModal$.invalidQuantity.get() || !listingPriceChanged
|
|
1751
1848
|
}
|
|
1752
1849
|
];
|
|
1753
|
-
return /* @__PURE__ */
|
|
1850
|
+
return /* @__PURE__ */ jsxs12(
|
|
1754
1851
|
ActionModal,
|
|
1755
1852
|
{
|
|
1756
|
-
|
|
1853
|
+
isOpen: createListingModal$.isOpen.get(),
|
|
1854
|
+
chainId: Number(chainId),
|
|
1757
1855
|
onClose: () => createListingModal$.close(),
|
|
1758
1856
|
title: "List item for sale",
|
|
1759
1857
|
ctas,
|
|
1760
1858
|
children: [
|
|
1761
|
-
/* @__PURE__ */
|
|
1859
|
+
/* @__PURE__ */ jsx19(
|
|
1762
1860
|
TokenPreview,
|
|
1763
1861
|
{
|
|
1764
1862
|
collectionName: collection?.name,
|
|
@@ -1767,16 +1865,17 @@ var Modal2 = observer8(
|
|
|
1767
1865
|
chainId
|
|
1768
1866
|
}
|
|
1769
1867
|
),
|
|
1770
|
-
/* @__PURE__ */
|
|
1771
|
-
/* @__PURE__ */
|
|
1868
|
+
/* @__PURE__ */ jsxs12(Box14, { display: "flex", flexDirection: "column", width: "full", gap: "1", children: [
|
|
1869
|
+
/* @__PURE__ */ jsx19(
|
|
1772
1870
|
priceInput_default,
|
|
1773
1871
|
{
|
|
1774
1872
|
chainId,
|
|
1775
1873
|
collectionAddress,
|
|
1776
|
-
$listingPrice: createListingModal$.listingPrice
|
|
1874
|
+
$listingPrice: createListingModal$.listingPrice,
|
|
1875
|
+
onPriceChange: () => createListingModal$.listingPriceChanged.set(true)
|
|
1777
1876
|
}
|
|
1778
1877
|
),
|
|
1779
|
-
|
|
1878
|
+
listingPrice.amountRaw !== "0" && listingPriceChanged && /* @__PURE__ */ jsx19(
|
|
1780
1879
|
FloorPriceText,
|
|
1781
1880
|
{
|
|
1782
1881
|
tokenId: collectibleId,
|
|
@@ -1786,7 +1885,7 @@ var Modal2 = observer8(
|
|
|
1786
1885
|
}
|
|
1787
1886
|
)
|
|
1788
1887
|
] }),
|
|
1789
|
-
collection?.type === "ERC1155" && balance && /* @__PURE__ */
|
|
1888
|
+
collection?.type === "ERC1155" && balance && /* @__PURE__ */ jsx19(
|
|
1790
1889
|
QuantityInput,
|
|
1791
1890
|
{
|
|
1792
1891
|
$quantity: createListingModal$.quantity,
|
|
@@ -1795,14 +1894,15 @@ var Modal2 = observer8(
|
|
|
1795
1894
|
maxQuantity: balance?.balance
|
|
1796
1895
|
}
|
|
1797
1896
|
),
|
|
1798
|
-
/* @__PURE__ */
|
|
1799
|
-
/* @__PURE__ */
|
|
1897
|
+
/* @__PURE__ */ jsx19(expirationDateSelect_default, { $date: createListingModal$.expiry }),
|
|
1898
|
+
/* @__PURE__ */ jsx19(
|
|
1800
1899
|
TransactionDetails,
|
|
1801
1900
|
{
|
|
1802
1901
|
collectibleId,
|
|
1803
1902
|
collectionAddress,
|
|
1804
1903
|
chainId,
|
|
1805
1904
|
price: createListingModal$.listingPrice.get(),
|
|
1905
|
+
showPlaceholderPrice: !listingPriceChanged,
|
|
1806
1906
|
currencyImageUrl: listingPrice.currency.imageUrl
|
|
1807
1907
|
}
|
|
1808
1908
|
)
|
|
@@ -1814,28 +1914,45 @@ var Modal2 = observer8(
|
|
|
1814
1914
|
|
|
1815
1915
|
// src/react/ui/modals/MakeOfferModal/index.tsx
|
|
1816
1916
|
import { Show as Show3, observer as observer9 } from "@legendapp/state/react";
|
|
1817
|
-
import { useEffect as
|
|
1917
|
+
import { useEffect as useEffect7, useState as useState9 } from "react";
|
|
1818
1918
|
import { parseUnits as parseUnits4 } from "viem";
|
|
1819
1919
|
|
|
1820
1920
|
// src/react/hooks/useMakeOffer.tsx
|
|
1821
|
-
import { useCallback as useCallback2, useState as
|
|
1921
|
+
import { useCallback as useCallback2, useState as useState8 } from "react";
|
|
1822
1922
|
var useMakeOffer = ({
|
|
1823
1923
|
onSuccess,
|
|
1824
1924
|
onError,
|
|
1825
1925
|
onTransactionSent,
|
|
1926
|
+
onApprovalSuccess,
|
|
1927
|
+
onSwitchChainRefused,
|
|
1928
|
+
enabled,
|
|
1826
1929
|
...config
|
|
1827
1930
|
}) => {
|
|
1828
|
-
const [isLoading, setIsLoading] =
|
|
1829
|
-
const [steps, setSteps] =
|
|
1830
|
-
const
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1931
|
+
const [isLoading, setIsLoading] = useState8(false);
|
|
1932
|
+
const [steps, setSteps] = useState8(null);
|
|
1933
|
+
const [executionState, setExecutionState] = useState8(null);
|
|
1934
|
+
const machineConfig = {
|
|
1935
|
+
...config,
|
|
1936
|
+
type: "OFFER" /* OFFER */
|
|
1937
|
+
};
|
|
1938
|
+
const { machine, isLoading: isMachineLoading } = useTransactionMachine({
|
|
1939
|
+
config: machineConfig,
|
|
1940
|
+
enabled,
|
|
1941
|
+
onSuccess: (hash) => {
|
|
1942
|
+
setExecutionState(null);
|
|
1943
|
+
onSuccess?.(hash);
|
|
1834
1944
|
},
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1945
|
+
onError: (error) => {
|
|
1946
|
+
setExecutionState(null);
|
|
1947
|
+
onError?.(error);
|
|
1948
|
+
},
|
|
1949
|
+
onTransactionSent,
|
|
1950
|
+
onApprovalSuccess: (hash) => {
|
|
1951
|
+
setExecutionState(null);
|
|
1952
|
+
onApprovalSuccess?.(hash);
|
|
1953
|
+
},
|
|
1954
|
+
onSwitchChainRefused
|
|
1955
|
+
});
|
|
1839
1956
|
const loadSteps = useCallback2(
|
|
1840
1957
|
async (props) => {
|
|
1841
1958
|
if (!machine) return;
|
|
@@ -1845,16 +1962,51 @@ var useMakeOffer = ({
|
|
|
1845
1962
|
setIsLoading(false);
|
|
1846
1963
|
return;
|
|
1847
1964
|
}
|
|
1848
|
-
setSteps(
|
|
1965
|
+
setSteps({
|
|
1966
|
+
...generatedSteps,
|
|
1967
|
+
approval: {
|
|
1968
|
+
...generatedSteps.approval,
|
|
1969
|
+
isExecuting: executionState === "approval"
|
|
1970
|
+
},
|
|
1971
|
+
transaction: {
|
|
1972
|
+
...generatedSteps.transaction,
|
|
1973
|
+
isExecuting: executionState === "offer"
|
|
1974
|
+
}
|
|
1975
|
+
});
|
|
1849
1976
|
setIsLoading(false);
|
|
1850
1977
|
},
|
|
1851
|
-
[machine,
|
|
1978
|
+
[machine, executionState]
|
|
1979
|
+
);
|
|
1980
|
+
const handleStepExecution = useCallback2(
|
|
1981
|
+
async (type, execute) => {
|
|
1982
|
+
if (!type) return;
|
|
1983
|
+
setExecutionState(type);
|
|
1984
|
+
try {
|
|
1985
|
+
await execute();
|
|
1986
|
+
} catch (error) {
|
|
1987
|
+
setExecutionState(null);
|
|
1988
|
+
throw error;
|
|
1989
|
+
}
|
|
1990
|
+
},
|
|
1991
|
+
[]
|
|
1852
1992
|
);
|
|
1853
1993
|
return {
|
|
1854
1994
|
makeOffer: (props) => machine?.start(props),
|
|
1855
1995
|
getMakeOfferSteps: (props) => ({
|
|
1856
1996
|
isLoading,
|
|
1857
|
-
steps
|
|
1997
|
+
steps: steps ? {
|
|
1998
|
+
...steps,
|
|
1999
|
+
approval: {
|
|
2000
|
+
...steps.approval,
|
|
2001
|
+
isExecuting: executionState === "approval",
|
|
2002
|
+
execute: () => handleStepExecution("approval", () => steps.approval.execute())
|
|
2003
|
+
},
|
|
2004
|
+
transaction: {
|
|
2005
|
+
...steps.transaction,
|
|
2006
|
+
isExecuting: executionState === "offer",
|
|
2007
|
+
execute: () => handleStepExecution("offer", () => steps.transaction.execute())
|
|
2008
|
+
}
|
|
2009
|
+
} : null,
|
|
1858
2010
|
refreshSteps: () => loadSteps(props)
|
|
1859
2011
|
}),
|
|
1860
2012
|
isLoading: isMachineLoading
|
|
@@ -1869,12 +2021,14 @@ var initialState4 = {
|
|
|
1869
2021
|
collectionAddress: "",
|
|
1870
2022
|
chainId: "",
|
|
1871
2023
|
collectibleId: "",
|
|
1872
|
-
orderbookKind: "
|
|
2024
|
+
orderbookKind: "reservoir" /* reservoir */,
|
|
1873
2025
|
callbacks: void 0,
|
|
1874
2026
|
offerPrice: {
|
|
1875
2027
|
amountRaw: "1",
|
|
1876
2028
|
currency: {}
|
|
1877
2029
|
},
|
|
2030
|
+
// to track if the user has changed the price, so we know if it's 1 default or user input
|
|
2031
|
+
offerPriceChanged: false,
|
|
1878
2032
|
quantity: "1",
|
|
1879
2033
|
invalidQuantity: false,
|
|
1880
2034
|
expiry: new Date(addDays3(/* @__PURE__ */ new Date(), 7).toJSON()),
|
|
@@ -1894,14 +2048,14 @@ var initialState4 = {
|
|
|
1894
2048
|
var makeOfferModal$ = observable5(initialState4);
|
|
1895
2049
|
|
|
1896
2050
|
// src/react/ui/modals/MakeOfferModal/index.tsx
|
|
1897
|
-
import { jsx as
|
|
2051
|
+
import { Fragment, jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1898
2052
|
var useMakeOfferModal = (defaultCallbacks) => ({
|
|
1899
2053
|
show: (args) => makeOfferModal$.open({ ...args, callbacks: defaultCallbacks }),
|
|
1900
2054
|
close: makeOfferModal$.close
|
|
1901
2055
|
});
|
|
1902
2056
|
var MakeOfferModal = () => {
|
|
1903
2057
|
const { show: showTransactionStatusModal } = useTransactionStatusModal();
|
|
1904
|
-
return /* @__PURE__ */
|
|
2058
|
+
return /* @__PURE__ */ jsx20(Show3, { if: makeOfferModal$.isOpen, children: /* @__PURE__ */ jsx20(ModalContent, { showTransactionStatusModal }) });
|
|
1905
2059
|
};
|
|
1906
2060
|
var ModalContent = observer9(
|
|
1907
2061
|
({
|
|
@@ -1912,10 +2066,14 @@ var ModalContent = observer9(
|
|
|
1912
2066
|
collectionAddress,
|
|
1913
2067
|
chainId,
|
|
1914
2068
|
offerPrice,
|
|
2069
|
+
offerPriceChanged,
|
|
2070
|
+
invalidQuantity,
|
|
1915
2071
|
collectibleId,
|
|
1916
|
-
orderbookKind
|
|
2072
|
+
orderbookKind,
|
|
2073
|
+
callbacks
|
|
1917
2074
|
} = state;
|
|
1918
|
-
const [insufficientBalance, setInsufficientBalance] =
|
|
2075
|
+
const [insufficientBalance, setInsufficientBalance] = useState9(false);
|
|
2076
|
+
const [approvalExecutedSuccess, setApprovalExecutedSuccess] = useState9(false);
|
|
1919
2077
|
const {
|
|
1920
2078
|
data: collectible,
|
|
1921
2079
|
isLoading: collectableIsLoading,
|
|
@@ -1942,38 +2100,29 @@ var ModalContent = observer9(
|
|
|
1942
2100
|
chainId,
|
|
1943
2101
|
collectionAddress,
|
|
1944
2102
|
orderbookKind,
|
|
1945
|
-
|
|
1946
|
-
|
|
2103
|
+
enabled: makeOfferModal$.isOpen.get(),
|
|
2104
|
+
onSwitchChainRefused: () => makeOfferModal$.close(),
|
|
2105
|
+
onApprovalSuccess: () => setApprovalExecutedSuccess(true),
|
|
2106
|
+
onTransactionSent: (hash, orderId) => {
|
|
2107
|
+
if (!hash && !orderId) return;
|
|
1947
2108
|
showTransactionStatusModal({
|
|
1948
2109
|
hash,
|
|
2110
|
+
orderId,
|
|
1949
2111
|
price: makeOfferModal$.offerPrice.get(),
|
|
1950
2112
|
collectionAddress,
|
|
1951
2113
|
chainId,
|
|
1952
2114
|
collectibleId,
|
|
1953
2115
|
type: "OFFER" /* OFFER */,
|
|
1954
|
-
queriesToInvalidate: collectableKeys.all
|
|
2116
|
+
queriesToInvalidate: collectableKeys.all,
|
|
2117
|
+
callbacks
|
|
1955
2118
|
});
|
|
1956
2119
|
makeOfferModal$.close();
|
|
1957
|
-
},
|
|
1958
|
-
onSuccess: (hash) => {
|
|
1959
|
-
if (typeof makeOfferModal$.callbacks?.onSuccess === "function") {
|
|
1960
|
-
makeOfferModal$.callbacks.onSuccess(hash);
|
|
1961
|
-
} else {
|
|
1962
|
-
console.debug("onSuccess callback not provided:", hash);
|
|
1963
|
-
}
|
|
1964
|
-
},
|
|
1965
|
-
onError: (error) => {
|
|
1966
|
-
if (typeof makeOfferModal$.callbacks?.onError === "function") {
|
|
1967
|
-
makeOfferModal$.callbacks.onError(error);
|
|
1968
|
-
} else {
|
|
1969
|
-
console.debug("onError callback not provided:", error);
|
|
1970
|
-
}
|
|
1971
2120
|
}
|
|
1972
2121
|
});
|
|
1973
2122
|
const dateToUnixTime = (date) => Math.floor(date.getTime() / 1e3).toString();
|
|
1974
2123
|
const currencyAddress = offerPrice.currency.contractAddress;
|
|
1975
2124
|
const { isLoading, steps, refreshSteps } = getMakeOfferSteps({
|
|
1976
|
-
contractType: collection
|
|
2125
|
+
contractType: collection?.type,
|
|
1977
2126
|
offer: {
|
|
1978
2127
|
tokenId: collectibleId,
|
|
1979
2128
|
quantity: parseUnits4(
|
|
@@ -1985,25 +2134,28 @@ var ModalContent = observer9(
|
|
|
1985
2134
|
pricePerToken: offerPrice.amountRaw
|
|
1986
2135
|
}
|
|
1987
2136
|
});
|
|
1988
|
-
|
|
2137
|
+
const approvalNeeded = steps?.approval.isPending;
|
|
2138
|
+
useEffect7(() => {
|
|
1989
2139
|
if (!currencyAddress) return;
|
|
1990
2140
|
refreshSteps();
|
|
1991
2141
|
}, [currencyAddress]);
|
|
1992
2142
|
if (collectableIsLoading || collectionIsLoading || currenciesIsLoading) {
|
|
1993
|
-
return /* @__PURE__ */
|
|
2143
|
+
return /* @__PURE__ */ jsx20(
|
|
1994
2144
|
LoadingModal,
|
|
1995
2145
|
{
|
|
1996
|
-
|
|
2146
|
+
isOpen: makeOfferModal$.isOpen.get(),
|
|
2147
|
+
chainId: Number(chainId),
|
|
1997
2148
|
onClose: makeOfferModal$.close,
|
|
1998
2149
|
title: "Make an offer"
|
|
1999
2150
|
}
|
|
2000
2151
|
);
|
|
2001
2152
|
}
|
|
2002
2153
|
if (collectableIsError || collectionIsError) {
|
|
2003
|
-
return /* @__PURE__ */
|
|
2154
|
+
return /* @__PURE__ */ jsx20(
|
|
2004
2155
|
ErrorModal,
|
|
2005
2156
|
{
|
|
2006
|
-
|
|
2157
|
+
isOpen: makeOfferModal$.isOpen.get(),
|
|
2158
|
+
chainId: Number(chainId),
|
|
2007
2159
|
onClose: makeOfferModal$.close,
|
|
2008
2160
|
title: "Make an offer"
|
|
2009
2161
|
}
|
|
@@ -2015,34 +2167,39 @@ var ModalContent = observer9(
|
|
|
2015
2167
|
await refreshSteps();
|
|
2016
2168
|
await execute();
|
|
2017
2169
|
} catch (error) {
|
|
2018
|
-
|
|
2170
|
+
if (callbacks?.onError) {
|
|
2171
|
+
callbacks.onError(error);
|
|
2172
|
+
} else {
|
|
2173
|
+
console.debug("onError callback not provided:", error);
|
|
2174
|
+
}
|
|
2019
2175
|
}
|
|
2020
2176
|
};
|
|
2021
2177
|
const ctas = [
|
|
2022
2178
|
{
|
|
2023
2179
|
label: "Approve TOKEN",
|
|
2024
2180
|
onClick: () => handleStepExecution(() => steps?.approval.execute()),
|
|
2025
|
-
hidden: !
|
|
2026
|
-
pending: steps?.approval.isExecuting,
|
|
2181
|
+
hidden: !approvalNeeded || approvalExecutedSuccess,
|
|
2182
|
+
pending: steps?.approval.isExecuting || isLoading,
|
|
2027
2183
|
variant: "glass",
|
|
2028
|
-
disabled:
|
|
2184
|
+
disabled: invalidQuantity || isLoading || steps?.transaction.isExecuting || insufficientBalance || offerPrice.amountRaw === "0" || !offerPriceChanged
|
|
2029
2185
|
},
|
|
2030
2186
|
{
|
|
2031
2187
|
label: "Make offer",
|
|
2032
2188
|
onClick: () => handleStepExecution(() => steps?.transaction.execute()),
|
|
2033
2189
|
pending: steps?.transaction.isExecuting || isLoading,
|
|
2034
|
-
disabled:
|
|
2190
|
+
disabled: !approvalExecutedSuccess && approvalNeeded || offerPrice.amountRaw === "0" || insufficientBalance || isLoading || invalidQuantity || offerPrice.amountRaw === "0"
|
|
2035
2191
|
}
|
|
2036
2192
|
];
|
|
2037
|
-
return /* @__PURE__ */
|
|
2193
|
+
return /* @__PURE__ */ jsx20(Fragment, { children: /* @__PURE__ */ jsxs13(
|
|
2038
2194
|
ActionModal,
|
|
2039
2195
|
{
|
|
2040
|
-
|
|
2196
|
+
isOpen: makeOfferModal$.isOpen.get(),
|
|
2197
|
+
chainId: Number(chainId),
|
|
2041
2198
|
onClose: () => makeOfferModal$.close(),
|
|
2042
2199
|
title: "Make an offer",
|
|
2043
2200
|
ctas,
|
|
2044
2201
|
children: [
|
|
2045
|
-
/* @__PURE__ */
|
|
2202
|
+
/* @__PURE__ */ jsx20(
|
|
2046
2203
|
TokenPreview,
|
|
2047
2204
|
{
|
|
2048
2205
|
collectionName: collection?.name,
|
|
@@ -2051,19 +2208,20 @@ var ModalContent = observer9(
|
|
|
2051
2208
|
chainId
|
|
2052
2209
|
}
|
|
2053
2210
|
),
|
|
2054
|
-
/* @__PURE__ */
|
|
2211
|
+
/* @__PURE__ */ jsx20(
|
|
2055
2212
|
priceInput_default,
|
|
2056
2213
|
{
|
|
2057
2214
|
chainId,
|
|
2058
2215
|
collectionAddress,
|
|
2059
2216
|
$listingPrice: makeOfferModal$.offerPrice,
|
|
2217
|
+
onPriceChange: () => makeOfferModal$.offerPriceChanged.set(true),
|
|
2060
2218
|
checkBalance: {
|
|
2061
2219
|
enabled: true,
|
|
2062
2220
|
callback: (state2) => setInsufficientBalance(state2)
|
|
2063
2221
|
}
|
|
2064
2222
|
}
|
|
2065
2223
|
),
|
|
2066
|
-
collection?.type === "ERC1155" /* ERC1155 */ && /* @__PURE__ */
|
|
2224
|
+
collection?.type === "ERC1155" /* ERC1155 */ && /* @__PURE__ */ jsx20(
|
|
2067
2225
|
QuantityInput,
|
|
2068
2226
|
{
|
|
2069
2227
|
$quantity: makeOfferModal$.quantity,
|
|
@@ -2072,7 +2230,7 @@ var ModalContent = observer9(
|
|
|
2072
2230
|
maxQuantity: String(Number.MAX_SAFE_INTEGER)
|
|
2073
2231
|
}
|
|
2074
2232
|
),
|
|
2075
|
-
|
|
2233
|
+
offerPrice.amountRaw !== "0" && offerPriceChanged && !insufficientBalance && /* @__PURE__ */ jsx20(
|
|
2076
2234
|
FloorPriceText,
|
|
2077
2235
|
{
|
|
2078
2236
|
tokenId: collectibleId,
|
|
@@ -2081,10 +2239,10 @@ var ModalContent = observer9(
|
|
|
2081
2239
|
price: offerPrice
|
|
2082
2240
|
}
|
|
2083
2241
|
),
|
|
2084
|
-
/* @__PURE__ */
|
|
2242
|
+
/* @__PURE__ */ jsx20(expirationDateSelect_default, { $date: makeOfferModal$.expiry })
|
|
2085
2243
|
]
|
|
2086
2244
|
}
|
|
2087
|
-
);
|
|
2245
|
+
) });
|
|
2088
2246
|
}
|
|
2089
2247
|
);
|
|
2090
2248
|
|
|
@@ -2093,24 +2251,41 @@ import { Show as Show4, observer as observer10 } from "@legendapp/state/react";
|
|
|
2093
2251
|
import { parseUnits as parseUnits5 } from "viem";
|
|
2094
2252
|
|
|
2095
2253
|
// src/react/hooks/useSell.tsx
|
|
2096
|
-
import { useCallback as useCallback3, useState as
|
|
2254
|
+
import { useCallback as useCallback3, useState as useState10 } from "react";
|
|
2097
2255
|
var useSell = ({
|
|
2098
2256
|
onSuccess,
|
|
2099
2257
|
onError,
|
|
2100
2258
|
onTransactionSent,
|
|
2259
|
+
onApprovalSuccess,
|
|
2260
|
+
onSwitchChainRefused,
|
|
2261
|
+
enabled,
|
|
2101
2262
|
...config
|
|
2102
2263
|
}) => {
|
|
2103
|
-
const [isLoading, setIsLoading] =
|
|
2104
|
-
const [steps, setSteps] =
|
|
2105
|
-
const
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2264
|
+
const [isLoading, setIsLoading] = useState10(false);
|
|
2265
|
+
const [steps, setSteps] = useState10(null);
|
|
2266
|
+
const [executionState, setExecutionState] = useState10(null);
|
|
2267
|
+
const machineConfig = {
|
|
2268
|
+
...config,
|
|
2269
|
+
type: "SELL" /* SELL */
|
|
2270
|
+
};
|
|
2271
|
+
const { machine, isLoading: isMachineLoading } = useTransactionMachine({
|
|
2272
|
+
config: machineConfig,
|
|
2273
|
+
enabled,
|
|
2274
|
+
onSwitchChainRefused,
|
|
2275
|
+
onSuccess: (hash) => {
|
|
2276
|
+
setExecutionState(null);
|
|
2277
|
+
onSuccess?.(hash);
|
|
2109
2278
|
},
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2279
|
+
onError: (error) => {
|
|
2280
|
+
setExecutionState(null);
|
|
2281
|
+
onError?.(error);
|
|
2282
|
+
},
|
|
2283
|
+
onTransactionSent,
|
|
2284
|
+
onApprovalSuccess: (hash) => {
|
|
2285
|
+
setExecutionState(null);
|
|
2286
|
+
onApprovalSuccess?.(hash);
|
|
2287
|
+
}
|
|
2288
|
+
});
|
|
2114
2289
|
const loadSteps = useCallback3(
|
|
2115
2290
|
async (props) => {
|
|
2116
2291
|
if (!machine) return;
|
|
@@ -2120,16 +2295,51 @@ var useSell = ({
|
|
|
2120
2295
|
setIsLoading(false);
|
|
2121
2296
|
return;
|
|
2122
2297
|
}
|
|
2123
|
-
setSteps(
|
|
2298
|
+
setSteps({
|
|
2299
|
+
...generatedSteps,
|
|
2300
|
+
approval: {
|
|
2301
|
+
...generatedSteps.approval,
|
|
2302
|
+
isExecuting: executionState === "approval"
|
|
2303
|
+
},
|
|
2304
|
+
transaction: {
|
|
2305
|
+
...generatedSteps.transaction,
|
|
2306
|
+
isExecuting: executionState === "sell"
|
|
2307
|
+
}
|
|
2308
|
+
});
|
|
2124
2309
|
setIsLoading(false);
|
|
2125
2310
|
},
|
|
2126
|
-
[machine,
|
|
2311
|
+
[machine, executionState]
|
|
2312
|
+
);
|
|
2313
|
+
const handleStepExecution = useCallback3(
|
|
2314
|
+
async (type, execute) => {
|
|
2315
|
+
if (!type) return;
|
|
2316
|
+
setExecutionState(type);
|
|
2317
|
+
try {
|
|
2318
|
+
await execute();
|
|
2319
|
+
} catch (error) {
|
|
2320
|
+
setExecutionState(null);
|
|
2321
|
+
throw error;
|
|
2322
|
+
}
|
|
2323
|
+
},
|
|
2324
|
+
[]
|
|
2127
2325
|
);
|
|
2128
2326
|
return {
|
|
2129
2327
|
sell: (props) => machine?.start(props),
|
|
2130
2328
|
getSellSteps: (props) => ({
|
|
2131
2329
|
isLoading,
|
|
2132
|
-
steps
|
|
2330
|
+
steps: steps ? {
|
|
2331
|
+
...steps,
|
|
2332
|
+
approval: {
|
|
2333
|
+
...steps.approval,
|
|
2334
|
+
isExecuting: executionState === "approval",
|
|
2335
|
+
execute: () => handleStepExecution("approval", () => steps.approval.execute())
|
|
2336
|
+
},
|
|
2337
|
+
transaction: {
|
|
2338
|
+
...steps.transaction,
|
|
2339
|
+
isExecuting: executionState === "sell",
|
|
2340
|
+
execute: () => handleStepExecution("sell", () => steps.transaction.execute())
|
|
2341
|
+
}
|
|
2342
|
+
} : null,
|
|
2133
2343
|
refreshSteps: () => loadSteps(props)
|
|
2134
2344
|
}),
|
|
2135
2345
|
isLoading: isMachineLoading
|
|
@@ -2137,17 +2347,17 @@ var useSell = ({
|
|
|
2137
2347
|
};
|
|
2138
2348
|
|
|
2139
2349
|
// src/react/ui/modals/_internal/components/transactionHeader/index.tsx
|
|
2140
|
-
import { Box as Box15, Image as Image4, Skeleton as Skeleton7, Text as
|
|
2350
|
+
import { Box as Box15, Image as Image4, Skeleton as Skeleton7, Text as Text12 } from "@0xsequence/design-system";
|
|
2141
2351
|
import { formatDistanceToNow as formatDistanceToNow2 } from "date-fns";
|
|
2142
|
-
import { jsx as
|
|
2352
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2143
2353
|
function TransactionHeader({
|
|
2144
2354
|
title,
|
|
2145
2355
|
currencyImageUrl,
|
|
2146
2356
|
date
|
|
2147
2357
|
}) {
|
|
2148
|
-
return /* @__PURE__ */
|
|
2149
|
-
/* @__PURE__ */
|
|
2150
|
-
|
|
2358
|
+
return /* @__PURE__ */ jsxs14(Box15, { display: "flex", alignItems: "center", width: "full", children: [
|
|
2359
|
+
/* @__PURE__ */ jsx21(
|
|
2360
|
+
Text12,
|
|
2151
2361
|
{
|
|
2152
2362
|
fontSize: "small",
|
|
2153
2363
|
fontWeight: "medium",
|
|
@@ -2157,9 +2367,9 @@ function TransactionHeader({
|
|
|
2157
2367
|
children: title
|
|
2158
2368
|
}
|
|
2159
2369
|
),
|
|
2160
|
-
/* @__PURE__ */
|
|
2161
|
-
date && /* @__PURE__ */
|
|
2162
|
-
|
|
2370
|
+
/* @__PURE__ */ jsx21(Image4, { src: currencyImageUrl, width: "3", height: "3", marginRight: "1" }),
|
|
2371
|
+
date && /* @__PURE__ */ jsxs14(
|
|
2372
|
+
Text12,
|
|
2163
2373
|
{
|
|
2164
2374
|
fontSize: "small",
|
|
2165
2375
|
color: "text50",
|
|
@@ -2171,7 +2381,7 @@ function TransactionHeader({
|
|
|
2171
2381
|
" ago"
|
|
2172
2382
|
]
|
|
2173
2383
|
}
|
|
2174
|
-
) || /* @__PURE__ */
|
|
2384
|
+
) || /* @__PURE__ */ jsx21(Skeleton7, { width: "8", height: "4" })
|
|
2175
2385
|
] });
|
|
2176
2386
|
}
|
|
2177
2387
|
|
|
@@ -2200,37 +2410,69 @@ var initialState5 = {
|
|
|
2200
2410
|
var sellModal$ = observable6(initialState5);
|
|
2201
2411
|
|
|
2202
2412
|
// src/react/ui/modals/SellModal/index.tsx
|
|
2203
|
-
import {
|
|
2413
|
+
import { useEffect as useEffect8, useState as useState11 } from "react";
|
|
2414
|
+
import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2204
2415
|
var useSellModal = (defaultCallbacks) => ({
|
|
2205
2416
|
show: (args) => sellModal$.open({ ...args, callbacks: defaultCallbacks }),
|
|
2206
2417
|
close: sellModal$.close
|
|
2207
2418
|
});
|
|
2208
2419
|
var SellModal = () => {
|
|
2209
2420
|
const { show: showTransactionStatusModal } = useTransactionStatusModal();
|
|
2210
|
-
return /* @__PURE__ */
|
|
2421
|
+
return /* @__PURE__ */ jsx22(Show4, { if: sellModal$.isOpen, children: /* @__PURE__ */ jsx22(ModalContent2, { showTransactionStatusModal }) });
|
|
2211
2422
|
};
|
|
2212
2423
|
var ModalContent2 = observer10(
|
|
2213
2424
|
({
|
|
2214
2425
|
showTransactionStatusModal
|
|
2215
2426
|
}) => {
|
|
2216
|
-
const { tokenId, collectionAddress, chainId, order } = sellModal$.get();
|
|
2427
|
+
const { tokenId, collectionAddress, chainId, order, callbacks } = sellModal$.get();
|
|
2217
2428
|
const { data: collectible } = useCollection({
|
|
2218
2429
|
chainId,
|
|
2219
2430
|
collectionAddress
|
|
2220
2431
|
});
|
|
2221
|
-
const
|
|
2432
|
+
const [approvalExecutedSuccess, setApprovalExecutedSuccess] = useState11(false);
|
|
2433
|
+
const {
|
|
2434
|
+
data: collection,
|
|
2435
|
+
isLoading: collectionLoading,
|
|
2436
|
+
isError: collectionError
|
|
2437
|
+
} = useCollection({
|
|
2438
|
+
chainId,
|
|
2439
|
+
collectionAddress
|
|
2440
|
+
});
|
|
2441
|
+
const currencyOptions = useCurrencyOptions({ collectionAddress });
|
|
2442
|
+
const { data: currencies, isLoading: currenciesLoading } = useCurrencies({
|
|
2443
|
+
chainId,
|
|
2444
|
+
currencyOptions
|
|
2445
|
+
});
|
|
2446
|
+
const { getSellSteps, isLoading: machineLoading } = useSell({
|
|
2222
2447
|
collectionAddress,
|
|
2223
2448
|
chainId,
|
|
2449
|
+
enabled: sellModal$.isOpen.get(),
|
|
2450
|
+
onSwitchChainRefused: () => {
|
|
2451
|
+
sellModal$.close();
|
|
2452
|
+
},
|
|
2453
|
+
onApprovalSuccess: () => setApprovalExecutedSuccess(true),
|
|
2224
2454
|
onTransactionSent: (hash) => {
|
|
2225
2455
|
if (!hash) return;
|
|
2226
2456
|
showTransactionStatusModal({
|
|
2227
2457
|
hash,
|
|
2228
|
-
price: {
|
|
2458
|
+
price: order ? {
|
|
2229
2459
|
amountRaw: order.priceAmount,
|
|
2230
|
-
currency: currencies
|
|
2460
|
+
currency: currencies?.find(
|
|
2231
2461
|
(currency2) => currency2.contractAddress === order.priceCurrencyAddress
|
|
2232
|
-
)
|
|
2233
|
-
|
|
2462
|
+
) ?? {
|
|
2463
|
+
chainId: Number(chainId),
|
|
2464
|
+
contractAddress: order.priceCurrencyAddress,
|
|
2465
|
+
name: "Unknown",
|
|
2466
|
+
symbol: "UNK",
|
|
2467
|
+
decimals: 18,
|
|
2468
|
+
imageUrl: "",
|
|
2469
|
+
exchangeRate: 0,
|
|
2470
|
+
defaultChainCurrency: false,
|
|
2471
|
+
nativeCurrency: false,
|
|
2472
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2473
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2474
|
+
}
|
|
2475
|
+
} : void 0,
|
|
2234
2476
|
collectionAddress,
|
|
2235
2477
|
chainId,
|
|
2236
2478
|
collectibleId: tokenId,
|
|
@@ -2238,82 +2480,88 @@ var ModalContent2 = observer10(
|
|
|
2238
2480
|
queriesToInvalidate: [
|
|
2239
2481
|
...collectableKeys.all,
|
|
2240
2482
|
balanceQueries.all
|
|
2241
|
-
]
|
|
2483
|
+
],
|
|
2484
|
+
callbacks
|
|
2242
2485
|
});
|
|
2243
2486
|
sellModal$.close();
|
|
2244
|
-
}
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2487
|
+
}
|
|
2488
|
+
});
|
|
2489
|
+
const { isLoading, steps, refreshSteps } = getSellSteps({
|
|
2490
|
+
orderId: order?.orderId ?? "",
|
|
2491
|
+
marketplace: order?.marketplace,
|
|
2492
|
+
quantity: order?.quantityRemaining ? parseUnits5(
|
|
2493
|
+
order.quantityRemaining,
|
|
2494
|
+
collectible?.decimals || 0
|
|
2495
|
+
).toString() : "1"
|
|
2496
|
+
});
|
|
2497
|
+
useEffect8(() => {
|
|
2498
|
+
refreshSteps();
|
|
2499
|
+
}, [order, machineLoading]);
|
|
2500
|
+
const handleStepExecution = async (execute) => {
|
|
2501
|
+
if (!execute) return;
|
|
2502
|
+
try {
|
|
2503
|
+
await refreshSteps();
|
|
2504
|
+
await execute();
|
|
2505
|
+
} catch (error) {
|
|
2506
|
+
if (callbacks?.onError) {
|
|
2507
|
+
callbacks.onError(error);
|
|
2255
2508
|
} else {
|
|
2256
2509
|
console.debug("onError callback not provided:", error);
|
|
2257
2510
|
}
|
|
2258
2511
|
}
|
|
2259
|
-
}
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
isLoading: collectionLoading,
|
|
2263
|
-
isError: collectionError
|
|
2264
|
-
} = useCollection({
|
|
2265
|
-
chainId,
|
|
2266
|
-
collectionAddress
|
|
2267
|
-
});
|
|
2268
|
-
const currencyOptions = useCurrencyOptions({ collectionAddress });
|
|
2269
|
-
const { data: currencies, isLoading: currenciesLoading } = useCurrencies({
|
|
2270
|
-
chainId,
|
|
2271
|
-
currencyOptions
|
|
2272
|
-
});
|
|
2273
|
-
if (collectionLoading || currenciesLoading) {
|
|
2274
|
-
return /* @__PURE__ */ jsx23(
|
|
2512
|
+
};
|
|
2513
|
+
if (collectionLoading || currenciesLoading || machineLoading) {
|
|
2514
|
+
return /* @__PURE__ */ jsx22(
|
|
2275
2515
|
LoadingModal,
|
|
2276
2516
|
{
|
|
2277
|
-
|
|
2517
|
+
isOpen: sellModal$.isOpen.get(),
|
|
2518
|
+
chainId: Number(chainId),
|
|
2278
2519
|
onClose: sellModal$.close,
|
|
2279
2520
|
title: "You have an offer"
|
|
2280
2521
|
}
|
|
2281
2522
|
);
|
|
2282
2523
|
}
|
|
2283
2524
|
if (collectionError || order === void 0) {
|
|
2284
|
-
return /* @__PURE__ */
|
|
2525
|
+
return /* @__PURE__ */ jsx22(
|
|
2285
2526
|
ErrorModal,
|
|
2286
2527
|
{
|
|
2287
|
-
|
|
2528
|
+
isOpen: sellModal$.isOpen.get(),
|
|
2529
|
+
chainId: Number(chainId),
|
|
2288
2530
|
onClose: sellModal$.close,
|
|
2289
2531
|
title: "You have an offer"
|
|
2290
2532
|
}
|
|
2291
2533
|
);
|
|
2292
2534
|
}
|
|
2535
|
+
const approvalNeeded = steps?.approval.isPending;
|
|
2293
2536
|
const currency = currencies?.find(
|
|
2294
2537
|
(c) => c.contractAddress === order?.priceCurrencyAddress
|
|
2295
2538
|
);
|
|
2296
|
-
|
|
2539
|
+
const ctas = [
|
|
2540
|
+
{
|
|
2541
|
+
label: "Approve TOKEN",
|
|
2542
|
+
onClick: () => handleStepExecution(() => steps?.approval.execute()),
|
|
2543
|
+
hidden: !approvalNeeded || approvalExecutedSuccess,
|
|
2544
|
+
pending: steps?.approval.isExecuting || isLoading,
|
|
2545
|
+
variant: "glass",
|
|
2546
|
+
disabled: isLoading || steps?.transaction.isExecuting
|
|
2547
|
+
},
|
|
2548
|
+
{
|
|
2549
|
+
label: "Accept",
|
|
2550
|
+
onClick: () => handleStepExecution(() => steps?.transaction.execute()),
|
|
2551
|
+
pending: steps?.transaction.isExecuting || isLoading,
|
|
2552
|
+
disabled: !approvalExecutedSuccess && approvalNeeded || isLoading
|
|
2553
|
+
}
|
|
2554
|
+
];
|
|
2555
|
+
return /* @__PURE__ */ jsxs15(
|
|
2297
2556
|
ActionModal,
|
|
2298
2557
|
{
|
|
2299
|
-
|
|
2558
|
+
isOpen: sellModal$.isOpen.get(),
|
|
2559
|
+
chainId: Number(chainId),
|
|
2300
2560
|
onClose: sellModal$.close,
|
|
2301
2561
|
title: "You have an offer",
|
|
2302
|
-
ctas
|
|
2303
|
-
{
|
|
2304
|
-
label: "Accept",
|
|
2305
|
-
onClick: () => sell({
|
|
2306
|
-
orderId: order?.orderId,
|
|
2307
|
-
marketplace: order?.marketplace,
|
|
2308
|
-
quantity: order?.quantityRemaining ? parseUnits5(
|
|
2309
|
-
order.quantityRemaining,
|
|
2310
|
-
collectible?.decimals || 0
|
|
2311
|
-
).toString() : "1"
|
|
2312
|
-
})
|
|
2313
|
-
}
|
|
2314
|
-
],
|
|
2562
|
+
ctas,
|
|
2315
2563
|
children: [
|
|
2316
|
-
/* @__PURE__ */
|
|
2564
|
+
/* @__PURE__ */ jsx22(
|
|
2317
2565
|
TransactionHeader,
|
|
2318
2566
|
{
|
|
2319
2567
|
title: "Offer received",
|
|
@@ -2321,7 +2569,7 @@ var ModalContent2 = observer10(
|
|
|
2321
2569
|
date: order && new Date(order.createdAt)
|
|
2322
2570
|
}
|
|
2323
2571
|
),
|
|
2324
|
-
/* @__PURE__ */
|
|
2572
|
+
/* @__PURE__ */ jsx22(
|
|
2325
2573
|
TokenPreview,
|
|
2326
2574
|
{
|
|
2327
2575
|
collectionName: collection?.name,
|
|
@@ -2330,7 +2578,7 @@ var ModalContent2 = observer10(
|
|
|
2330
2578
|
chainId
|
|
2331
2579
|
}
|
|
2332
2580
|
),
|
|
2333
|
-
/* @__PURE__ */
|
|
2581
|
+
/* @__PURE__ */ jsx22(
|
|
2334
2582
|
TransactionDetails,
|
|
2335
2583
|
{
|
|
2336
2584
|
collectibleId: tokenId,
|
|
@@ -2357,10 +2605,10 @@ import {
|
|
|
2357
2605
|
ExternalLinkIcon,
|
|
2358
2606
|
IconButton as IconButton3,
|
|
2359
2607
|
Image as Image5,
|
|
2360
|
-
Text as
|
|
2608
|
+
Text as Text13
|
|
2361
2609
|
} from "@0xsequence/design-system";
|
|
2362
2610
|
import { observer as observer11 } from "@legendapp/state/react";
|
|
2363
|
-
import { Close as Close2, Content as
|
|
2611
|
+
import { Close as Close2, Content as Content3, Overlay as Overlay2, Portal as Portal3, Root as Root3 } from "@radix-ui/react-dialog";
|
|
2364
2612
|
|
|
2365
2613
|
// src/react/ui/modals/SuccessfulPurchaseModal/_store.ts
|
|
2366
2614
|
import { observable as observable7 } from "@legendapp/state";
|
|
@@ -2405,7 +2653,7 @@ var initialState6 = {
|
|
|
2405
2653
|
var successfulPurchaseModal$ = observable7(initialState6);
|
|
2406
2654
|
|
|
2407
2655
|
// src/react/ui/modals/SuccessfulPurchaseModal/index.tsx
|
|
2408
|
-
import { jsx as
|
|
2656
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2409
2657
|
var useSuccessfulPurchaseModal = (callbacks) => {
|
|
2410
2658
|
return {
|
|
2411
2659
|
show: (args) => successfulPurchaseModal$.open({ ...args, defaultCallbacks: callbacks }),
|
|
@@ -2413,12 +2661,12 @@ var useSuccessfulPurchaseModal = (callbacks) => {
|
|
|
2413
2661
|
};
|
|
2414
2662
|
};
|
|
2415
2663
|
var SuccessfulPurchaseModal = observer11(() => {
|
|
2416
|
-
return /* @__PURE__ */
|
|
2417
|
-
/* @__PURE__ */
|
|
2418
|
-
/* @__PURE__ */
|
|
2419
|
-
/* @__PURE__ */
|
|
2420
|
-
/* @__PURE__ */
|
|
2421
|
-
|
|
2664
|
+
return /* @__PURE__ */ jsx23(Root3, { open: successfulPurchaseModal$.isOpen.get(), children: /* @__PURE__ */ jsxs16(Portal3, { children: [
|
|
2665
|
+
/* @__PURE__ */ jsx23(Overlay2, { className: dialogOverlay }),
|
|
2666
|
+
/* @__PURE__ */ jsxs16(Content3, { className: dialogContent.narrow, children: [
|
|
2667
|
+
/* @__PURE__ */ jsxs16(Box16, { display: "flex", flexDirection: "column", gap: "4", width: "full", children: [
|
|
2668
|
+
/* @__PURE__ */ jsx23(
|
|
2669
|
+
Text13,
|
|
2422
2670
|
{
|
|
2423
2671
|
textAlign: "center",
|
|
2424
2672
|
fontSize: "medium",
|
|
@@ -2427,21 +2675,21 @@ var SuccessfulPurchaseModal = observer11(() => {
|
|
|
2427
2675
|
children: "Successful purchase!"
|
|
2428
2676
|
}
|
|
2429
2677
|
),
|
|
2430
|
-
/* @__PURE__ */
|
|
2678
|
+
/* @__PURE__ */ jsx23(
|
|
2431
2679
|
CollectiblesGrid,
|
|
2432
2680
|
{
|
|
2433
2681
|
collectibles: successfulPurchaseModal$.state.get().collectibles
|
|
2434
2682
|
}
|
|
2435
2683
|
),
|
|
2436
|
-
/* @__PURE__ */
|
|
2437
|
-
/* @__PURE__ */
|
|
2438
|
-
/* @__PURE__ */
|
|
2439
|
-
/* @__PURE__ */
|
|
2440
|
-
/* @__PURE__ */
|
|
2684
|
+
/* @__PURE__ */ jsxs16(Box16, { display: "flex", alignItems: "center", gap: "1", children: [
|
|
2685
|
+
/* @__PURE__ */ jsx23(Text13, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "You bought" }),
|
|
2686
|
+
/* @__PURE__ */ jsx23(Text13, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().collectibles.length }),
|
|
2687
|
+
/* @__PURE__ */ jsx23(Text13, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "items for" }),
|
|
2688
|
+
/* @__PURE__ */ jsx23(Text13, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().totalPrice })
|
|
2441
2689
|
] }),
|
|
2442
|
-
/* @__PURE__ */
|
|
2690
|
+
/* @__PURE__ */ jsx23(SuccessfulPurchaseActions, {})
|
|
2443
2691
|
] }),
|
|
2444
|
-
/* @__PURE__ */
|
|
2692
|
+
/* @__PURE__ */ jsx23(
|
|
2445
2693
|
Close2,
|
|
2446
2694
|
{
|
|
2447
2695
|
onClick: () => {
|
|
@@ -2449,15 +2697,15 @@ var SuccessfulPurchaseModal = observer11(() => {
|
|
|
2449
2697
|
},
|
|
2450
2698
|
className: closeButton,
|
|
2451
2699
|
asChild: true,
|
|
2452
|
-
children: /* @__PURE__ */
|
|
2700
|
+
children: /* @__PURE__ */ jsx23(IconButton3, { size: "xs", "aria-label": "Close modal", icon: CloseIcon2 })
|
|
2453
2701
|
}
|
|
2454
2702
|
)
|
|
2455
2703
|
] })
|
|
2456
2704
|
] }) });
|
|
2457
2705
|
});
|
|
2458
2706
|
function SuccessfulPurchaseActions() {
|
|
2459
|
-
return /* @__PURE__ */
|
|
2460
|
-
successfulPurchaseModal$.state.ctaOptions.get() && /* @__PURE__ */
|
|
2707
|
+
return /* @__PURE__ */ jsxs16(Box16, { display: "flex", flexDirection: "column", gap: "2", children: [
|
|
2708
|
+
successfulPurchaseModal$.state.ctaOptions.get() && /* @__PURE__ */ jsx23(
|
|
2461
2709
|
Button3,
|
|
2462
2710
|
{
|
|
2463
2711
|
shape: "square",
|
|
@@ -2467,7 +2715,7 @@ function SuccessfulPurchaseActions() {
|
|
|
2467
2715
|
onClick: successfulPurchaseModal$.state.ctaOptions.ctaOnClick.get() || void 0
|
|
2468
2716
|
}
|
|
2469
2717
|
),
|
|
2470
|
-
/* @__PURE__ */
|
|
2718
|
+
/* @__PURE__ */ jsx23(
|
|
2471
2719
|
Button3,
|
|
2472
2720
|
{
|
|
2473
2721
|
as: "a",
|
|
@@ -2485,15 +2733,15 @@ function SuccessfulPurchaseActions() {
|
|
|
2485
2733
|
function CollectiblesGrid({ collectibles }) {
|
|
2486
2734
|
const total = collectibles.length;
|
|
2487
2735
|
const shownCollectibles = total > 4 ? collectibles.slice(0, 4) : collectibles;
|
|
2488
|
-
return /* @__PURE__ */
|
|
2736
|
+
return /* @__PURE__ */ jsx23(Box16, { className: collectiblesGrid, display: "grid", gap: "2", children: shownCollectibles.map((collectible) => {
|
|
2489
2737
|
const showPlus = total > 4 && collectibles.indexOf(collectible) === 3;
|
|
2490
|
-
return /* @__PURE__ */
|
|
2738
|
+
return /* @__PURE__ */ jsxs16(
|
|
2491
2739
|
Box16,
|
|
2492
2740
|
{
|
|
2493
2741
|
className: collectiblesGridItem,
|
|
2494
2742
|
position: "relative",
|
|
2495
2743
|
children: [
|
|
2496
|
-
/* @__PURE__ */
|
|
2744
|
+
/* @__PURE__ */ jsx23(
|
|
2497
2745
|
Image5,
|
|
2498
2746
|
{
|
|
2499
2747
|
src: collectible.image,
|
|
@@ -2504,7 +2752,7 @@ function CollectiblesGrid({ collectibles }) {
|
|
|
2504
2752
|
borderRadius: "sm"
|
|
2505
2753
|
}
|
|
2506
2754
|
),
|
|
2507
|
-
showPlus && /* @__PURE__ */
|
|
2755
|
+
showPlus && /* @__PURE__ */ jsx23(
|
|
2508
2756
|
Box16,
|
|
2509
2757
|
{
|
|
2510
2758
|
position: "absolute",
|
|
@@ -2517,8 +2765,8 @@ function CollectiblesGrid({ collectibles }) {
|
|
|
2517
2765
|
justifyContent: "center",
|
|
2518
2766
|
background: "backgroundOverlay",
|
|
2519
2767
|
backdropFilter: "blur",
|
|
2520
|
-
children: /* @__PURE__ */
|
|
2521
|
-
|
|
2768
|
+
children: /* @__PURE__ */ jsxs16(
|
|
2769
|
+
Text13,
|
|
2522
2770
|
{
|
|
2523
2771
|
fontSize: "small",
|
|
2524
2772
|
fontWeight: "medium",
|
|
@@ -2547,7 +2795,7 @@ var SuccessfulPurchaseModal_default = SuccessfulPurchaseModal;
|
|
|
2547
2795
|
// src/react/ui/modals/TransferModal/index.tsx
|
|
2548
2796
|
import { CloseIcon as CloseIcon3, IconButton as IconButton4 } from "@0xsequence/design-system";
|
|
2549
2797
|
import { Show as Show5, observer as observer13 } from "@legendapp/state/react";
|
|
2550
|
-
import { Close as Close3, Content as
|
|
2798
|
+
import { Close as Close3, Content as Content4, Overlay as Overlay3, Portal as Portal4, Root as Root4 } from "@radix-ui/react-dialog";
|
|
2551
2799
|
import { useAccount as useAccount5 } from "wagmi";
|
|
2552
2800
|
|
|
2553
2801
|
// src/react/ui/modals/TransferModal/_store.ts
|
|
@@ -2590,7 +2838,7 @@ var initialState7 = {
|
|
|
2590
2838
|
var transferModal$ = observable8(initialState7);
|
|
2591
2839
|
|
|
2592
2840
|
// src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
|
|
2593
|
-
import { Box as Box17, Button as Button4, Text as
|
|
2841
|
+
import { Box as Box17, Button as Button4, Text as Text14, TextInput } from "@0xsequence/design-system";
|
|
2594
2842
|
import { observable as observable9 } from "@legendapp/state";
|
|
2595
2843
|
import { isAddress } from "viem";
|
|
2596
2844
|
import { useAccount as useAccount4 } from "wagmi";
|
|
@@ -2676,7 +2924,7 @@ var useHandleTransfer = () => {
|
|
|
2676
2924
|
var useHandleTransfer_default = useHandleTransfer;
|
|
2677
2925
|
|
|
2678
2926
|
// src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
|
|
2679
|
-
import { Fragment, jsx as
|
|
2927
|
+
import { Fragment as Fragment2, jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2680
2928
|
var EnterWalletAddressView = () => {
|
|
2681
2929
|
const { address } = useAccount4();
|
|
2682
2930
|
const { collectionAddress, collectibleId, chainId, collectionType } = transferModal$.state.get();
|
|
@@ -2689,11 +2937,11 @@ var EnterWalletAddressView = () => {
|
|
|
2689
2937
|
chainId,
|
|
2690
2938
|
contractAddress: collectionAddress,
|
|
2691
2939
|
tokenId: collectibleId,
|
|
2692
|
-
accountAddress: address,
|
|
2940
|
+
accountAddress: address ?? "",
|
|
2693
2941
|
query: { enabled: !!address }
|
|
2694
2942
|
});
|
|
2695
2943
|
const balanceAmount = tokenBalance?.pages[0].balances[0].balance;
|
|
2696
|
-
const insufficientBalance = $quantity.get() > balanceAmount;
|
|
2944
|
+
const insufficientBalance = balanceAmount ? $quantity.get() > balanceAmount : true;
|
|
2697
2945
|
const { data: collection } = useCollection({
|
|
2698
2946
|
collectionAddress,
|
|
2699
2947
|
chainId
|
|
@@ -2709,17 +2957,17 @@ var EnterWalletAddressView = () => {
|
|
|
2709
2957
|
transfer();
|
|
2710
2958
|
transferModal$.view.set("followWalletInstructions");
|
|
2711
2959
|
}
|
|
2712
|
-
return /* @__PURE__ */
|
|
2713
|
-
/* @__PURE__ */
|
|
2714
|
-
/* @__PURE__ */
|
|
2715
|
-
/* @__PURE__ */
|
|
2960
|
+
return /* @__PURE__ */ jsxs17(Box17, { display: "grid", gap: "6", flexGrow: "1", children: [
|
|
2961
|
+
/* @__PURE__ */ jsx24(Text14, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
|
|
2962
|
+
/* @__PURE__ */ jsxs17(Box17, { display: "flex", flexDirection: "column", gap: "3", children: [
|
|
2963
|
+
/* @__PURE__ */ jsx24(
|
|
2716
2964
|
AlertMessage,
|
|
2717
2965
|
{
|
|
2718
2966
|
message: getMessage("enterReceiverAddress"),
|
|
2719
2967
|
type: "warning"
|
|
2720
2968
|
}
|
|
2721
2969
|
),
|
|
2722
|
-
/* @__PURE__ */
|
|
2970
|
+
/* @__PURE__ */ jsx24(
|
|
2723
2971
|
TextInput,
|
|
2724
2972
|
{
|
|
2725
2973
|
label: "Wallet address",
|
|
@@ -2730,8 +2978,8 @@ var EnterWalletAddressView = () => {
|
|
|
2730
2978
|
placeholder: "Enter wallet address of recipient"
|
|
2731
2979
|
}
|
|
2732
2980
|
),
|
|
2733
|
-
collectionType === "ERC1155" /* ERC1155 */ && balanceAmount && /* @__PURE__ */
|
|
2734
|
-
/* @__PURE__ */
|
|
2981
|
+
collectionType === "ERC1155" /* ERC1155 */ && balanceAmount && /* @__PURE__ */ jsxs17(Fragment2, { children: [
|
|
2982
|
+
/* @__PURE__ */ jsx24(
|
|
2735
2983
|
QuantityInput,
|
|
2736
2984
|
{
|
|
2737
2985
|
$quantity,
|
|
@@ -2740,8 +2988,8 @@ var EnterWalletAddressView = () => {
|
|
|
2740
2988
|
maxQuantity: balanceAmount
|
|
2741
2989
|
}
|
|
2742
2990
|
),
|
|
2743
|
-
/* @__PURE__ */
|
|
2744
|
-
|
|
2991
|
+
/* @__PURE__ */ jsx24(
|
|
2992
|
+
Text14,
|
|
2745
2993
|
{
|
|
2746
2994
|
color: insufficientBalance ? "negative" : "text50",
|
|
2747
2995
|
fontSize: "small",
|
|
@@ -2752,7 +3000,7 @@ var EnterWalletAddressView = () => {
|
|
|
2752
3000
|
)
|
|
2753
3001
|
] })
|
|
2754
3002
|
] }),
|
|
2755
|
-
/* @__PURE__ */
|
|
3003
|
+
/* @__PURE__ */ jsx24(
|
|
2756
3004
|
Button4,
|
|
2757
3005
|
{
|
|
2758
3006
|
onClick: handleChangeView,
|
|
@@ -2771,20 +3019,20 @@ var EnterWalletAddressView = () => {
|
|
|
2771
3019
|
var enterWalletAddress_default = EnterWalletAddressView;
|
|
2772
3020
|
|
|
2773
3021
|
// src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx
|
|
2774
|
-
import { Box as Box18, Button as Button5, Text as
|
|
3022
|
+
import { Box as Box18, Button as Button5, Text as Text15 } from "@0xsequence/design-system";
|
|
2775
3023
|
import { observer as observer12 } from "@legendapp/state/react";
|
|
2776
|
-
import { jsx as
|
|
3024
|
+
import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2777
3025
|
var FollowWalletInstructionsView = observer12(() => {
|
|
2778
|
-
return /* @__PURE__ */
|
|
2779
|
-
/* @__PURE__ */
|
|
2780
|
-
/* @__PURE__ */
|
|
3026
|
+
return /* @__PURE__ */ jsxs18(Box18, { display: "grid", gap: "6", flexGrow: "1", children: [
|
|
3027
|
+
/* @__PURE__ */ jsx25(Text15, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
|
|
3028
|
+
/* @__PURE__ */ jsx25(Box18, { display: "flex", flexDirection: "column", gap: "3", children: /* @__PURE__ */ jsx25(
|
|
2781
3029
|
AlertMessage,
|
|
2782
3030
|
{
|
|
2783
3031
|
message: getMessage("followWalletInstructions"),
|
|
2784
3032
|
type: "info"
|
|
2785
3033
|
}
|
|
2786
3034
|
) }),
|
|
2787
|
-
/* @__PURE__ */
|
|
3035
|
+
/* @__PURE__ */ jsx25(
|
|
2788
3036
|
Button5,
|
|
2789
3037
|
{
|
|
2790
3038
|
disabled: true,
|
|
@@ -2802,7 +3050,7 @@ var FollowWalletInstructionsView = observer12(() => {
|
|
|
2802
3050
|
var followWalletInstructions_default = FollowWalletInstructionsView;
|
|
2803
3051
|
|
|
2804
3052
|
// src/react/ui/modals/TransferModal/index.tsx
|
|
2805
|
-
import { jsx as
|
|
3053
|
+
import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2806
3054
|
var useTransferModal = () => {
|
|
2807
3055
|
const { chainId: accountChainId } = useAccount5();
|
|
2808
3056
|
const { show: showSwitchNetworkModal } = useSwitchChainModal();
|
|
@@ -2838,17 +3086,17 @@ var useTransferModal = () => {
|
|
|
2838
3086
|
};
|
|
2839
3087
|
};
|
|
2840
3088
|
var TransferModal = () => {
|
|
2841
|
-
return /* @__PURE__ */
|
|
3089
|
+
return /* @__PURE__ */ jsx26(Show5, { if: transferModal$.isOpen, children: /* @__PURE__ */ jsx26(Modal3, {}) });
|
|
2842
3090
|
};
|
|
2843
3091
|
var Modal3 = () => {
|
|
2844
|
-
return /* @__PURE__ */
|
|
3092
|
+
return /* @__PURE__ */ jsx26(ModalContent3, {});
|
|
2845
3093
|
};
|
|
2846
3094
|
var ModalContent3 = observer13(() => {
|
|
2847
|
-
return /* @__PURE__ */
|
|
2848
|
-
/* @__PURE__ */
|
|
2849
|
-
/* @__PURE__ */
|
|
2850
|
-
/* @__PURE__ */
|
|
2851
|
-
/* @__PURE__ */
|
|
3095
|
+
return /* @__PURE__ */ jsx26(Root4, { open: true, children: /* @__PURE__ */ jsxs19(Portal4, { children: [
|
|
3096
|
+
/* @__PURE__ */ jsx26(Overlay3, { className: dialogOverlay2 }),
|
|
3097
|
+
/* @__PURE__ */ jsxs19(Content4, { className: transferModalContent, children: [
|
|
3098
|
+
/* @__PURE__ */ jsx26(TransactionModalView, {}),
|
|
3099
|
+
/* @__PURE__ */ jsx26(Close3, { onClick: transferModal$.close, className: closeButton2, asChild: true, children: /* @__PURE__ */ jsx26(IconButton4, { size: "xs", "aria-label": "Close modal", icon: CloseIcon3 }) })
|
|
2852
3100
|
] })
|
|
2853
3101
|
] }) });
|
|
2854
3102
|
});
|
|
@@ -2856,39 +3104,39 @@ var TransactionModalView = observer13(() => {
|
|
|
2856
3104
|
const { view } = transferModal$.get();
|
|
2857
3105
|
switch (view) {
|
|
2858
3106
|
case "enterReceiverAddress":
|
|
2859
|
-
return /* @__PURE__ */
|
|
3107
|
+
return /* @__PURE__ */ jsx26(enterWalletAddress_default, {});
|
|
2860
3108
|
case "followWalletInstructions":
|
|
2861
|
-
return /* @__PURE__ */
|
|
3109
|
+
return /* @__PURE__ */ jsx26(followWalletInstructions_default, {});
|
|
2862
3110
|
default:
|
|
2863
3111
|
return null;
|
|
2864
3112
|
}
|
|
2865
3113
|
});
|
|
2866
3114
|
|
|
2867
3115
|
// src/react/ui/modals/modal-provider.tsx
|
|
2868
|
-
import { Fragment as
|
|
3116
|
+
import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2869
3117
|
var ModalProvider = observer14(() => {
|
|
2870
|
-
return /* @__PURE__ */
|
|
2871
|
-
/* @__PURE__ */
|
|
2872
|
-
/* @__PURE__ */
|
|
2873
|
-
/* @__PURE__ */
|
|
2874
|
-
/* @__PURE__ */
|
|
2875
|
-
/* @__PURE__ */
|
|
2876
|
-
/* @__PURE__ */
|
|
2877
|
-
/* @__PURE__ */
|
|
2878
|
-
/* @__PURE__ */
|
|
2879
|
-
/* @__PURE__ */
|
|
3118
|
+
return /* @__PURE__ */ jsxs20(Fragment3, { children: [
|
|
3119
|
+
/* @__PURE__ */ jsx27(AccountModal, {}),
|
|
3120
|
+
/* @__PURE__ */ jsx27(CreateListingModal, {}),
|
|
3121
|
+
/* @__PURE__ */ jsx27(MakeOfferModal, {}),
|
|
3122
|
+
/* @__PURE__ */ jsx27(TransferModal, {}),
|
|
3123
|
+
/* @__PURE__ */ jsx27(SellModal, {}),
|
|
3124
|
+
/* @__PURE__ */ jsx27(BuyModal, {}),
|
|
3125
|
+
/* @__PURE__ */ jsx27(SuccessfulPurchaseModal_default, {}),
|
|
3126
|
+
/* @__PURE__ */ jsx27(switchChainModal_default, {}),
|
|
3127
|
+
/* @__PURE__ */ jsx27(transactionStatusModal_default, {})
|
|
2880
3128
|
] });
|
|
2881
3129
|
});
|
|
2882
3130
|
|
|
2883
3131
|
// src/react/ui/components/collectible-card/CollectibleCard.tsx
|
|
2884
|
-
import { useState as
|
|
3132
|
+
import { useState as useState12 } from "react";
|
|
2885
3133
|
import { Box as Box22, IconButton as IconButton6, Skeleton as Skeleton8 } from "@0xsequence/design-system";
|
|
2886
3134
|
import { useAccount as useAccount7 } from "wagmi";
|
|
2887
3135
|
|
|
2888
3136
|
// src/react/ui/icons/DiamondEye.tsx
|
|
2889
3137
|
import { Box as Box19 } from "@0xsequence/design-system";
|
|
2890
|
-
import { jsx as
|
|
2891
|
-
var Svg = () => /* @__PURE__ */
|
|
3138
|
+
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3139
|
+
var Svg = () => /* @__PURE__ */ jsxs21(
|
|
2892
3140
|
"svg",
|
|
2893
3141
|
{
|
|
2894
3142
|
width: "16",
|
|
@@ -2896,18 +3144,23 @@ var Svg = () => /* @__PURE__ */ jsx29(
|
|
|
2896
3144
|
viewBox: "0 0 16 12",
|
|
2897
3145
|
fill: "none",
|
|
2898
3146
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
3147
|
+
role: "img",
|
|
3148
|
+
"aria-labelledby": "diamond-eye-title",
|
|
3149
|
+
children: [
|
|
3150
|
+
/* @__PURE__ */ jsx28("title", { id: "diamond-eye-title", children: "Diamond Eye Icon" }),
|
|
3151
|
+
/* @__PURE__ */ jsx28(
|
|
3152
|
+
"path",
|
|
3153
|
+
{
|
|
3154
|
+
fillRule: "evenodd",
|
|
3155
|
+
clipRule: "evenodd",
|
|
3156
|
+
d: "M5.00447 0.108826L0.611084 4.50526L7.99997 11.8911L15.3889 4.50526L10.9955 0.108826H5.00447ZM4.60507 2.90461C6.4718 1.0297 9.52815 1.02968 11.3949 2.90459L12.9925 4.50223L11.3949 6.09983C9.52815 7.97473 6.4718 7.97473 4.60507 6.09985L3.00749 4.50223L4.60507 2.90461ZM5.70321 4.50209C5.70321 5.77095 6.73193 6.79865 7.99974 6.79865C9.2676 6.79865 10.2963 5.77095 10.2963 4.50209C10.2963 3.23322 9.2676 2.20553 7.99974 2.20553C6.73193 2.20553 5.70321 3.23322 5.70321 4.50209ZM7.99974 5.50058C7.44853 5.50058 7.00125 5.05377 7.00125 4.50209C7.00125 3.9504 7.44853 3.50359 7.99974 3.50359C8.55095 3.50359 8.99825 3.9504 8.99825 4.50209C8.99825 5.05377 8.55095 5.50058 7.99974 5.50058Z",
|
|
3157
|
+
fill: "white"
|
|
3158
|
+
}
|
|
3159
|
+
)
|
|
3160
|
+
]
|
|
2908
3161
|
}
|
|
2909
3162
|
);
|
|
2910
|
-
var SvgDiamondEyeIcon = ({ size = "sm", ...props }) => /* @__PURE__ */
|
|
3163
|
+
var SvgDiamondEyeIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx28(
|
|
2911
3164
|
Box19,
|
|
2912
3165
|
{
|
|
2913
3166
|
as: Svg,
|
|
@@ -2922,7 +3175,7 @@ var DiamondEye_default = SvgDiamondEyeIcon;
|
|
|
2922
3175
|
// src/react/ui/components/_internals/action-button/ActionButton.tsx
|
|
2923
3176
|
import { Button as Button6 } from "@0xsequence/design-system";
|
|
2924
3177
|
import { observer as observer15 } from "@legendapp/state/react";
|
|
2925
|
-
import { jsx as
|
|
3178
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
2926
3179
|
var ActionButton = observer15(
|
|
2927
3180
|
({
|
|
2928
3181
|
collectionAddress,
|
|
@@ -2941,7 +3194,7 @@ var ActionButton = observer15(
|
|
|
2941
3194
|
if (action === "Buy" /* BUY */) {
|
|
2942
3195
|
if (!lowestListing)
|
|
2943
3196
|
throw new InvalidStepError("BUY", "lowestListing is required");
|
|
2944
|
-
return /* @__PURE__ */
|
|
3197
|
+
return /* @__PURE__ */ jsx29(
|
|
2945
3198
|
ActionButtonBody,
|
|
2946
3199
|
{
|
|
2947
3200
|
label: "Buy",
|
|
@@ -2957,7 +3210,7 @@ var ActionButton = observer15(
|
|
|
2957
3210
|
if (action === "Sell" /* SELL */) {
|
|
2958
3211
|
if (!highestOffer)
|
|
2959
3212
|
throw new InvalidStepError("SELL", "highestOffer is required");
|
|
2960
|
-
return /* @__PURE__ */
|
|
3213
|
+
return /* @__PURE__ */ jsx29(
|
|
2961
3214
|
ActionButtonBody,
|
|
2962
3215
|
{
|
|
2963
3216
|
label: "Sell",
|
|
@@ -2971,7 +3224,7 @@ var ActionButton = observer15(
|
|
|
2971
3224
|
);
|
|
2972
3225
|
}
|
|
2973
3226
|
if (action === "Create listing" /* LIST */) {
|
|
2974
|
-
return /* @__PURE__ */
|
|
3227
|
+
return /* @__PURE__ */ jsx29(
|
|
2975
3228
|
ActionButtonBody,
|
|
2976
3229
|
{
|
|
2977
3230
|
label: "Create listing",
|
|
@@ -2985,7 +3238,7 @@ var ActionButton = observer15(
|
|
|
2985
3238
|
);
|
|
2986
3239
|
}
|
|
2987
3240
|
if (action === "Make an offer" /* OFFER */) {
|
|
2988
|
-
return /* @__PURE__ */
|
|
3241
|
+
return /* @__PURE__ */ jsx29(
|
|
2989
3242
|
ActionButtonBody,
|
|
2990
3243
|
{
|
|
2991
3244
|
label: "Make an offer",
|
|
@@ -2999,7 +3252,7 @@ var ActionButton = observer15(
|
|
|
2999
3252
|
);
|
|
3000
3253
|
}
|
|
3001
3254
|
if (action === "Transfer" /* TRANSFER */) {
|
|
3002
|
-
return /* @__PURE__ */
|
|
3255
|
+
return /* @__PURE__ */ jsx29(
|
|
3003
3256
|
ActionButtonBody,
|
|
3004
3257
|
{
|
|
3005
3258
|
label: "Transfer",
|
|
@@ -3015,7 +3268,7 @@ var ActionButton = observer15(
|
|
|
3015
3268
|
}
|
|
3016
3269
|
);
|
|
3017
3270
|
function ActionButtonBody({ label, onClick }) {
|
|
3018
|
-
return /* @__PURE__ */
|
|
3271
|
+
return /* @__PURE__ */ jsx29(
|
|
3019
3272
|
Button6,
|
|
3020
3273
|
{
|
|
3021
3274
|
variant: "primary",
|
|
@@ -3033,14 +3286,14 @@ function ActionButtonBody({ label, onClick }) {
|
|
|
3033
3286
|
}
|
|
3034
3287
|
|
|
3035
3288
|
// src/react/ui/components/collectible-card/Footer.tsx
|
|
3036
|
-
import { Box as Box21, IconButton as IconButton5, Image as Image6, Text as
|
|
3037
|
-
import { formatUnits as
|
|
3289
|
+
import { Box as Box21, IconButton as IconButton5, Image as Image6, Text as Text16 } from "@0xsequence/design-system";
|
|
3290
|
+
import { formatUnits as formatUnits4 } from "viem";
|
|
3038
3291
|
import { useAccount as useAccount6 } from "wagmi";
|
|
3039
3292
|
|
|
3040
3293
|
// src/react/ui/icons/Bell.tsx
|
|
3041
3294
|
import { Box as Box20 } from "@0xsequence/design-system";
|
|
3042
|
-
import { jsx as
|
|
3043
|
-
var Svg2 = () => /* @__PURE__ */
|
|
3295
|
+
import { jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3296
|
+
var Svg2 = () => /* @__PURE__ */ jsxs22(
|
|
3044
3297
|
"svg",
|
|
3045
3298
|
{
|
|
3046
3299
|
width: "17",
|
|
@@ -3048,18 +3301,23 @@ var Svg2 = () => /* @__PURE__ */ jsx31(
|
|
|
3048
3301
|
viewBox: "0 0 17 17",
|
|
3049
3302
|
fill: "none",
|
|
3050
3303
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3304
|
+
role: "img",
|
|
3305
|
+
"aria-labelledby": "bell-title",
|
|
3306
|
+
children: [
|
|
3307
|
+
/* @__PURE__ */ jsx30("title", { id: "bell-title", children: "Notification Bell" }),
|
|
3308
|
+
/* @__PURE__ */ jsx30(
|
|
3309
|
+
"path",
|
|
3310
|
+
{
|
|
3311
|
+
fillRule: "evenodd",
|
|
3312
|
+
clipRule: "evenodd",
|
|
3313
|
+
d: "M12.3127 7.45705V9.74274C12.3127 10.3805 12.6293 10.6971 12.9647 11.0326L12.9652 11.033L12.9679 11.0358C13.3205 11.3893 13.6843 11.754 13.6843 12.4854C13.6843 12.5491 13.6335 12.5998 13.57 12.5998H3.51277C3.44959 12.5998 3.39844 12.5489 3.39844 12.4854C3.39844 11.7539 3.76242 11.389 4.11507 11.0354L4.11754 11.033C4.45305 10.6975 4.76984 10.3807 4.76984 9.74245V7.45676C4.76984 5.6932 5.98854 4.21248 7.62704 3.802V3.11399C7.62704 2.60926 8.03659 2.19971 8.54132 2.19971C9.04606 2.19971 9.45561 2.60926 9.45561 3.11399V3.802C11.094 4.21286 12.3127 5.69335 12.3127 7.45705ZM10.3698 13.1711C10.3698 14.1809 9.55099 14.9997 8.54121 14.9997C7.53128 14.9997 6.71272 14.181 6.71272 13.1711H10.3698ZM8.758 7.70501C9.30005 7.85574 9.6696 7.99832 9.86302 8.13224C10.1776 8.35015 10.3374 8.67657 10.338 9.106C10.338 9.7284 10.1359 10.1706 9.72956 10.4326C9.50571 10.5778 9.18295 10.6723 8.75846 10.7195V11.4005H8.42657V10.7195C7.74604 10.6746 7.28244 10.4349 7.04094 9.99812C6.90703 9.76157 6.83984 9.44246 6.83984 9.04019H7.46277C7.48004 9.35983 7.53041 9.59501 7.6135 9.74163C7.75837 10.0063 8.0303 10.1548 8.42664 10.1861V8.27703C7.9177 8.18078 7.54357 8.01963 7.30116 7.79532C7.0605 7.57102 6.93929 7.25914 6.93929 6.86234C6.93929 6.50686 7.06917 6.18768 7.32977 5.90212C7.58991 5.61657 7.95581 5.47132 8.42619 5.46675V5.00049H8.75808V5.45861C9.22343 5.4927 9.58119 5.62981 9.82863 5.87039C10.0787 6.11144 10.2086 6.43062 10.2204 6.82651H9.60569C9.5907 6.64899 9.54299 6.49507 9.4631 6.36884C9.31595 6.13183 9.08076 6.00697 8.758 5.99518V7.70501ZM7.80143 7.36315C7.95574 7.49478 8.16369 7.58608 8.42611 7.63691L8.42619 5.98886C8.11651 5.99936 7.89723 6.09424 7.76651 6.2681C7.63572 6.4447 7.57036 6.62815 7.57036 6.82019C7.57036 7.05081 7.64705 7.23289 7.80143 7.36315ZM8.75747 10.2033C9.15883 10.1847 9.43305 10.0394 9.58606 9.76522C9.66504 9.62408 9.70415 9.46285 9.70399 9.27948C9.70399 8.98624 9.59686 8.76376 9.38123 8.61121C9.2582 8.52219 9.05079 8.4391 8.75747 8.35921V10.2033Z",
|
|
3314
|
+
fill: "white"
|
|
3315
|
+
}
|
|
3316
|
+
)
|
|
3317
|
+
]
|
|
3060
3318
|
}
|
|
3061
3319
|
);
|
|
3062
|
-
var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */
|
|
3320
|
+
var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx30(
|
|
3063
3321
|
Box20,
|
|
3064
3322
|
{
|
|
3065
3323
|
as: Svg2,
|
|
@@ -3072,7 +3330,7 @@ var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx31(
|
|
|
3072
3330
|
var Bell_default = SvgBellIcon;
|
|
3073
3331
|
|
|
3074
3332
|
// src/react/ui/components/collectible-card/Footer.tsx
|
|
3075
|
-
import { jsx as
|
|
3333
|
+
import { jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3076
3334
|
var Footer = ({
|
|
3077
3335
|
name,
|
|
3078
3336
|
type,
|
|
@@ -3086,12 +3344,12 @@ var Footer = ({
|
|
|
3086
3344
|
const { address } = useAccount6();
|
|
3087
3345
|
const listed = !!lowestListingPriceAmount && !!lowestListingCurrency;
|
|
3088
3346
|
if (name.length > 15 && highestOffer) {
|
|
3089
|
-
name = name.substring(0, 13)
|
|
3347
|
+
name = `${name.substring(0, 13)}...`;
|
|
3090
3348
|
}
|
|
3091
3349
|
if (name.length > 17 && !highestOffer) {
|
|
3092
|
-
name = name.substring(0, 17)
|
|
3350
|
+
name = `${name.substring(0, 17)}...`;
|
|
3093
3351
|
}
|
|
3094
|
-
return /* @__PURE__ */
|
|
3352
|
+
return /* @__PURE__ */ jsxs23(
|
|
3095
3353
|
Box21,
|
|
3096
3354
|
{
|
|
3097
3355
|
display: "flex",
|
|
@@ -3103,7 +3361,7 @@ var Footer = ({
|
|
|
3103
3361
|
position: "relative",
|
|
3104
3362
|
className: !!address && isAnimated ? footer.animated : footer.static,
|
|
3105
3363
|
children: [
|
|
3106
|
-
/* @__PURE__ */
|
|
3364
|
+
/* @__PURE__ */ jsxs23(
|
|
3107
3365
|
Box21,
|
|
3108
3366
|
{
|
|
3109
3367
|
display: "flex",
|
|
@@ -3112,8 +3370,8 @@ var Footer = ({
|
|
|
3112
3370
|
position: "relative",
|
|
3113
3371
|
width: "full",
|
|
3114
3372
|
children: [
|
|
3115
|
-
/* @__PURE__ */
|
|
3116
|
-
|
|
3373
|
+
/* @__PURE__ */ jsx31(
|
|
3374
|
+
Text16,
|
|
3117
3375
|
{
|
|
3118
3376
|
color: "text100",
|
|
3119
3377
|
fontSize: "normal",
|
|
@@ -3123,7 +3381,7 @@ var Footer = ({
|
|
|
3123
3381
|
children: name
|
|
3124
3382
|
}
|
|
3125
3383
|
),
|
|
3126
|
-
highestOffer && onOfferClick && /* @__PURE__ */
|
|
3384
|
+
highestOffer && onOfferClick && /* @__PURE__ */ jsx31(
|
|
3127
3385
|
IconButton5,
|
|
3128
3386
|
{
|
|
3129
3387
|
size: "xs",
|
|
@@ -3136,16 +3394,16 @@ var Footer = ({
|
|
|
3136
3394
|
e.stopPropagation();
|
|
3137
3395
|
onOfferClick?.();
|
|
3138
3396
|
},
|
|
3139
|
-
icon: (props) => /* @__PURE__ */
|
|
3397
|
+
icon: (props) => /* @__PURE__ */ jsx31(Bell_default, { ...props, size: "xs" })
|
|
3140
3398
|
}
|
|
3141
3399
|
)
|
|
3142
3400
|
]
|
|
3143
3401
|
}
|
|
3144
3402
|
),
|
|
3145
|
-
/* @__PURE__ */
|
|
3146
|
-
listed && /* @__PURE__ */
|
|
3147
|
-
/* @__PURE__ */
|
|
3148
|
-
|
|
3403
|
+
/* @__PURE__ */ jsxs23(Box21, { display: "flex", alignItems: "center", gap: "1", children: [
|
|
3404
|
+
listed && /* @__PURE__ */ jsx31(Image6, { src: lowestListingCurrency?.imageUrl, width: "3", height: "3" }),
|
|
3405
|
+
/* @__PURE__ */ jsxs23(
|
|
3406
|
+
Text16,
|
|
3149
3407
|
{
|
|
3150
3408
|
color: listed ? "text100" : "text50",
|
|
3151
3409
|
fontSize: "small",
|
|
@@ -3153,16 +3411,16 @@ var Footer = ({
|
|
|
3153
3411
|
textAlign: "left",
|
|
3154
3412
|
fontFamily: "body",
|
|
3155
3413
|
children: [
|
|
3156
|
-
listed &&
|
|
3414
|
+
listed && `${formatUnits4(
|
|
3157
3415
|
BigInt(lowestListingPriceAmount),
|
|
3158
3416
|
lowestListingCurrency.decimals
|
|
3159
|
-
)
|
|
3417
|
+
)} ${lowestListingCurrency.symbol}`,
|
|
3160
3418
|
!listed && "Not listed yet"
|
|
3161
3419
|
]
|
|
3162
3420
|
}
|
|
3163
3421
|
)
|
|
3164
3422
|
] }),
|
|
3165
|
-
/* @__PURE__ */
|
|
3423
|
+
/* @__PURE__ */ jsx31(TokenTypeBalancePill, { balance, type })
|
|
3166
3424
|
]
|
|
3167
3425
|
}
|
|
3168
3426
|
);
|
|
@@ -3171,9 +3429,9 @@ var TokenTypeBalancePill = ({
|
|
|
3171
3429
|
balance,
|
|
3172
3430
|
type
|
|
3173
3431
|
}) => {
|
|
3174
|
-
const displayText = type === "ERC1155" /* ERC1155 */ ?
|
|
3175
|
-
return /* @__PURE__ */
|
|
3176
|
-
|
|
3432
|
+
const displayText = type === "ERC1155" /* ERC1155 */ ? balance ? `Owned: ${balance}` : "ERC-1155" : "ERC-721";
|
|
3433
|
+
return /* @__PURE__ */ jsx31(
|
|
3434
|
+
Text16,
|
|
3177
3435
|
{
|
|
3178
3436
|
background: "backgroundSecondary",
|
|
3179
3437
|
color: "text80",
|
|
@@ -3189,9 +3447,9 @@ var TokenTypeBalancePill = ({
|
|
|
3189
3447
|
};
|
|
3190
3448
|
|
|
3191
3449
|
// src/react/ui/components/collectible-card/CollectibleCard.tsx
|
|
3192
|
-
import { jsx as
|
|
3450
|
+
import { jsx as jsx32, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3193
3451
|
function CollectibleSkeleton() {
|
|
3194
|
-
return /* @__PURE__ */
|
|
3452
|
+
return /* @__PURE__ */ jsxs24(
|
|
3195
3453
|
Box22,
|
|
3196
3454
|
{
|
|
3197
3455
|
className: collectibleCard,
|
|
@@ -3199,14 +3457,14 @@ function CollectibleSkeleton() {
|
|
|
3199
3457
|
overflow: "hidden",
|
|
3200
3458
|
background: "backgroundPrimary",
|
|
3201
3459
|
children: [
|
|
3202
|
-
/* @__PURE__ */
|
|
3460
|
+
/* @__PURE__ */ jsx32(
|
|
3203
3461
|
Skeleton8,
|
|
3204
3462
|
{
|
|
3205
3463
|
size: "lg",
|
|
3206
3464
|
style: { width: "100%", height: 164, borderRadius: 0, paddingTop: 16 }
|
|
3207
3465
|
}
|
|
3208
3466
|
),
|
|
3209
|
-
/* @__PURE__ */
|
|
3467
|
+
/* @__PURE__ */ jsxs24(
|
|
3210
3468
|
Box22,
|
|
3211
3469
|
{
|
|
3212
3470
|
display: "flex",
|
|
@@ -3216,8 +3474,8 @@ function CollectibleSkeleton() {
|
|
|
3216
3474
|
paddingBottom: "4",
|
|
3217
3475
|
marginTop: "2",
|
|
3218
3476
|
children: [
|
|
3219
|
-
/* @__PURE__ */
|
|
3220
|
-
/* @__PURE__ */
|
|
3477
|
+
/* @__PURE__ */ jsx32(Skeleton8, { size: "lg" }),
|
|
3478
|
+
/* @__PURE__ */ jsx32(Skeleton8, { size: "sm" })
|
|
3221
3479
|
]
|
|
3222
3480
|
}
|
|
3223
3481
|
)
|
|
@@ -3239,7 +3497,7 @@ function CollectibleCard({
|
|
|
3239
3497
|
}) {
|
|
3240
3498
|
const { address: accountAddress } = useAccount7();
|
|
3241
3499
|
const collectibleMetadata = lowestListing?.metadata;
|
|
3242
|
-
const [imageLoadingError, setImageLoadingError] =
|
|
3500
|
+
const [imageLoadingError, setImageLoadingError] = useState12(false);
|
|
3243
3501
|
const { data: highestOffer, isLoading: highestOfferLoading } = useHighestOffer({
|
|
3244
3502
|
chainId: String(chainId),
|
|
3245
3503
|
collectionAddress,
|
|
@@ -3251,20 +3509,20 @@ function CollectibleCard({
|
|
|
3251
3509
|
(currency) => currency.contractAddress === lowestListing?.order?.priceCurrencyAddress
|
|
3252
3510
|
);
|
|
3253
3511
|
if (highestOfferLoading || cardLoading) {
|
|
3254
|
-
return /* @__PURE__ */
|
|
3512
|
+
return /* @__PURE__ */ jsx32(CollectibleSkeleton, {});
|
|
3255
3513
|
}
|
|
3256
|
-
const action =
|
|
3514
|
+
const action = balance ? highestOffer?.order && "Sell" /* SELL */ || !lowestListing?.order && "Create listing" /* LIST */ || "Transfer" /* TRANSFER */ : lowestListing?.order && "Buy" /* BUY */ || "Make an offer" /* OFFER */;
|
|
3257
3515
|
const name = collectibleMetadata?.name;
|
|
3258
3516
|
const image = collectibleMetadata?.image;
|
|
3259
3517
|
const externalUrl = collectibleMetadata?.external_url;
|
|
3260
|
-
return /* @__PURE__ */
|
|
3518
|
+
return /* @__PURE__ */ jsx32(
|
|
3261
3519
|
Box22,
|
|
3262
3520
|
{
|
|
3263
3521
|
className: collectibleCard,
|
|
3264
3522
|
borderRadius: "md",
|
|
3265
3523
|
overflow: "hidden",
|
|
3266
3524
|
background: "backgroundPrimary",
|
|
3267
|
-
children: /* @__PURE__ */
|
|
3525
|
+
children: /* @__PURE__ */ jsx32(
|
|
3268
3526
|
Box22,
|
|
3269
3527
|
{
|
|
3270
3528
|
display: "flex",
|
|
@@ -3280,8 +3538,8 @@ function CollectibleCard({
|
|
|
3280
3538
|
cursor: "pointer",
|
|
3281
3539
|
padding: "0",
|
|
3282
3540
|
className: collectibleTileWrapper,
|
|
3283
|
-
children: /* @__PURE__ */
|
|
3284
|
-
externalUrl && /* @__PURE__ */
|
|
3541
|
+
children: /* @__PURE__ */ jsxs24("article", { style: { width: "100%" }, children: [
|
|
3542
|
+
externalUrl && /* @__PURE__ */ jsx32(
|
|
3285
3543
|
IconButton6,
|
|
3286
3544
|
{
|
|
3287
3545
|
as: "a",
|
|
@@ -3298,7 +3556,7 @@ function CollectibleCard({
|
|
|
3298
3556
|
icon: DiamondEye_default
|
|
3299
3557
|
}
|
|
3300
3558
|
),
|
|
3301
|
-
/* @__PURE__ */
|
|
3559
|
+
/* @__PURE__ */ jsx32(
|
|
3302
3560
|
"img",
|
|
3303
3561
|
{
|
|
3304
3562
|
src: imageLoadingError ? chess_tile_default : image || chess_tile_default,
|
|
@@ -3307,10 +3565,10 @@ function CollectibleCard({
|
|
|
3307
3565
|
onError: () => setImageLoadingError(true)
|
|
3308
3566
|
}
|
|
3309
3567
|
),
|
|
3310
|
-
/* @__PURE__ */
|
|
3568
|
+
/* @__PURE__ */ jsx32(
|
|
3311
3569
|
Footer,
|
|
3312
3570
|
{
|
|
3313
|
-
name,
|
|
3571
|
+
name: name || "",
|
|
3314
3572
|
type: collectionType,
|
|
3315
3573
|
onOfferClick: () => onOfferClick?.({ order: highestOffer?.order }),
|
|
3316
3574
|
highestOffer: highestOffer?.order,
|
|
@@ -3320,7 +3578,7 @@ function CollectibleCard({
|
|
|
3320
3578
|
isAnimated: !!action
|
|
3321
3579
|
}
|
|
3322
3580
|
),
|
|
3323
|
-
accountAddress && (highestOffer || lowestListing) && /* @__PURE__ */
|
|
3581
|
+
accountAddress && (highestOffer || lowestListing) && /* @__PURE__ */ jsx32(
|
|
3324
3582
|
Box22,
|
|
3325
3583
|
{
|
|
3326
3584
|
display: "flex",
|
|
@@ -3328,7 +3586,7 @@ function CollectibleCard({
|
|
|
3328
3586
|
justifyContent: "center",
|
|
3329
3587
|
padding: "2",
|
|
3330
3588
|
className: actionWrapper,
|
|
3331
|
-
children: /* @__PURE__ */
|
|
3589
|
+
children: /* @__PURE__ */ jsx32(
|
|
3332
3590
|
ActionButton,
|
|
3333
3591
|
{
|
|
3334
3592
|
chainId: String(chainId),
|
|
@@ -3360,4 +3618,4 @@ export {
|
|
|
3360
3618
|
ModalProvider,
|
|
3361
3619
|
CollectibleCard
|
|
3362
3620
|
};
|
|
3363
|
-
//# sourceMappingURL=chunk-
|
|
3621
|
+
//# sourceMappingURL=chunk-IOTKCWOB.js.map
|