@0xsequence/marketplace-sdk 0.4.0 → 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-P3EQRM7K.js → chunk-5GDO4ZBC.js} +5 -4
- package/dist/{chunk-P3EQRM7K.js.map → chunk-5GDO4ZBC.js.map} +1 -1
- package/dist/{chunk-QTQH5I2E.js → chunk-EVRILXOH.js} +2 -2
- package/dist/chunk-EVRILXOH.js.map +1 -0
- package/dist/{chunk-GVDLVCR5.js → chunk-GSDUAHL3.js} +1 -1
- package/dist/chunk-GSDUAHL3.js.map +1 -0
- package/dist/{chunk-6HEMV2OR.js → chunk-IOTKCWOB.js} +890 -644
- package/dist/chunk-IOTKCWOB.js.map +1 -0
- package/dist/{chunk-AY2MZHZN.js → chunk-KNX2LER4.js} +5 -6
- package/dist/{chunk-PAHT6PTD.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-PAHT6PTD.js → chunk-LSMQVX77.js} +5 -6
- package/dist/{chunk-AY2MZHZN.js.map → chunk-LSMQVX77.js.map} +1 -1
- package/dist/{chunk-6AYHE7ZA.js → chunk-MIYMMP2K.js} +79 -33
- package/dist/chunk-MIYMMP2K.js.map +1 -0
- package/dist/{chunk-EK5ZSW4M.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 +4 -4
- 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 +663 -74
- package/dist/react/hooks/index.js +7 -7
- 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 +11 -11
- 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 +11 -11
- 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 +11 -11
- 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 +28 -12
- package/src/react/_internal/transaction-machine/useTransactionMachine.ts +43 -8
- package/src/react/hooks/useBuyCollectable.tsx +13 -6
- package/src/react/hooks/useCancelOrder.tsx +14 -7
- package/src/react/hooks/useCreateListing.tsx +74 -10
- package/src/react/hooks/useCurrencies.tsx +1 -1
- package/src/react/hooks/useCurrencyBalance.tsx +1 -1
- package/src/react/hooks/useCurrencyOptions.tsx +1 -1
- package/src/react/hooks/useMakeOffer.tsx +73 -11
- package/src/react/hooks/useSell.tsx +72 -11
- 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 +62 -23
- package/src/react/ui/modals/MakeOfferModal/_store.ts +5 -2
- package/src/react/ui/modals/MakeOfferModal/index.tsx +83 -65
- 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 -10
- 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 +3 -3
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +9 -5
- package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +4 -4
- package/src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +51 -29
- package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +2 -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 +2 -2
- package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getTitle.ts +6 -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 +2 -2
- package/src/utils/price.ts +3 -4
- package/tsconfig.json +1 -21
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/chunk-6AYHE7ZA.js.map +0 -1
- package/dist/chunk-6HEMV2OR.js.map +0 -1
- package/dist/chunk-FFCNYF3S.js +0 -153
- package/dist/chunk-FFCNYF3S.js.map +0 -1
- package/dist/chunk-GVDLVCR5.js.map +0 -1
- package/dist/chunk-NMCGA2TB.js +0 -98
- package/dist/chunk-NMCGA2TB.js.map +0 -1
- package/dist/chunk-QTQH5I2E.js.map +0 -1
- package/dist/chunk-Y7YO5TLE.js.map +0 -1
- /package/dist/{chunk-EK5ZSW4M.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";
|
|
@@ -764,7 +870,8 @@ var CurrencyOptionsSelect = observer4(function CurrencyOptionsSelect2({
|
|
|
764
870
|
const options = currencies.map(
|
|
765
871
|
(currency2) => ({
|
|
766
872
|
label: currency2.symbol,
|
|
767
|
-
value: currency2.contractAddress
|
|
873
|
+
value: currency2.contractAddress,
|
|
874
|
+
content: currency2.symbol
|
|
768
875
|
})
|
|
769
876
|
);
|
|
770
877
|
const onChange = (value) => {
|
|
@@ -777,111 +884,23 @@ var CurrencyOptionsSelect = observer4(function CurrencyOptionsSelect2({
|
|
|
777
884
|
CustomSelect,
|
|
778
885
|
{
|
|
779
886
|
items: options,
|
|
780
|
-
value: currency.symbol,
|
|
781
887
|
onValueChange: onChange,
|
|
782
|
-
defaultValue:
|
|
888
|
+
defaultValue: {
|
|
889
|
+
value: currency.contractAddress,
|
|
890
|
+
content: currency.symbol
|
|
891
|
+
}
|
|
783
892
|
}
|
|
784
893
|
);
|
|
785
894
|
});
|
|
786
895
|
var currencyOptionsSelect_default = CurrencyOptionsSelect;
|
|
787
896
|
|
|
788
|
-
// src/react/hooks/useCurrencyBalance.tsx
|
|
789
|
-
import { useQuery } from "@tanstack/react-query";
|
|
790
|
-
import { erc20Abi, formatUnits as formatUnits2, zeroAddress } from "viem";
|
|
791
|
-
function useCurrencyBalance({
|
|
792
|
-
currencyAddress,
|
|
793
|
-
chainId,
|
|
794
|
-
userAddress
|
|
795
|
-
}) {
|
|
796
|
-
const publicClient = getPublicRpcClient(chainId);
|
|
797
|
-
return useQuery({
|
|
798
|
-
queryKey: ["balance", currencyAddress, chainId, userAddress],
|
|
799
|
-
queryFn: async () => {
|
|
800
|
-
if (!userAddress) return null;
|
|
801
|
-
if (currencyAddress === zeroAddress) {
|
|
802
|
-
const balance2 = await publicClient.getBalance({
|
|
803
|
-
address: userAddress
|
|
804
|
-
});
|
|
805
|
-
return {
|
|
806
|
-
value: balance2,
|
|
807
|
-
formatted: formatUnits2(balance2, 18)
|
|
808
|
-
};
|
|
809
|
-
}
|
|
810
|
-
const [balance, decimals] = await Promise.all([
|
|
811
|
-
publicClient.readContract({
|
|
812
|
-
address: currencyAddress,
|
|
813
|
-
abi: erc20Abi,
|
|
814
|
-
functionName: "balanceOf",
|
|
815
|
-
args: [userAddress]
|
|
816
|
-
}),
|
|
817
|
-
publicClient.readContract({
|
|
818
|
-
address: currencyAddress,
|
|
819
|
-
abi: erc20Abi,
|
|
820
|
-
functionName: "decimals"
|
|
821
|
-
})
|
|
822
|
-
]);
|
|
823
|
-
return {
|
|
824
|
-
value: balance,
|
|
825
|
-
formatted: formatUnits2(balance, decimals)
|
|
826
|
-
};
|
|
827
|
-
},
|
|
828
|
-
enabled: !!userAddress && !!chainId && !!currencyAddress
|
|
829
|
-
});
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
// src/react/ui/modals/_internal/components/currencyImage/index.tsx
|
|
833
|
-
import { Box as Box7, TokenImage as TokenImage2 } from "@0xsequence/design-system";
|
|
834
|
-
import { useState as useState3 } from "react";
|
|
835
|
-
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
836
|
-
function CurrencyImage({
|
|
837
|
-
$listingPrice
|
|
838
|
-
}) {
|
|
839
|
-
const [imageLoadErrorCurrencyAddresses, setImageLoadErrorCurrencyAddresses] = useState3(null);
|
|
840
|
-
if (imageLoadErrorCurrencyAddresses?.includes(
|
|
841
|
-
$listingPrice.currency.contractAddress.get()
|
|
842
|
-
)) {
|
|
843
|
-
return /* @__PURE__ */ jsx12(
|
|
844
|
-
Box7,
|
|
845
|
-
{
|
|
846
|
-
width: "3",
|
|
847
|
-
height: "3",
|
|
848
|
-
borderRadius: "circle",
|
|
849
|
-
background: "backgroundSecondary"
|
|
850
|
-
}
|
|
851
|
-
);
|
|
852
|
-
}
|
|
853
|
-
return /* @__PURE__ */ jsx12(
|
|
854
|
-
TokenImage2,
|
|
855
|
-
{
|
|
856
|
-
src: $listingPrice.currency.imageUrl.get(),
|
|
857
|
-
onError: () => {
|
|
858
|
-
const listingPrice = $listingPrice?.get();
|
|
859
|
-
if (listingPrice) {
|
|
860
|
-
setImageLoadErrorCurrencyAddresses((prev) => {
|
|
861
|
-
if (!prev)
|
|
862
|
-
return [listingPrice.currency.contractAddress];
|
|
863
|
-
if (!prev.includes(listingPrice.currency.contractAddress)) {
|
|
864
|
-
return [
|
|
865
|
-
...prev,
|
|
866
|
-
listingPrice.currency.contractAddress
|
|
867
|
-
];
|
|
868
|
-
}
|
|
869
|
-
return prev;
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
|
-
},
|
|
873
|
-
size: "xs"
|
|
874
|
-
}
|
|
875
|
-
);
|
|
876
|
-
}
|
|
877
|
-
var currencyImage_default = CurrencyImage;
|
|
878
|
-
|
|
879
897
|
// src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
880
|
-
import { jsx as
|
|
898
|
+
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
881
899
|
var PriceInput = observer5(function PriceInput2({
|
|
882
900
|
chainId,
|
|
883
901
|
collectionAddress,
|
|
884
902
|
$listingPrice,
|
|
903
|
+
onPriceChange,
|
|
885
904
|
checkBalance
|
|
886
905
|
}) {
|
|
887
906
|
const [balanceError, setBalanceError] = useState4("");
|
|
@@ -893,6 +912,16 @@ var PriceInput = observer5(function PriceInput2({
|
|
|
893
912
|
});
|
|
894
913
|
const currencyDecimals = $listingPrice.currency.decimals.get();
|
|
895
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
|
+
};
|
|
896
925
|
const checkInsufficientBalance = (priceAmountRaw) => {
|
|
897
926
|
const hasInsufficientBalance = isBalanceSuccess && priceAmountRaw && currencyDecimals && BigInt(priceAmountRaw) > (balance?.value || 0);
|
|
898
927
|
if (!checkBalance) return;
|
|
@@ -904,14 +933,14 @@ var PriceInput = observer5(function PriceInput2({
|
|
|
904
933
|
checkBalance.callback(false);
|
|
905
934
|
}
|
|
906
935
|
};
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
};
|
|
913
|
-
return /* @__PURE__ */
|
|
914
|
-
/* @__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(
|
|
915
944
|
Box8,
|
|
916
945
|
{
|
|
917
946
|
className: priceInputCurrencyImage,
|
|
@@ -919,17 +948,17 @@ var PriceInput = observer5(function PriceInput2({
|
|
|
919
948
|
left: "2",
|
|
920
949
|
display: "flex",
|
|
921
950
|
alignItems: "center",
|
|
922
|
-
children: /* @__PURE__ */
|
|
951
|
+
children: /* @__PURE__ */ jsx12(currencyImage_default, { $listingPrice })
|
|
923
952
|
}
|
|
924
953
|
),
|
|
925
|
-
/* @__PURE__ */
|
|
954
|
+
/* @__PURE__ */ jsx12(
|
|
926
955
|
NumericInput2,
|
|
927
956
|
{
|
|
928
957
|
name: "listingPrice",
|
|
929
958
|
decimals: currencyDecimals,
|
|
930
959
|
label: "Enter price",
|
|
931
960
|
labelLocation: "top",
|
|
932
|
-
controls: /* @__PURE__ */
|
|
961
|
+
controls: /* @__PURE__ */ jsx12(
|
|
933
962
|
currencyOptionsSelect_default,
|
|
934
963
|
{
|
|
935
964
|
selectedCurrency$: $listingPrice?.currency,
|
|
@@ -942,19 +971,30 @@ var PriceInput = observer5(function PriceInput2({
|
|
|
942
971
|
width: "full"
|
|
943
972
|
}
|
|
944
973
|
),
|
|
945
|
-
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
|
+
)
|
|
946
986
|
] });
|
|
947
987
|
});
|
|
948
988
|
var priceInput_default = PriceInput;
|
|
949
989
|
|
|
950
990
|
// src/react/ui/modals/_internal/components/tokenPreview/index.tsx
|
|
951
|
-
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";
|
|
952
992
|
|
|
953
993
|
// src/react/ui/images/chess-tile.png
|
|
954
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==";
|
|
955
995
|
|
|
956
996
|
// src/react/ui/modals/_internal/components/tokenPreview/index.tsx
|
|
957
|
-
import { jsx as
|
|
997
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
958
998
|
function TokenPreview({
|
|
959
999
|
collectionName,
|
|
960
1000
|
collectionAddress,
|
|
@@ -967,28 +1007,29 @@ function TokenPreview({
|
|
|
967
1007
|
collectibleId
|
|
968
1008
|
});
|
|
969
1009
|
if (collectibleLoading) {
|
|
970
|
-
return /* @__PURE__ */
|
|
971
|
-
/* @__PURE__ */
|
|
972
|
-
/* @__PURE__ */
|
|
973
|
-
/* @__PURE__ */
|
|
974
|
-
/* @__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" })
|
|
975
1015
|
] })
|
|
976
1016
|
] });
|
|
977
1017
|
}
|
|
978
|
-
return /* @__PURE__ */
|
|
979
|
-
/* @__PURE__ */
|
|
1018
|
+
return /* @__PURE__ */ jsxs7(Box9, { className: tokenPreview, children: [
|
|
1019
|
+
/* @__PURE__ */ jsx13(
|
|
980
1020
|
Image,
|
|
981
1021
|
{
|
|
982
1022
|
src: collectable?.image || chess_tile_default,
|
|
983
1023
|
alt: collectable?.name,
|
|
984
1024
|
width: "9",
|
|
985
1025
|
height: "9",
|
|
986
|
-
borderRadius: "xs"
|
|
1026
|
+
borderRadius: "xs",
|
|
1027
|
+
style: { objectFit: "cover" }
|
|
987
1028
|
}
|
|
988
1029
|
),
|
|
989
|
-
/* @__PURE__ */
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
-
|
|
1030
|
+
/* @__PURE__ */ jsxs7(Box9, { display: "flex", flexDirection: "column", marginLeft: "3", children: [
|
|
1031
|
+
/* @__PURE__ */ jsx13(
|
|
1032
|
+
Text6,
|
|
992
1033
|
{
|
|
993
1034
|
fontSize: "small",
|
|
994
1035
|
color: "text80",
|
|
@@ -997,8 +1038,8 @@ function TokenPreview({
|
|
|
997
1038
|
children: collectionName
|
|
998
1039
|
}
|
|
999
1040
|
),
|
|
1000
|
-
/* @__PURE__ */
|
|
1001
|
-
|
|
1041
|
+
/* @__PURE__ */ jsx13(
|
|
1042
|
+
Text6,
|
|
1002
1043
|
{
|
|
1003
1044
|
fontSize: "small",
|
|
1004
1045
|
fontWeight: "bold",
|
|
@@ -1012,15 +1053,16 @@ function TokenPreview({
|
|
|
1012
1053
|
}
|
|
1013
1054
|
|
|
1014
1055
|
// src/react/ui/modals/_internal/components/transactionDetails/index.tsx
|
|
1015
|
-
import { Box as Box10, Image as Image2, Skeleton as Skeleton4, Text as
|
|
1016
|
-
import { formatUnits as
|
|
1017
|
-
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";
|
|
1018
1059
|
var DEFAULT_MARKETPLACE_FEE_PERCENTAGE = 2.5;
|
|
1019
1060
|
function TransactionDetails({
|
|
1020
1061
|
collectibleId,
|
|
1021
1062
|
collectionAddress,
|
|
1022
1063
|
chainId,
|
|
1023
1064
|
price,
|
|
1065
|
+
showPlaceholderPrice,
|
|
1024
1066
|
currencyImageUrl
|
|
1025
1067
|
}) {
|
|
1026
1068
|
const { data, isLoading: marketplaceConfigLoading } = useMarketplaceConfig();
|
|
@@ -1033,14 +1075,14 @@ function TransactionDetails({
|
|
|
1033
1075
|
collectibleId
|
|
1034
1076
|
});
|
|
1035
1077
|
const priceLoading = !price || marketplaceConfigLoading || royaltyPercentageLoading;
|
|
1036
|
-
let formattedAmount = price &&
|
|
1037
|
-
if (royaltyPercentage !== void 0 && formattedAmount) {
|
|
1038
|
-
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);
|
|
1039
1081
|
}
|
|
1040
|
-
if (marketplaceFeePercentage !== void 0 && formattedAmount) {
|
|
1041
|
-
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);
|
|
1042
1084
|
}
|
|
1043
|
-
return /* @__PURE__ */
|
|
1085
|
+
return /* @__PURE__ */ jsxs8(
|
|
1044
1086
|
Box10,
|
|
1045
1087
|
{
|
|
1046
1088
|
width: "full",
|
|
@@ -1048,11 +1090,11 @@ function TransactionDetails({
|
|
|
1048
1090
|
justifyContent: "space-between",
|
|
1049
1091
|
alignItems: "center",
|
|
1050
1092
|
children: [
|
|
1051
|
-
/* @__PURE__ */
|
|
1052
|
-
/* @__PURE__ */
|
|
1053
|
-
/* @__PURE__ */
|
|
1054
|
-
priceLoading ? /* @__PURE__ */
|
|
1055
|
-
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,
|
|
1056
1098
|
" ",
|
|
1057
1099
|
price.currency.symbol
|
|
1058
1100
|
] })
|
|
@@ -1067,17 +1109,18 @@ import {
|
|
|
1067
1109
|
CloseIcon,
|
|
1068
1110
|
IconButton as IconButton2,
|
|
1069
1111
|
Skeleton as Skeleton6,
|
|
1070
|
-
Text as
|
|
1112
|
+
Text as Text11
|
|
1071
1113
|
} from "@0xsequence/design-system";
|
|
1114
|
+
import { TRANSACTION_CONFIRMATIONS_DEFAULT } from "@0xsequence/kit";
|
|
1072
1115
|
import { observer as observer7 } from "@legendapp/state/react";
|
|
1073
|
-
import { Close, Content as
|
|
1074
|
-
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";
|
|
1075
1118
|
import { WaitForTransactionReceiptTimeoutError } from "viem";
|
|
1076
1119
|
|
|
1077
1120
|
// src/react/ui/modals/_internal/components/transaction-footer/index.tsx
|
|
1078
1121
|
import { networks } from "@0xsequence/network";
|
|
1079
|
-
import { Box as Box11,
|
|
1080
|
-
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";
|
|
1081
1124
|
function TransactionFooter({
|
|
1082
1125
|
transactionHash,
|
|
1083
1126
|
orderId,
|
|
@@ -1087,13 +1130,13 @@ function TransactionFooter({
|
|
|
1087
1130
|
isTimeout,
|
|
1088
1131
|
chainId
|
|
1089
1132
|
}) {
|
|
1090
|
-
const icon = (isConfirmed || orderId) && /* @__PURE__ */
|
|
1133
|
+
const icon = (isConfirmed || orderId) && /* @__PURE__ */ jsx15(PositiveCircleIcon_default, { size: "md" }) || isConfirming && /* @__PURE__ */ jsx15(Spinner2, { size: "md" });
|
|
1091
1134
|
const title = (isConfirmed || orderId) && "Transaction complete" || isConfirming && "Processing transaction" || isFailed && "Transaction failed" || isTimeout && "Transaction took longer than expected";
|
|
1092
1135
|
const transactionUrl = `${networks[chainId]?.blockExplorer?.rootUrl}tx/${transactionHash}`;
|
|
1093
|
-
return /* @__PURE__ */
|
|
1136
|
+
return /* @__PURE__ */ jsxs9(Box11, { display: "flex", alignItems: "center", children: [
|
|
1094
1137
|
icon,
|
|
1095
|
-
/* @__PURE__ */
|
|
1096
|
-
|
|
1138
|
+
/* @__PURE__ */ jsx15(
|
|
1139
|
+
Text8,
|
|
1097
1140
|
{
|
|
1098
1141
|
color: "text50",
|
|
1099
1142
|
fontSize: "normal",
|
|
@@ -1103,7 +1146,7 @@ function TransactionFooter({
|
|
|
1103
1146
|
children: title
|
|
1104
1147
|
}
|
|
1105
1148
|
),
|
|
1106
|
-
/* @__PURE__ */
|
|
1149
|
+
/* @__PURE__ */ jsx15(
|
|
1107
1150
|
Box11,
|
|
1108
1151
|
{
|
|
1109
1152
|
as: "a",
|
|
@@ -1114,8 +1157,8 @@ function TransactionFooter({
|
|
|
1114
1157
|
rel: "noopener noreferrer",
|
|
1115
1158
|
textAlign: "right",
|
|
1116
1159
|
textDecoration: "none",
|
|
1117
|
-
children: /* @__PURE__ */
|
|
1118
|
-
|
|
1160
|
+
children: /* @__PURE__ */ jsx15(
|
|
1161
|
+
Text8,
|
|
1119
1162
|
{
|
|
1120
1163
|
color: "polygonLight",
|
|
1121
1164
|
textAlign: "right",
|
|
@@ -1136,32 +1179,32 @@ import {
|
|
|
1136
1179
|
Image as Image3,
|
|
1137
1180
|
NetworkImage,
|
|
1138
1181
|
Skeleton as Skeleton5,
|
|
1139
|
-
Text as
|
|
1182
|
+
Text as Text10
|
|
1140
1183
|
} from "@0xsequence/design-system";
|
|
1141
1184
|
import { observer as observer6 } from "@legendapp/state/react";
|
|
1142
|
-
import { formatUnits as
|
|
1185
|
+
import { formatUnits as formatUnits3 } from "viem";
|
|
1143
1186
|
|
|
1144
1187
|
// src/react/ui/modals/_internal/components/timeAgo/index.tsx
|
|
1145
|
-
import { Box as Box12, Text as
|
|
1188
|
+
import { Box as Box12, Text as Text9 } from "@0xsequence/design-system";
|
|
1146
1189
|
import { formatDistanceToNow } from "date-fns";
|
|
1147
|
-
import { useEffect as
|
|
1148
|
-
import { jsx as
|
|
1190
|
+
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
1191
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1149
1192
|
function TimeAgo({ date }) {
|
|
1150
1193
|
const [timeAgo, setTimeAgo] = useState5("");
|
|
1151
|
-
|
|
1194
|
+
useEffect4(() => {
|
|
1152
1195
|
const interval = setInterval(() => {
|
|
1153
1196
|
setTimeAgo(formatDistanceToNow(date));
|
|
1154
1197
|
}, 1e3);
|
|
1155
1198
|
return () => clearInterval(interval);
|
|
1156
1199
|
}, [date]);
|
|
1157
|
-
return /* @__PURE__ */
|
|
1200
|
+
return /* @__PURE__ */ jsx16(
|
|
1158
1201
|
Box12,
|
|
1159
1202
|
{
|
|
1160
1203
|
flexGrow: "1",
|
|
1161
1204
|
display: "flex",
|
|
1162
1205
|
alignItems: "center",
|
|
1163
1206
|
justifyContent: "flex-end",
|
|
1164
|
-
children: /* @__PURE__ */
|
|
1207
|
+
children: /* @__PURE__ */ jsx16(Text9, { color: "text50", fontSize: "small", children: timeAgo })
|
|
1165
1208
|
}
|
|
1166
1209
|
);
|
|
1167
1210
|
}
|
|
@@ -1268,7 +1311,7 @@ function useTransactionPreviewTitle(orderId, status, type) {
|
|
|
1268
1311
|
}
|
|
1269
1312
|
|
|
1270
1313
|
// src/react/ui/modals/_internal/components/transactionPreview/index.tsx
|
|
1271
|
-
import { jsx as
|
|
1314
|
+
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1272
1315
|
var TransactionPreview = observer6(
|
|
1273
1316
|
({
|
|
1274
1317
|
orderId,
|
|
@@ -1296,14 +1339,14 @@ var TransactionPreview = observer6(
|
|
|
1296
1339
|
const collectibleImage2 = collectible?.image;
|
|
1297
1340
|
const collectibleName = collectible?.name;
|
|
1298
1341
|
const collectionName = collection?.name;
|
|
1299
|
-
const priceFormatted = price ?
|
|
1342
|
+
const priceFormatted = price ? formatUnits3(BigInt(price?.amountRaw), price?.currency.decimals) : void 0;
|
|
1300
1343
|
if (collectibleLoading || collectionLoading) {
|
|
1301
|
-
return /* @__PURE__ */
|
|
1344
|
+
return /* @__PURE__ */ jsx17(Box13, { style: { height: 83 }, width: "full", borderRadius: "md", children: /* @__PURE__ */ jsx17(Skeleton5, { style: { width: "100%", height: "100%" } }) });
|
|
1302
1345
|
}
|
|
1303
|
-
return /* @__PURE__ */
|
|
1304
|
-
/* @__PURE__ */
|
|
1305
|
-
/* @__PURE__ */
|
|
1306
|
-
|
|
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,
|
|
1307
1350
|
{
|
|
1308
1351
|
color: "text50",
|
|
1309
1352
|
fontSize: "small",
|
|
@@ -1313,11 +1356,11 @@ var TransactionPreview = observer6(
|
|
|
1313
1356
|
children: title
|
|
1314
1357
|
}
|
|
1315
1358
|
),
|
|
1316
|
-
/* @__PURE__ */
|
|
1317
|
-
isConfirming && /* @__PURE__ */
|
|
1359
|
+
/* @__PURE__ */ jsx17(NetworkImage, { chainId: Number(chainId), size: "xs" }),
|
|
1360
|
+
isConfirming && /* @__PURE__ */ jsx17(TimeAgo, { date: /* @__PURE__ */ new Date() })
|
|
1318
1361
|
] }),
|
|
1319
|
-
/* @__PURE__ */
|
|
1320
|
-
/* @__PURE__ */
|
|
1362
|
+
/* @__PURE__ */ jsxs10(Box13, { display: "flex", alignItems: "center", marginTop: "2", children: [
|
|
1363
|
+
/* @__PURE__ */ jsx17(
|
|
1321
1364
|
Image3,
|
|
1322
1365
|
{
|
|
1323
1366
|
src: collectibleImage2 || chess_tile_default,
|
|
@@ -1329,7 +1372,7 @@ var TransactionPreview = observer6(
|
|
|
1329
1372
|
style: { objectFit: "cover" }
|
|
1330
1373
|
}
|
|
1331
1374
|
),
|
|
1332
|
-
/* @__PURE__ */
|
|
1375
|
+
/* @__PURE__ */ jsxs10(
|
|
1333
1376
|
Box13,
|
|
1334
1377
|
{
|
|
1335
1378
|
display: "flex",
|
|
@@ -1337,8 +1380,8 @@ var TransactionPreview = observer6(
|
|
|
1337
1380
|
alignItems: "flex-start",
|
|
1338
1381
|
gap: "0.5",
|
|
1339
1382
|
children: [
|
|
1340
|
-
/* @__PURE__ */
|
|
1341
|
-
|
|
1383
|
+
/* @__PURE__ */ jsx17(
|
|
1384
|
+
Text10,
|
|
1342
1385
|
{
|
|
1343
1386
|
color: "text80",
|
|
1344
1387
|
fontSize: "small",
|
|
@@ -1347,11 +1390,11 @@ var TransactionPreview = observer6(
|
|
|
1347
1390
|
children: collectibleName
|
|
1348
1391
|
}
|
|
1349
1392
|
),
|
|
1350
|
-
/* @__PURE__ */
|
|
1393
|
+
/* @__PURE__ */ jsx17(Text10, { color: "text100", fontSize: "small", fontFamily: "body", children: collectionName })
|
|
1351
1394
|
]
|
|
1352
1395
|
}
|
|
1353
1396
|
),
|
|
1354
|
-
price && /* @__PURE__ */
|
|
1397
|
+
price && /* @__PURE__ */ jsxs10(
|
|
1355
1398
|
Box13,
|
|
1356
1399
|
{
|
|
1357
1400
|
flexGrow: "1",
|
|
@@ -1360,9 +1403,9 @@ var TransactionPreview = observer6(
|
|
|
1360
1403
|
justifyContent: "flex-end",
|
|
1361
1404
|
gap: "1",
|
|
1362
1405
|
children: [
|
|
1363
|
-
/* @__PURE__ */
|
|
1364
|
-
/* @__PURE__ */
|
|
1365
|
-
|
|
1406
|
+
/* @__PURE__ */ jsx17(Image3, { src: currencyImageUrl, width: "3", height: "3" }),
|
|
1407
|
+
/* @__PURE__ */ jsxs10(
|
|
1408
|
+
Text10,
|
|
1366
1409
|
{
|
|
1367
1410
|
color: "text80",
|
|
1368
1411
|
fontSize: "small",
|
|
@@ -1371,7 +1414,7 @@ var TransactionPreview = observer6(
|
|
|
1371
1414
|
children: [
|
|
1372
1415
|
priceFormatted,
|
|
1373
1416
|
" ",
|
|
1374
|
-
price
|
|
1417
|
+
price?.currency.symbol
|
|
1375
1418
|
]
|
|
1376
1419
|
}
|
|
1377
1420
|
)
|
|
@@ -1389,9 +1432,6 @@ var closeButton3 = "fyvr11lw fyvr1tc fyvr1mo";
|
|
|
1389
1432
|
var dialogOverlay3 = "fyvr1m0 fyvr1o8 fyvr1qg fyvr1so fyvr11xl fyvr11m0 fyvr11rs";
|
|
1390
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";
|
|
1391
1434
|
|
|
1392
|
-
// src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
|
|
1393
|
-
import { TRANSACTION_CONFIRMATIONS_DEFAULT } from "@0xsequence/kit";
|
|
1394
|
-
|
|
1395
1435
|
// src/react/ui/modals/_internal/components/transactionStatusModal/util/getFormattedType.ts
|
|
1396
1436
|
function getFormattedType(transactionType, verb = false) {
|
|
1397
1437
|
switch (transactionType) {
|
|
@@ -1412,56 +1452,59 @@ function getFormattedType(transactionType, verb = false) {
|
|
|
1412
1452
|
}
|
|
1413
1453
|
}
|
|
1414
1454
|
|
|
1415
|
-
// src/react/ui/modals/_internal/components/transactionStatusModal/util/
|
|
1416
|
-
function
|
|
1455
|
+
// src/react/ui/modals/_internal/components/transactionStatusModal/util/getMessage.ts
|
|
1456
|
+
function getTransactionStatusModalMessage({
|
|
1417
1457
|
transactionStatus,
|
|
1418
1458
|
transactionType,
|
|
1459
|
+
collectibleName,
|
|
1419
1460
|
orderId
|
|
1420
1461
|
}) {
|
|
1462
|
+
const hideCollectibleName = transactionType === "CANCEL";
|
|
1421
1463
|
if (orderId) {
|
|
1422
|
-
return `
|
|
1464
|
+
return `You just ${getFormattedType(transactionType, true)}${!hideCollectibleName ? ` ${collectibleName}` : ""}. It's been confirmed on the blockchain!`;
|
|
1423
1465
|
}
|
|
1424
1466
|
switch (transactionStatus) {
|
|
1425
1467
|
case "PENDING":
|
|
1426
|
-
return `
|
|
1468
|
+
return `You just ${getFormattedType(transactionType, true)}${!hideCollectibleName ? ` ${collectibleName}` : ""}. It should be confirmed on the blockchain shortly.`;
|
|
1427
1469
|
case "SUCCESS":
|
|
1428
|
-
return `
|
|
1470
|
+
return `You just ${getFormattedType(transactionType, true)}${!hideCollectibleName ? ` ${collectibleName}` : ""}. It\u2019s been confirmed on the blockchain!`;
|
|
1429
1471
|
case "FAILED":
|
|
1430
|
-
return `Your ${getFormattedType(transactionType)} has failed
|
|
1472
|
+
return `Your ${getFormattedType(transactionType)} has failed.`;
|
|
1431
1473
|
case "TIMEOUT":
|
|
1432
|
-
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.`;
|
|
1433
1475
|
default:
|
|
1434
1476
|
return "Your transaction is processing";
|
|
1435
1477
|
}
|
|
1436
1478
|
}
|
|
1437
1479
|
|
|
1438
|
-
// src/react/ui/modals/_internal/components/transactionStatusModal/util/
|
|
1439
|
-
function
|
|
1480
|
+
// src/react/ui/modals/_internal/components/transactionStatusModal/util/getTitle.ts
|
|
1481
|
+
function getTransactionStatusModalTitle({
|
|
1440
1482
|
transactionStatus,
|
|
1441
1483
|
transactionType,
|
|
1442
|
-
collectibleName,
|
|
1443
1484
|
orderId
|
|
1444
1485
|
}) {
|
|
1445
|
-
|
|
1486
|
+
if (transactionType === void 0) {
|
|
1487
|
+
return "";
|
|
1488
|
+
}
|
|
1446
1489
|
if (orderId) {
|
|
1447
|
-
return `
|
|
1490
|
+
return `Your ${getFormattedType(transactionType)} has processed`;
|
|
1448
1491
|
}
|
|
1449
1492
|
switch (transactionStatus) {
|
|
1450
1493
|
case "PENDING":
|
|
1451
|
-
return `
|
|
1494
|
+
return `Your ${getFormattedType(transactionType)} is processing`;
|
|
1452
1495
|
case "SUCCESS":
|
|
1453
|
-
return `
|
|
1496
|
+
return `Your ${getFormattedType(transactionType)} has processed`;
|
|
1454
1497
|
case "FAILED":
|
|
1455
|
-
return `Your ${getFormattedType(transactionType)} has failed
|
|
1498
|
+
return `Your ${getFormattedType(transactionType)} has failed`;
|
|
1456
1499
|
case "TIMEOUT":
|
|
1457
|
-
return `Your ${getFormattedType(transactionType)} takes too long
|
|
1500
|
+
return `Your ${getFormattedType(transactionType)} takes too long`;
|
|
1458
1501
|
default:
|
|
1459
1502
|
return "Your transaction is processing";
|
|
1460
1503
|
}
|
|
1461
1504
|
}
|
|
1462
1505
|
|
|
1463
1506
|
// src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
|
|
1464
|
-
import { jsx as
|
|
1507
|
+
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1465
1508
|
var useTransactionStatusModal = () => {
|
|
1466
1509
|
return {
|
|
1467
1510
|
show: (args) => {
|
|
@@ -1492,33 +1535,25 @@ var TransactionStatusModal = observer7(() => {
|
|
|
1492
1535
|
const [transactionStatus, setTransactionStatus] = useState6(
|
|
1493
1536
|
orderId ? "SUCCESS" : "PENDING"
|
|
1494
1537
|
);
|
|
1495
|
-
|
|
1496
|
-
transactionStatus,
|
|
1497
|
-
transactionType: type,
|
|
1498
|
-
orderId
|
|
1499
|
-
});
|
|
1500
|
-
const message = getTransactionStatusModalMessage({
|
|
1501
|
-
transactionStatus,
|
|
1502
|
-
transactionType: type,
|
|
1503
|
-
collectibleName: collectible?.name || "",
|
|
1504
|
-
orderId
|
|
1505
|
-
});
|
|
1506
|
-
const { onError, onSuccess } = callbacks || {};
|
|
1507
|
-
const queryClient = getQueryClient();
|
|
1508
|
-
const publicClient = chainId ? getPublicRpcClient(chainId) : null;
|
|
1509
|
-
const waitForTransactionReceiptPromise = publicClient?.waitForTransactionReceipt({
|
|
1510
|
-
confirmations: confirmations || TRANSACTION_CONFIRMATIONS_DEFAULT,
|
|
1511
|
-
hash
|
|
1512
|
-
});
|
|
1513
|
-
useEffect4(() => {
|
|
1538
|
+
useEffect5(() => {
|
|
1514
1539
|
if (!transactionStatusModal$.isOpen.get()) return;
|
|
1515
1540
|
console.log("Waiting for transaction receipt ...");
|
|
1516
1541
|
waitForTransactionReceiptPromise?.then((receipt) => {
|
|
1517
1542
|
if (receipt.status === "success") {
|
|
1518
1543
|
console.log("receipt", receipt);
|
|
1519
1544
|
setTransactionStatus("SUCCESS");
|
|
1545
|
+
if (callbacks?.onSuccess) {
|
|
1546
|
+
callbacks.onSuccess(hash || "0x");
|
|
1547
|
+
} else {
|
|
1548
|
+
console.debug("onSuccess callback not provided:", hash);
|
|
1549
|
+
}
|
|
1520
1550
|
}
|
|
1521
1551
|
}).catch((error) => {
|
|
1552
|
+
if (callbacks?.onError) {
|
|
1553
|
+
callbacks.onError(error);
|
|
1554
|
+
} else {
|
|
1555
|
+
console.debug("onError callback not provided:", error);
|
|
1556
|
+
}
|
|
1522
1557
|
if (error instanceof WaitForTransactionReceiptTimeoutError) {
|
|
1523
1558
|
setTransactionStatus("TIMEOUT");
|
|
1524
1559
|
return;
|
|
@@ -1531,12 +1566,36 @@ var TransactionStatusModal = observer7(() => {
|
|
|
1531
1566
|
return () => {
|
|
1532
1567
|
setTransactionStatus("PENDING");
|
|
1533
1568
|
};
|
|
1534
|
-
}, [
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
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,
|
|
1540
1599
|
{
|
|
1541
1600
|
fontSize: "large",
|
|
1542
1601
|
fontWeight: "bold",
|
|
@@ -1544,9 +1603,9 @@ var TransactionStatusModal = observer7(() => {
|
|
|
1544
1603
|
fontFamily: "body",
|
|
1545
1604
|
children: title
|
|
1546
1605
|
}
|
|
1547
|
-
) : /* @__PURE__ */
|
|
1548
|
-
message ? /* @__PURE__ */
|
|
1549
|
-
/* @__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(
|
|
1550
1609
|
transactionPreview_default,
|
|
1551
1610
|
{
|
|
1552
1611
|
orderId,
|
|
@@ -1562,7 +1621,7 @@ var TransactionStatusModal = observer7(() => {
|
|
|
1562
1621
|
isTimeout: transactionStatus === "TIMEOUT"
|
|
1563
1622
|
}
|
|
1564
1623
|
),
|
|
1565
|
-
/* @__PURE__ */
|
|
1624
|
+
/* @__PURE__ */ jsx18(
|
|
1566
1625
|
TransactionFooter,
|
|
1567
1626
|
{
|
|
1568
1627
|
transactionHash: hash,
|
|
@@ -1574,7 +1633,7 @@ var TransactionStatusModal = observer7(() => {
|
|
|
1574
1633
|
chainId
|
|
1575
1634
|
}
|
|
1576
1635
|
),
|
|
1577
|
-
/* @__PURE__ */
|
|
1636
|
+
/* @__PURE__ */ jsx18(
|
|
1578
1637
|
Close,
|
|
1579
1638
|
{
|
|
1580
1639
|
onClick: () => {
|
|
@@ -1582,7 +1641,7 @@ var TransactionStatusModal = observer7(() => {
|
|
|
1582
1641
|
},
|
|
1583
1642
|
className: closeButton3,
|
|
1584
1643
|
asChild: true,
|
|
1585
|
-
children: /* @__PURE__ */
|
|
1644
|
+
children: /* @__PURE__ */ jsx18(IconButton2, { size: "xs", "aria-label": "Close modal", icon: CloseIcon })
|
|
1586
1645
|
}
|
|
1587
1646
|
)
|
|
1588
1647
|
] })
|
|
@@ -1602,9 +1661,12 @@ var initialState3 = {
|
|
|
1602
1661
|
collectionName: "",
|
|
1603
1662
|
collectionType: void 0,
|
|
1604
1663
|
listingPrice: {
|
|
1605
|
-
|
|
1664
|
+
// to see if approval is needed when modal opens
|
|
1665
|
+
amountRaw: "1",
|
|
1606
1666
|
currency: {}
|
|
1607
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,
|
|
1608
1670
|
quantity: "1",
|
|
1609
1671
|
invalidQuantity: false,
|
|
1610
1672
|
expiry: new Date(addDays2(/* @__PURE__ */ new Date(), 7).toJSON()),
|
|
@@ -1629,7 +1691,7 @@ var initialState3 = {
|
|
|
1629
1691
|
var createListingModal$ = observable4(initialState3);
|
|
1630
1692
|
|
|
1631
1693
|
// src/react/ui/modals/CreateListingModal/index.tsx
|
|
1632
|
-
import { jsx as
|
|
1694
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1633
1695
|
var useCreateListingModal = (callbacks) => {
|
|
1634
1696
|
return {
|
|
1635
1697
|
show: (args) => createListingModal$.open({ ...args, defaultCallbacks: callbacks }),
|
|
@@ -1638,7 +1700,7 @@ var useCreateListingModal = (callbacks) => {
|
|
|
1638
1700
|
};
|
|
1639
1701
|
var CreateListingModal = () => {
|
|
1640
1702
|
const { show: showTransactionStatusModal } = useTransactionStatusModal();
|
|
1641
|
-
return /* @__PURE__ */
|
|
1703
|
+
return /* @__PURE__ */ jsx19(Show2, { if: createListingModal$.isOpen, children: /* @__PURE__ */ jsx19(Modal2, { showTransactionStatusModal }) });
|
|
1642
1704
|
};
|
|
1643
1705
|
var Modal2 = observer8(
|
|
1644
1706
|
({
|
|
@@ -1649,9 +1711,12 @@ var Modal2 = observer8(
|
|
|
1649
1711
|
collectionAddress,
|
|
1650
1712
|
chainId,
|
|
1651
1713
|
listingPrice,
|
|
1714
|
+
listingPriceChanged,
|
|
1652
1715
|
collectibleId,
|
|
1653
|
-
orderbookKind
|
|
1716
|
+
orderbookKind,
|
|
1717
|
+
callbacks
|
|
1654
1718
|
} = state;
|
|
1719
|
+
const currencyAddress = listingPrice.currency.contractAddress;
|
|
1655
1720
|
const {
|
|
1656
1721
|
data: collectible,
|
|
1657
1722
|
isLoading: collectableIsLoading,
|
|
@@ -1669,17 +1734,21 @@ var Modal2 = observer8(
|
|
|
1669
1734
|
chainId,
|
|
1670
1735
|
collectionAddress
|
|
1671
1736
|
});
|
|
1737
|
+
const [approvalExecutedSuccess, setApprovalExecutedSuccess] = useState7(false);
|
|
1672
1738
|
const { address } = useAccount3();
|
|
1673
1739
|
const { data: balance } = useBalanceOfCollectible({
|
|
1674
1740
|
chainId,
|
|
1675
1741
|
collectionAddress,
|
|
1676
1742
|
collectableId: collectibleId,
|
|
1677
|
-
userAddress: address
|
|
1743
|
+
userAddress: address ?? void 0
|
|
1678
1744
|
});
|
|
1679
|
-
const { getListingSteps, isLoading: machineLoading } = useCreateListing({
|
|
1745
|
+
const { getListingSteps, isLoading: machineLoading, createListing } = useCreateListing({
|
|
1680
1746
|
orderbookKind,
|
|
1681
1747
|
chainId,
|
|
1682
1748
|
collectionAddress,
|
|
1749
|
+
enabled: createListingModal$.isOpen.get(),
|
|
1750
|
+
onSwitchChainRefused: () => createListingModal$.close(),
|
|
1751
|
+
onApprovalSuccess: () => setApprovalExecutedSuccess(true),
|
|
1683
1752
|
onTransactionSent: (hash, orderId) => {
|
|
1684
1753
|
if (!hash && !orderId) return;
|
|
1685
1754
|
showTransactionStatusModal({
|
|
@@ -1690,42 +1759,46 @@ var Modal2 = observer8(
|
|
|
1690
1759
|
price: createListingModal$.listingPrice.get(),
|
|
1691
1760
|
collectibleId,
|
|
1692
1761
|
type: "LISTING" /* LISTING */,
|
|
1693
|
-
queriesToInvalidate: collectableKeys.all
|
|
1762
|
+
queriesToInvalidate: collectableKeys.all,
|
|
1763
|
+
callbacks
|
|
1694
1764
|
});
|
|
1695
1765
|
createListingModal$.close();
|
|
1696
|
-
},
|
|
1697
|
-
onError: (error) => {
|
|
1698
|
-
if (typeof createListingModal$.callbacks?.onError === "function") {
|
|
1699
|
-
createListingModal$.onError(error);
|
|
1700
|
-
} else {
|
|
1701
|
-
console.debug("onError callback not provided:", error);
|
|
1702
|
-
}
|
|
1703
1766
|
}
|
|
1704
1767
|
});
|
|
1768
|
+
useEffect6(() => {
|
|
1769
|
+
if (!currencyAddress) return;
|
|
1770
|
+
refreshSteps();
|
|
1771
|
+
}, [currencyAddress]);
|
|
1705
1772
|
const handleStepExecution = async (execute) => {
|
|
1706
1773
|
if (!execute) return;
|
|
1707
1774
|
try {
|
|
1708
1775
|
await refreshSteps();
|
|
1709
1776
|
await execute();
|
|
1710
1777
|
} catch (error) {
|
|
1711
|
-
|
|
1778
|
+
if (callbacks?.onError) {
|
|
1779
|
+
callbacks.onError(error);
|
|
1780
|
+
} else {
|
|
1781
|
+
console.debug("onError callback not provided:", error);
|
|
1782
|
+
}
|
|
1712
1783
|
}
|
|
1713
1784
|
};
|
|
1714
1785
|
if (collectableIsLoading || collectionIsLoading || machineLoading) {
|
|
1715
|
-
return /* @__PURE__ */
|
|
1786
|
+
return /* @__PURE__ */ jsx19(
|
|
1716
1787
|
LoadingModal,
|
|
1717
1788
|
{
|
|
1718
|
-
|
|
1789
|
+
isOpen: createListingModal$.isOpen.get(),
|
|
1790
|
+
chainId: Number(chainId),
|
|
1719
1791
|
onClose: createListingModal$.close,
|
|
1720
1792
|
title: "List item for sale"
|
|
1721
1793
|
}
|
|
1722
1794
|
);
|
|
1723
1795
|
}
|
|
1724
1796
|
if (collectableIsError || collectionIsError) {
|
|
1725
|
-
return /* @__PURE__ */
|
|
1797
|
+
return /* @__PURE__ */ jsx19(
|
|
1726
1798
|
ErrorModal,
|
|
1727
1799
|
{
|
|
1728
|
-
|
|
1800
|
+
isOpen: createListingModal$.isOpen.get(),
|
|
1801
|
+
chainId: Number(chainId),
|
|
1729
1802
|
onClose: createListingModal$.close,
|
|
1730
1803
|
title: "List item for sale"
|
|
1731
1804
|
}
|
|
@@ -1733,7 +1806,7 @@ var Modal2 = observer8(
|
|
|
1733
1806
|
}
|
|
1734
1807
|
const dateToUnixTime = (date) => Math.floor(date.getTime() / 1e3).toString();
|
|
1735
1808
|
const { isLoading, steps, refreshSteps } = getListingSteps({
|
|
1736
|
-
contractType: collection
|
|
1809
|
+
contractType: collection?.type,
|
|
1737
1810
|
listing: {
|
|
1738
1811
|
tokenId: collectibleId,
|
|
1739
1812
|
quantity: parseUnits3(
|
|
@@ -1745,31 +1818,45 @@ var Modal2 = observer8(
|
|
|
1745
1818
|
pricePerToken: listingPrice.amountRaw
|
|
1746
1819
|
}
|
|
1747
1820
|
});
|
|
1821
|
+
const approvalNeeded = steps?.approval.isPending;
|
|
1748
1822
|
const ctas = [
|
|
1749
1823
|
{
|
|
1750
1824
|
label: "Approve TOKEN",
|
|
1751
1825
|
onClick: () => handleStepExecution(() => steps?.approval.execute()),
|
|
1752
|
-
hidden: !
|
|
1753
|
-
pending: steps?.approval.isExecuting,
|
|
1826
|
+
hidden: !approvalNeeded || approvalExecutedSuccess,
|
|
1827
|
+
pending: steps?.approval.isExecuting || isLoading,
|
|
1754
1828
|
variant: "glass",
|
|
1755
|
-
disabled: createListingModal$.invalidQuantity.get()
|
|
1829
|
+
disabled: createListingModal$.invalidQuantity.get() || isLoading || !listingPriceChanged || listingPrice.amountRaw === "0" || steps?.transaction.isExecuting
|
|
1756
1830
|
},
|
|
1757
1831
|
{
|
|
1758
1832
|
label: "List item for sale",
|
|
1759
|
-
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
|
+
}),
|
|
1760
1846
|
pending: steps?.transaction.isExecuting || isLoading,
|
|
1761
|
-
disabled:
|
|
1847
|
+
disabled: !approvalExecutedSuccess && approvalNeeded || listingPrice.amountRaw === "0" || isLoading || createListingModal$.invalidQuantity.get() || !listingPriceChanged
|
|
1762
1848
|
}
|
|
1763
1849
|
];
|
|
1764
|
-
return /* @__PURE__ */
|
|
1850
|
+
return /* @__PURE__ */ jsxs12(
|
|
1765
1851
|
ActionModal,
|
|
1766
1852
|
{
|
|
1767
|
-
|
|
1853
|
+
isOpen: createListingModal$.isOpen.get(),
|
|
1854
|
+
chainId: Number(chainId),
|
|
1768
1855
|
onClose: () => createListingModal$.close(),
|
|
1769
1856
|
title: "List item for sale",
|
|
1770
1857
|
ctas,
|
|
1771
1858
|
children: [
|
|
1772
|
-
/* @__PURE__ */
|
|
1859
|
+
/* @__PURE__ */ jsx19(
|
|
1773
1860
|
TokenPreview,
|
|
1774
1861
|
{
|
|
1775
1862
|
collectionName: collection?.name,
|
|
@@ -1778,16 +1865,17 @@ var Modal2 = observer8(
|
|
|
1778
1865
|
chainId
|
|
1779
1866
|
}
|
|
1780
1867
|
),
|
|
1781
|
-
/* @__PURE__ */
|
|
1782
|
-
/* @__PURE__ */
|
|
1868
|
+
/* @__PURE__ */ jsxs12(Box14, { display: "flex", flexDirection: "column", width: "full", gap: "1", children: [
|
|
1869
|
+
/* @__PURE__ */ jsx19(
|
|
1783
1870
|
priceInput_default,
|
|
1784
1871
|
{
|
|
1785
1872
|
chainId,
|
|
1786
1873
|
collectionAddress,
|
|
1787
|
-
$listingPrice: createListingModal$.listingPrice
|
|
1874
|
+
$listingPrice: createListingModal$.listingPrice,
|
|
1875
|
+
onPriceChange: () => createListingModal$.listingPriceChanged.set(true)
|
|
1788
1876
|
}
|
|
1789
1877
|
),
|
|
1790
|
-
|
|
1878
|
+
listingPrice.amountRaw !== "0" && listingPriceChanged && /* @__PURE__ */ jsx19(
|
|
1791
1879
|
FloorPriceText,
|
|
1792
1880
|
{
|
|
1793
1881
|
tokenId: collectibleId,
|
|
@@ -1797,7 +1885,7 @@ var Modal2 = observer8(
|
|
|
1797
1885
|
}
|
|
1798
1886
|
)
|
|
1799
1887
|
] }),
|
|
1800
|
-
collection?.type === "ERC1155" && balance && /* @__PURE__ */
|
|
1888
|
+
collection?.type === "ERC1155" && balance && /* @__PURE__ */ jsx19(
|
|
1801
1889
|
QuantityInput,
|
|
1802
1890
|
{
|
|
1803
1891
|
$quantity: createListingModal$.quantity,
|
|
@@ -1806,14 +1894,15 @@ var Modal2 = observer8(
|
|
|
1806
1894
|
maxQuantity: balance?.balance
|
|
1807
1895
|
}
|
|
1808
1896
|
),
|
|
1809
|
-
/* @__PURE__ */
|
|
1810
|
-
/* @__PURE__ */
|
|
1897
|
+
/* @__PURE__ */ jsx19(expirationDateSelect_default, { $date: createListingModal$.expiry }),
|
|
1898
|
+
/* @__PURE__ */ jsx19(
|
|
1811
1899
|
TransactionDetails,
|
|
1812
1900
|
{
|
|
1813
1901
|
collectibleId,
|
|
1814
1902
|
collectionAddress,
|
|
1815
1903
|
chainId,
|
|
1816
1904
|
price: createListingModal$.listingPrice.get(),
|
|
1905
|
+
showPlaceholderPrice: !listingPriceChanged,
|
|
1817
1906
|
currencyImageUrl: listingPrice.currency.imageUrl
|
|
1818
1907
|
}
|
|
1819
1908
|
)
|
|
@@ -1825,28 +1914,45 @@ var Modal2 = observer8(
|
|
|
1825
1914
|
|
|
1826
1915
|
// src/react/ui/modals/MakeOfferModal/index.tsx
|
|
1827
1916
|
import { Show as Show3, observer as observer9 } from "@legendapp/state/react";
|
|
1828
|
-
import { useEffect as
|
|
1917
|
+
import { useEffect as useEffect7, useState as useState9 } from "react";
|
|
1829
1918
|
import { parseUnits as parseUnits4 } from "viem";
|
|
1830
1919
|
|
|
1831
1920
|
// src/react/hooks/useMakeOffer.tsx
|
|
1832
|
-
import { useCallback as useCallback2, useState as
|
|
1921
|
+
import { useCallback as useCallback2, useState as useState8 } from "react";
|
|
1833
1922
|
var useMakeOffer = ({
|
|
1834
1923
|
onSuccess,
|
|
1835
1924
|
onError,
|
|
1836
1925
|
onTransactionSent,
|
|
1926
|
+
onApprovalSuccess,
|
|
1927
|
+
onSwitchChainRefused,
|
|
1928
|
+
enabled,
|
|
1837
1929
|
...config
|
|
1838
1930
|
}) => {
|
|
1839
|
-
const [isLoading, setIsLoading] =
|
|
1840
|
-
const [steps, setSteps] =
|
|
1841
|
-
const
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
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);
|
|
1845
1944
|
},
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
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
|
+
});
|
|
1850
1956
|
const loadSteps = useCallback2(
|
|
1851
1957
|
async (props) => {
|
|
1852
1958
|
if (!machine) return;
|
|
@@ -1856,16 +1962,51 @@ var useMakeOffer = ({
|
|
|
1856
1962
|
setIsLoading(false);
|
|
1857
1963
|
return;
|
|
1858
1964
|
}
|
|
1859
|
-
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
|
+
});
|
|
1860
1976
|
setIsLoading(false);
|
|
1861
1977
|
},
|
|
1862
|
-
[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
|
+
[]
|
|
1863
1992
|
);
|
|
1864
1993
|
return {
|
|
1865
1994
|
makeOffer: (props) => machine?.start(props),
|
|
1866
1995
|
getMakeOfferSteps: (props) => ({
|
|
1867
1996
|
isLoading,
|
|
1868
|
-
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,
|
|
1869
2010
|
refreshSteps: () => loadSteps(props)
|
|
1870
2011
|
}),
|
|
1871
2012
|
isLoading: isMachineLoading
|
|
@@ -1880,12 +2021,14 @@ var initialState4 = {
|
|
|
1880
2021
|
collectionAddress: "",
|
|
1881
2022
|
chainId: "",
|
|
1882
2023
|
collectibleId: "",
|
|
1883
|
-
orderbookKind: "
|
|
2024
|
+
orderbookKind: "reservoir" /* reservoir */,
|
|
1884
2025
|
callbacks: void 0,
|
|
1885
2026
|
offerPrice: {
|
|
1886
2027
|
amountRaw: "1",
|
|
1887
2028
|
currency: {}
|
|
1888
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,
|
|
1889
2032
|
quantity: "1",
|
|
1890
2033
|
invalidQuantity: false,
|
|
1891
2034
|
expiry: new Date(addDays3(/* @__PURE__ */ new Date(), 7).toJSON()),
|
|
@@ -1905,14 +2048,14 @@ var initialState4 = {
|
|
|
1905
2048
|
var makeOfferModal$ = observable5(initialState4);
|
|
1906
2049
|
|
|
1907
2050
|
// src/react/ui/modals/MakeOfferModal/index.tsx
|
|
1908
|
-
import { jsx as
|
|
2051
|
+
import { Fragment, jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1909
2052
|
var useMakeOfferModal = (defaultCallbacks) => ({
|
|
1910
2053
|
show: (args) => makeOfferModal$.open({ ...args, callbacks: defaultCallbacks }),
|
|
1911
2054
|
close: makeOfferModal$.close
|
|
1912
2055
|
});
|
|
1913
2056
|
var MakeOfferModal = () => {
|
|
1914
2057
|
const { show: showTransactionStatusModal } = useTransactionStatusModal();
|
|
1915
|
-
return /* @__PURE__ */
|
|
2058
|
+
return /* @__PURE__ */ jsx20(Show3, { if: makeOfferModal$.isOpen, children: /* @__PURE__ */ jsx20(ModalContent, { showTransactionStatusModal }) });
|
|
1916
2059
|
};
|
|
1917
2060
|
var ModalContent = observer9(
|
|
1918
2061
|
({
|
|
@@ -1923,10 +2066,14 @@ var ModalContent = observer9(
|
|
|
1923
2066
|
collectionAddress,
|
|
1924
2067
|
chainId,
|
|
1925
2068
|
offerPrice,
|
|
2069
|
+
offerPriceChanged,
|
|
2070
|
+
invalidQuantity,
|
|
1926
2071
|
collectibleId,
|
|
1927
|
-
orderbookKind
|
|
2072
|
+
orderbookKind,
|
|
2073
|
+
callbacks
|
|
1928
2074
|
} = state;
|
|
1929
|
-
const [insufficientBalance, setInsufficientBalance] =
|
|
2075
|
+
const [insufficientBalance, setInsufficientBalance] = useState9(false);
|
|
2076
|
+
const [approvalExecutedSuccess, setApprovalExecutedSuccess] = useState9(false);
|
|
1930
2077
|
const {
|
|
1931
2078
|
data: collectible,
|
|
1932
2079
|
isLoading: collectableIsLoading,
|
|
@@ -1953,6 +2100,9 @@ var ModalContent = observer9(
|
|
|
1953
2100
|
chainId,
|
|
1954
2101
|
collectionAddress,
|
|
1955
2102
|
orderbookKind,
|
|
2103
|
+
enabled: makeOfferModal$.isOpen.get(),
|
|
2104
|
+
onSwitchChainRefused: () => makeOfferModal$.close(),
|
|
2105
|
+
onApprovalSuccess: () => setApprovalExecutedSuccess(true),
|
|
1956
2106
|
onTransactionSent: (hash, orderId) => {
|
|
1957
2107
|
if (!hash && !orderId) return;
|
|
1958
2108
|
showTransactionStatusModal({
|
|
@@ -1963,29 +2113,16 @@ var ModalContent = observer9(
|
|
|
1963
2113
|
chainId,
|
|
1964
2114
|
collectibleId,
|
|
1965
2115
|
type: "OFFER" /* OFFER */,
|
|
1966
|
-
queriesToInvalidate: collectableKeys.all
|
|
2116
|
+
queriesToInvalidate: collectableKeys.all,
|
|
2117
|
+
callbacks
|
|
1967
2118
|
});
|
|
1968
2119
|
makeOfferModal$.close();
|
|
1969
|
-
},
|
|
1970
|
-
onSuccess: (hash) => {
|
|
1971
|
-
if (typeof makeOfferModal$.callbacks?.onSuccess === "function") {
|
|
1972
|
-
makeOfferModal$.callbacks.onSuccess(hash);
|
|
1973
|
-
} else {
|
|
1974
|
-
console.debug("onSuccess callback not provided:", hash);
|
|
1975
|
-
}
|
|
1976
|
-
},
|
|
1977
|
-
onError: (error) => {
|
|
1978
|
-
if (typeof makeOfferModal$.callbacks?.onError === "function") {
|
|
1979
|
-
makeOfferModal$.callbacks.onError(error);
|
|
1980
|
-
} else {
|
|
1981
|
-
console.debug("onError callback not provided:", error);
|
|
1982
|
-
}
|
|
1983
2120
|
}
|
|
1984
2121
|
});
|
|
1985
2122
|
const dateToUnixTime = (date) => Math.floor(date.getTime() / 1e3).toString();
|
|
1986
2123
|
const currencyAddress = offerPrice.currency.contractAddress;
|
|
1987
2124
|
const { isLoading, steps, refreshSteps } = getMakeOfferSteps({
|
|
1988
|
-
contractType: collection
|
|
2125
|
+
contractType: collection?.type,
|
|
1989
2126
|
offer: {
|
|
1990
2127
|
tokenId: collectibleId,
|
|
1991
2128
|
quantity: parseUnits4(
|
|
@@ -1997,25 +2134,28 @@ var ModalContent = observer9(
|
|
|
1997
2134
|
pricePerToken: offerPrice.amountRaw
|
|
1998
2135
|
}
|
|
1999
2136
|
});
|
|
2000
|
-
|
|
2137
|
+
const approvalNeeded = steps?.approval.isPending;
|
|
2138
|
+
useEffect7(() => {
|
|
2001
2139
|
if (!currencyAddress) return;
|
|
2002
2140
|
refreshSteps();
|
|
2003
2141
|
}, [currencyAddress]);
|
|
2004
2142
|
if (collectableIsLoading || collectionIsLoading || currenciesIsLoading) {
|
|
2005
|
-
return /* @__PURE__ */
|
|
2143
|
+
return /* @__PURE__ */ jsx20(
|
|
2006
2144
|
LoadingModal,
|
|
2007
2145
|
{
|
|
2008
|
-
|
|
2146
|
+
isOpen: makeOfferModal$.isOpen.get(),
|
|
2147
|
+
chainId: Number(chainId),
|
|
2009
2148
|
onClose: makeOfferModal$.close,
|
|
2010
2149
|
title: "Make an offer"
|
|
2011
2150
|
}
|
|
2012
2151
|
);
|
|
2013
2152
|
}
|
|
2014
2153
|
if (collectableIsError || collectionIsError) {
|
|
2015
|
-
return /* @__PURE__ */
|
|
2154
|
+
return /* @__PURE__ */ jsx20(
|
|
2016
2155
|
ErrorModal,
|
|
2017
2156
|
{
|
|
2018
|
-
|
|
2157
|
+
isOpen: makeOfferModal$.isOpen.get(),
|
|
2158
|
+
chainId: Number(chainId),
|
|
2019
2159
|
onClose: makeOfferModal$.close,
|
|
2020
2160
|
title: "Make an offer"
|
|
2021
2161
|
}
|
|
@@ -2027,34 +2167,39 @@ var ModalContent = observer9(
|
|
|
2027
2167
|
await refreshSteps();
|
|
2028
2168
|
await execute();
|
|
2029
2169
|
} catch (error) {
|
|
2030
|
-
|
|
2170
|
+
if (callbacks?.onError) {
|
|
2171
|
+
callbacks.onError(error);
|
|
2172
|
+
} else {
|
|
2173
|
+
console.debug("onError callback not provided:", error);
|
|
2174
|
+
}
|
|
2031
2175
|
}
|
|
2032
2176
|
};
|
|
2033
2177
|
const ctas = [
|
|
2034
2178
|
{
|
|
2035
2179
|
label: "Approve TOKEN",
|
|
2036
2180
|
onClick: () => handleStepExecution(() => steps?.approval.execute()),
|
|
2037
|
-
hidden: !
|
|
2038
|
-
pending: steps?.approval.isExecuting,
|
|
2181
|
+
hidden: !approvalNeeded || approvalExecutedSuccess,
|
|
2182
|
+
pending: steps?.approval.isExecuting || isLoading,
|
|
2039
2183
|
variant: "glass",
|
|
2040
|
-
disabled:
|
|
2184
|
+
disabled: invalidQuantity || isLoading || steps?.transaction.isExecuting || insufficientBalance || offerPrice.amountRaw === "0" || !offerPriceChanged
|
|
2041
2185
|
},
|
|
2042
2186
|
{
|
|
2043
2187
|
label: "Make offer",
|
|
2044
2188
|
onClick: () => handleStepExecution(() => steps?.transaction.execute()),
|
|
2045
2189
|
pending: steps?.transaction.isExecuting || isLoading,
|
|
2046
|
-
disabled:
|
|
2190
|
+
disabled: !approvalExecutedSuccess && approvalNeeded || offerPrice.amountRaw === "0" || insufficientBalance || isLoading || invalidQuantity || offerPrice.amountRaw === "0"
|
|
2047
2191
|
}
|
|
2048
2192
|
];
|
|
2049
|
-
return /* @__PURE__ */
|
|
2193
|
+
return /* @__PURE__ */ jsx20(Fragment, { children: /* @__PURE__ */ jsxs13(
|
|
2050
2194
|
ActionModal,
|
|
2051
2195
|
{
|
|
2052
|
-
|
|
2196
|
+
isOpen: makeOfferModal$.isOpen.get(),
|
|
2197
|
+
chainId: Number(chainId),
|
|
2053
2198
|
onClose: () => makeOfferModal$.close(),
|
|
2054
2199
|
title: "Make an offer",
|
|
2055
2200
|
ctas,
|
|
2056
2201
|
children: [
|
|
2057
|
-
/* @__PURE__ */
|
|
2202
|
+
/* @__PURE__ */ jsx20(
|
|
2058
2203
|
TokenPreview,
|
|
2059
2204
|
{
|
|
2060
2205
|
collectionName: collection?.name,
|
|
@@ -2063,19 +2208,20 @@ var ModalContent = observer9(
|
|
|
2063
2208
|
chainId
|
|
2064
2209
|
}
|
|
2065
2210
|
),
|
|
2066
|
-
/* @__PURE__ */
|
|
2211
|
+
/* @__PURE__ */ jsx20(
|
|
2067
2212
|
priceInput_default,
|
|
2068
2213
|
{
|
|
2069
2214
|
chainId,
|
|
2070
2215
|
collectionAddress,
|
|
2071
2216
|
$listingPrice: makeOfferModal$.offerPrice,
|
|
2217
|
+
onPriceChange: () => makeOfferModal$.offerPriceChanged.set(true),
|
|
2072
2218
|
checkBalance: {
|
|
2073
2219
|
enabled: true,
|
|
2074
2220
|
callback: (state2) => setInsufficientBalance(state2)
|
|
2075
2221
|
}
|
|
2076
2222
|
}
|
|
2077
2223
|
),
|
|
2078
|
-
collection?.type === "ERC1155" /* ERC1155 */ && /* @__PURE__ */
|
|
2224
|
+
collection?.type === "ERC1155" /* ERC1155 */ && /* @__PURE__ */ jsx20(
|
|
2079
2225
|
QuantityInput,
|
|
2080
2226
|
{
|
|
2081
2227
|
$quantity: makeOfferModal$.quantity,
|
|
@@ -2084,7 +2230,7 @@ var ModalContent = observer9(
|
|
|
2084
2230
|
maxQuantity: String(Number.MAX_SAFE_INTEGER)
|
|
2085
2231
|
}
|
|
2086
2232
|
),
|
|
2087
|
-
|
|
2233
|
+
offerPrice.amountRaw !== "0" && offerPriceChanged && !insufficientBalance && /* @__PURE__ */ jsx20(
|
|
2088
2234
|
FloorPriceText,
|
|
2089
2235
|
{
|
|
2090
2236
|
tokenId: collectibleId,
|
|
@@ -2093,10 +2239,10 @@ var ModalContent = observer9(
|
|
|
2093
2239
|
price: offerPrice
|
|
2094
2240
|
}
|
|
2095
2241
|
),
|
|
2096
|
-
/* @__PURE__ */
|
|
2242
|
+
/* @__PURE__ */ jsx20(expirationDateSelect_default, { $date: makeOfferModal$.expiry })
|
|
2097
2243
|
]
|
|
2098
2244
|
}
|
|
2099
|
-
);
|
|
2245
|
+
) });
|
|
2100
2246
|
}
|
|
2101
2247
|
);
|
|
2102
2248
|
|
|
@@ -2105,24 +2251,41 @@ import { Show as Show4, observer as observer10 } from "@legendapp/state/react";
|
|
|
2105
2251
|
import { parseUnits as parseUnits5 } from "viem";
|
|
2106
2252
|
|
|
2107
2253
|
// src/react/hooks/useSell.tsx
|
|
2108
|
-
import { useCallback as useCallback3, useState as
|
|
2254
|
+
import { useCallback as useCallback3, useState as useState10 } from "react";
|
|
2109
2255
|
var useSell = ({
|
|
2110
2256
|
onSuccess,
|
|
2111
2257
|
onError,
|
|
2112
2258
|
onTransactionSent,
|
|
2259
|
+
onApprovalSuccess,
|
|
2260
|
+
onSwitchChainRefused,
|
|
2261
|
+
enabled,
|
|
2113
2262
|
...config
|
|
2114
2263
|
}) => {
|
|
2115
|
-
const [isLoading, setIsLoading] =
|
|
2116
|
-
const [steps, setSteps] =
|
|
2117
|
-
const
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
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);
|
|
2121
2278
|
},
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2279
|
+
onError: (error) => {
|
|
2280
|
+
setExecutionState(null);
|
|
2281
|
+
onError?.(error);
|
|
2282
|
+
},
|
|
2283
|
+
onTransactionSent,
|
|
2284
|
+
onApprovalSuccess: (hash) => {
|
|
2285
|
+
setExecutionState(null);
|
|
2286
|
+
onApprovalSuccess?.(hash);
|
|
2287
|
+
}
|
|
2288
|
+
});
|
|
2126
2289
|
const loadSteps = useCallback3(
|
|
2127
2290
|
async (props) => {
|
|
2128
2291
|
if (!machine) return;
|
|
@@ -2132,16 +2295,51 @@ var useSell = ({
|
|
|
2132
2295
|
setIsLoading(false);
|
|
2133
2296
|
return;
|
|
2134
2297
|
}
|
|
2135
|
-
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
|
+
});
|
|
2136
2309
|
setIsLoading(false);
|
|
2137
2310
|
},
|
|
2138
|
-
[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
|
+
[]
|
|
2139
2325
|
);
|
|
2140
2326
|
return {
|
|
2141
2327
|
sell: (props) => machine?.start(props),
|
|
2142
2328
|
getSellSteps: (props) => ({
|
|
2143
2329
|
isLoading,
|
|
2144
|
-
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,
|
|
2145
2343
|
refreshSteps: () => loadSteps(props)
|
|
2146
2344
|
}),
|
|
2147
2345
|
isLoading: isMachineLoading
|
|
@@ -2149,17 +2347,17 @@ var useSell = ({
|
|
|
2149
2347
|
};
|
|
2150
2348
|
|
|
2151
2349
|
// src/react/ui/modals/_internal/components/transactionHeader/index.tsx
|
|
2152
|
-
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";
|
|
2153
2351
|
import { formatDistanceToNow as formatDistanceToNow2 } from "date-fns";
|
|
2154
|
-
import { jsx as
|
|
2352
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2155
2353
|
function TransactionHeader({
|
|
2156
2354
|
title,
|
|
2157
2355
|
currencyImageUrl,
|
|
2158
2356
|
date
|
|
2159
2357
|
}) {
|
|
2160
|
-
return /* @__PURE__ */
|
|
2161
|
-
/* @__PURE__ */
|
|
2162
|
-
|
|
2358
|
+
return /* @__PURE__ */ jsxs14(Box15, { display: "flex", alignItems: "center", width: "full", children: [
|
|
2359
|
+
/* @__PURE__ */ jsx21(
|
|
2360
|
+
Text12,
|
|
2163
2361
|
{
|
|
2164
2362
|
fontSize: "small",
|
|
2165
2363
|
fontWeight: "medium",
|
|
@@ -2169,9 +2367,9 @@ function TransactionHeader({
|
|
|
2169
2367
|
children: title
|
|
2170
2368
|
}
|
|
2171
2369
|
),
|
|
2172
|
-
/* @__PURE__ */
|
|
2173
|
-
date && /* @__PURE__ */
|
|
2174
|
-
|
|
2370
|
+
/* @__PURE__ */ jsx21(Image4, { src: currencyImageUrl, width: "3", height: "3", marginRight: "1" }),
|
|
2371
|
+
date && /* @__PURE__ */ jsxs14(
|
|
2372
|
+
Text12,
|
|
2175
2373
|
{
|
|
2176
2374
|
fontSize: "small",
|
|
2177
2375
|
color: "text50",
|
|
@@ -2183,7 +2381,7 @@ function TransactionHeader({
|
|
|
2183
2381
|
" ago"
|
|
2184
2382
|
]
|
|
2185
2383
|
}
|
|
2186
|
-
) || /* @__PURE__ */
|
|
2384
|
+
) || /* @__PURE__ */ jsx21(Skeleton7, { width: "8", height: "4" })
|
|
2187
2385
|
] });
|
|
2188
2386
|
}
|
|
2189
2387
|
|
|
@@ -2212,37 +2410,69 @@ var initialState5 = {
|
|
|
2212
2410
|
var sellModal$ = observable6(initialState5);
|
|
2213
2411
|
|
|
2214
2412
|
// src/react/ui/modals/SellModal/index.tsx
|
|
2215
|
-
import {
|
|
2413
|
+
import { useEffect as useEffect8, useState as useState11 } from "react";
|
|
2414
|
+
import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2216
2415
|
var useSellModal = (defaultCallbacks) => ({
|
|
2217
2416
|
show: (args) => sellModal$.open({ ...args, callbacks: defaultCallbacks }),
|
|
2218
2417
|
close: sellModal$.close
|
|
2219
2418
|
});
|
|
2220
2419
|
var SellModal = () => {
|
|
2221
2420
|
const { show: showTransactionStatusModal } = useTransactionStatusModal();
|
|
2222
|
-
return /* @__PURE__ */
|
|
2421
|
+
return /* @__PURE__ */ jsx22(Show4, { if: sellModal$.isOpen, children: /* @__PURE__ */ jsx22(ModalContent2, { showTransactionStatusModal }) });
|
|
2223
2422
|
};
|
|
2224
2423
|
var ModalContent2 = observer10(
|
|
2225
2424
|
({
|
|
2226
2425
|
showTransactionStatusModal
|
|
2227
2426
|
}) => {
|
|
2228
|
-
const { tokenId, collectionAddress, chainId, order } = sellModal$.get();
|
|
2427
|
+
const { tokenId, collectionAddress, chainId, order, callbacks } = sellModal$.get();
|
|
2229
2428
|
const { data: collectible } = useCollection({
|
|
2230
2429
|
chainId,
|
|
2231
2430
|
collectionAddress
|
|
2232
2431
|
});
|
|
2233
|
-
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({
|
|
2234
2447
|
collectionAddress,
|
|
2235
2448
|
chainId,
|
|
2449
|
+
enabled: sellModal$.isOpen.get(),
|
|
2450
|
+
onSwitchChainRefused: () => {
|
|
2451
|
+
sellModal$.close();
|
|
2452
|
+
},
|
|
2453
|
+
onApprovalSuccess: () => setApprovalExecutedSuccess(true),
|
|
2236
2454
|
onTransactionSent: (hash) => {
|
|
2237
2455
|
if (!hash) return;
|
|
2238
2456
|
showTransactionStatusModal({
|
|
2239
2457
|
hash,
|
|
2240
|
-
price: {
|
|
2458
|
+
price: order ? {
|
|
2241
2459
|
amountRaw: order.priceAmount,
|
|
2242
|
-
currency: currencies
|
|
2460
|
+
currency: currencies?.find(
|
|
2243
2461
|
(currency2) => currency2.contractAddress === order.priceCurrencyAddress
|
|
2244
|
-
)
|
|
2245
|
-
|
|
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,
|
|
2246
2476
|
collectionAddress,
|
|
2247
2477
|
chainId,
|
|
2248
2478
|
collectibleId: tokenId,
|
|
@@ -2250,82 +2480,88 @@ var ModalContent2 = observer10(
|
|
|
2250
2480
|
queriesToInvalidate: [
|
|
2251
2481
|
...collectableKeys.all,
|
|
2252
2482
|
balanceQueries.all
|
|
2253
|
-
]
|
|
2483
|
+
],
|
|
2484
|
+
callbacks
|
|
2254
2485
|
});
|
|
2255
2486
|
sellModal$.close();
|
|
2256
|
-
}
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
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);
|
|
2267
2508
|
} else {
|
|
2268
2509
|
console.debug("onError callback not provided:", error);
|
|
2269
2510
|
}
|
|
2270
2511
|
}
|
|
2271
|
-
}
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
isLoading: collectionLoading,
|
|
2275
|
-
isError: collectionError
|
|
2276
|
-
} = useCollection({
|
|
2277
|
-
chainId,
|
|
2278
|
-
collectionAddress
|
|
2279
|
-
});
|
|
2280
|
-
const currencyOptions = useCurrencyOptions({ collectionAddress });
|
|
2281
|
-
const { data: currencies, isLoading: currenciesLoading } = useCurrencies({
|
|
2282
|
-
chainId,
|
|
2283
|
-
currencyOptions
|
|
2284
|
-
});
|
|
2285
|
-
if (collectionLoading || currenciesLoading) {
|
|
2286
|
-
return /* @__PURE__ */ jsx23(
|
|
2512
|
+
};
|
|
2513
|
+
if (collectionLoading || currenciesLoading || machineLoading) {
|
|
2514
|
+
return /* @__PURE__ */ jsx22(
|
|
2287
2515
|
LoadingModal,
|
|
2288
2516
|
{
|
|
2289
|
-
|
|
2517
|
+
isOpen: sellModal$.isOpen.get(),
|
|
2518
|
+
chainId: Number(chainId),
|
|
2290
2519
|
onClose: sellModal$.close,
|
|
2291
2520
|
title: "You have an offer"
|
|
2292
2521
|
}
|
|
2293
2522
|
);
|
|
2294
2523
|
}
|
|
2295
2524
|
if (collectionError || order === void 0) {
|
|
2296
|
-
return /* @__PURE__ */
|
|
2525
|
+
return /* @__PURE__ */ jsx22(
|
|
2297
2526
|
ErrorModal,
|
|
2298
2527
|
{
|
|
2299
|
-
|
|
2528
|
+
isOpen: sellModal$.isOpen.get(),
|
|
2529
|
+
chainId: Number(chainId),
|
|
2300
2530
|
onClose: sellModal$.close,
|
|
2301
2531
|
title: "You have an offer"
|
|
2302
2532
|
}
|
|
2303
2533
|
);
|
|
2304
2534
|
}
|
|
2535
|
+
const approvalNeeded = steps?.approval.isPending;
|
|
2305
2536
|
const currency = currencies?.find(
|
|
2306
2537
|
(c) => c.contractAddress === order?.priceCurrencyAddress
|
|
2307
2538
|
);
|
|
2308
|
-
|
|
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(
|
|
2309
2556
|
ActionModal,
|
|
2310
2557
|
{
|
|
2311
|
-
|
|
2558
|
+
isOpen: sellModal$.isOpen.get(),
|
|
2559
|
+
chainId: Number(chainId),
|
|
2312
2560
|
onClose: sellModal$.close,
|
|
2313
2561
|
title: "You have an offer",
|
|
2314
|
-
ctas
|
|
2315
|
-
{
|
|
2316
|
-
label: "Accept",
|
|
2317
|
-
onClick: () => sell({
|
|
2318
|
-
orderId: order?.orderId,
|
|
2319
|
-
marketplace: order?.marketplace,
|
|
2320
|
-
quantity: order?.quantityRemaining ? parseUnits5(
|
|
2321
|
-
order.quantityRemaining,
|
|
2322
|
-
collectible?.decimals || 0
|
|
2323
|
-
).toString() : "1"
|
|
2324
|
-
})
|
|
2325
|
-
}
|
|
2326
|
-
],
|
|
2562
|
+
ctas,
|
|
2327
2563
|
children: [
|
|
2328
|
-
/* @__PURE__ */
|
|
2564
|
+
/* @__PURE__ */ jsx22(
|
|
2329
2565
|
TransactionHeader,
|
|
2330
2566
|
{
|
|
2331
2567
|
title: "Offer received",
|
|
@@ -2333,7 +2569,7 @@ var ModalContent2 = observer10(
|
|
|
2333
2569
|
date: order && new Date(order.createdAt)
|
|
2334
2570
|
}
|
|
2335
2571
|
),
|
|
2336
|
-
/* @__PURE__ */
|
|
2572
|
+
/* @__PURE__ */ jsx22(
|
|
2337
2573
|
TokenPreview,
|
|
2338
2574
|
{
|
|
2339
2575
|
collectionName: collection?.name,
|
|
@@ -2342,7 +2578,7 @@ var ModalContent2 = observer10(
|
|
|
2342
2578
|
chainId
|
|
2343
2579
|
}
|
|
2344
2580
|
),
|
|
2345
|
-
/* @__PURE__ */
|
|
2581
|
+
/* @__PURE__ */ jsx22(
|
|
2346
2582
|
TransactionDetails,
|
|
2347
2583
|
{
|
|
2348
2584
|
collectibleId: tokenId,
|
|
@@ -2369,10 +2605,10 @@ import {
|
|
|
2369
2605
|
ExternalLinkIcon,
|
|
2370
2606
|
IconButton as IconButton3,
|
|
2371
2607
|
Image as Image5,
|
|
2372
|
-
Text as
|
|
2608
|
+
Text as Text13
|
|
2373
2609
|
} from "@0xsequence/design-system";
|
|
2374
2610
|
import { observer as observer11 } from "@legendapp/state/react";
|
|
2375
|
-
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";
|
|
2376
2612
|
|
|
2377
2613
|
// src/react/ui/modals/SuccessfulPurchaseModal/_store.ts
|
|
2378
2614
|
import { observable as observable7 } from "@legendapp/state";
|
|
@@ -2417,7 +2653,7 @@ var initialState6 = {
|
|
|
2417
2653
|
var successfulPurchaseModal$ = observable7(initialState6);
|
|
2418
2654
|
|
|
2419
2655
|
// src/react/ui/modals/SuccessfulPurchaseModal/index.tsx
|
|
2420
|
-
import { jsx as
|
|
2656
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2421
2657
|
var useSuccessfulPurchaseModal = (callbacks) => {
|
|
2422
2658
|
return {
|
|
2423
2659
|
show: (args) => successfulPurchaseModal$.open({ ...args, defaultCallbacks: callbacks }),
|
|
@@ -2425,12 +2661,12 @@ var useSuccessfulPurchaseModal = (callbacks) => {
|
|
|
2425
2661
|
};
|
|
2426
2662
|
};
|
|
2427
2663
|
var SuccessfulPurchaseModal = observer11(() => {
|
|
2428
|
-
return /* @__PURE__ */
|
|
2429
|
-
/* @__PURE__ */
|
|
2430
|
-
/* @__PURE__ */
|
|
2431
|
-
/* @__PURE__ */
|
|
2432
|
-
/* @__PURE__ */
|
|
2433
|
-
|
|
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,
|
|
2434
2670
|
{
|
|
2435
2671
|
textAlign: "center",
|
|
2436
2672
|
fontSize: "medium",
|
|
@@ -2439,21 +2675,21 @@ var SuccessfulPurchaseModal = observer11(() => {
|
|
|
2439
2675
|
children: "Successful purchase!"
|
|
2440
2676
|
}
|
|
2441
2677
|
),
|
|
2442
|
-
/* @__PURE__ */
|
|
2678
|
+
/* @__PURE__ */ jsx23(
|
|
2443
2679
|
CollectiblesGrid,
|
|
2444
2680
|
{
|
|
2445
2681
|
collectibles: successfulPurchaseModal$.state.get().collectibles
|
|
2446
2682
|
}
|
|
2447
2683
|
),
|
|
2448
|
-
/* @__PURE__ */
|
|
2449
|
-
/* @__PURE__ */
|
|
2450
|
-
/* @__PURE__ */
|
|
2451
|
-
/* @__PURE__ */
|
|
2452
|
-
/* @__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 })
|
|
2453
2689
|
] }),
|
|
2454
|
-
/* @__PURE__ */
|
|
2690
|
+
/* @__PURE__ */ jsx23(SuccessfulPurchaseActions, {})
|
|
2455
2691
|
] }),
|
|
2456
|
-
/* @__PURE__ */
|
|
2692
|
+
/* @__PURE__ */ jsx23(
|
|
2457
2693
|
Close2,
|
|
2458
2694
|
{
|
|
2459
2695
|
onClick: () => {
|
|
@@ -2461,15 +2697,15 @@ var SuccessfulPurchaseModal = observer11(() => {
|
|
|
2461
2697
|
},
|
|
2462
2698
|
className: closeButton,
|
|
2463
2699
|
asChild: true,
|
|
2464
|
-
children: /* @__PURE__ */
|
|
2700
|
+
children: /* @__PURE__ */ jsx23(IconButton3, { size: "xs", "aria-label": "Close modal", icon: CloseIcon2 })
|
|
2465
2701
|
}
|
|
2466
2702
|
)
|
|
2467
2703
|
] })
|
|
2468
2704
|
] }) });
|
|
2469
2705
|
});
|
|
2470
2706
|
function SuccessfulPurchaseActions() {
|
|
2471
|
-
return /* @__PURE__ */
|
|
2472
|
-
successfulPurchaseModal$.state.ctaOptions.get() && /* @__PURE__ */
|
|
2707
|
+
return /* @__PURE__ */ jsxs16(Box16, { display: "flex", flexDirection: "column", gap: "2", children: [
|
|
2708
|
+
successfulPurchaseModal$.state.ctaOptions.get() && /* @__PURE__ */ jsx23(
|
|
2473
2709
|
Button3,
|
|
2474
2710
|
{
|
|
2475
2711
|
shape: "square",
|
|
@@ -2479,7 +2715,7 @@ function SuccessfulPurchaseActions() {
|
|
|
2479
2715
|
onClick: successfulPurchaseModal$.state.ctaOptions.ctaOnClick.get() || void 0
|
|
2480
2716
|
}
|
|
2481
2717
|
),
|
|
2482
|
-
/* @__PURE__ */
|
|
2718
|
+
/* @__PURE__ */ jsx23(
|
|
2483
2719
|
Button3,
|
|
2484
2720
|
{
|
|
2485
2721
|
as: "a",
|
|
@@ -2497,15 +2733,15 @@ function SuccessfulPurchaseActions() {
|
|
|
2497
2733
|
function CollectiblesGrid({ collectibles }) {
|
|
2498
2734
|
const total = collectibles.length;
|
|
2499
2735
|
const shownCollectibles = total > 4 ? collectibles.slice(0, 4) : collectibles;
|
|
2500
|
-
return /* @__PURE__ */
|
|
2736
|
+
return /* @__PURE__ */ jsx23(Box16, { className: collectiblesGrid, display: "grid", gap: "2", children: shownCollectibles.map((collectible) => {
|
|
2501
2737
|
const showPlus = total > 4 && collectibles.indexOf(collectible) === 3;
|
|
2502
|
-
return /* @__PURE__ */
|
|
2738
|
+
return /* @__PURE__ */ jsxs16(
|
|
2503
2739
|
Box16,
|
|
2504
2740
|
{
|
|
2505
2741
|
className: collectiblesGridItem,
|
|
2506
2742
|
position: "relative",
|
|
2507
2743
|
children: [
|
|
2508
|
-
/* @__PURE__ */
|
|
2744
|
+
/* @__PURE__ */ jsx23(
|
|
2509
2745
|
Image5,
|
|
2510
2746
|
{
|
|
2511
2747
|
src: collectible.image,
|
|
@@ -2516,7 +2752,7 @@ function CollectiblesGrid({ collectibles }) {
|
|
|
2516
2752
|
borderRadius: "sm"
|
|
2517
2753
|
}
|
|
2518
2754
|
),
|
|
2519
|
-
showPlus && /* @__PURE__ */
|
|
2755
|
+
showPlus && /* @__PURE__ */ jsx23(
|
|
2520
2756
|
Box16,
|
|
2521
2757
|
{
|
|
2522
2758
|
position: "absolute",
|
|
@@ -2529,8 +2765,8 @@ function CollectiblesGrid({ collectibles }) {
|
|
|
2529
2765
|
justifyContent: "center",
|
|
2530
2766
|
background: "backgroundOverlay",
|
|
2531
2767
|
backdropFilter: "blur",
|
|
2532
|
-
children: /* @__PURE__ */
|
|
2533
|
-
|
|
2768
|
+
children: /* @__PURE__ */ jsxs16(
|
|
2769
|
+
Text13,
|
|
2534
2770
|
{
|
|
2535
2771
|
fontSize: "small",
|
|
2536
2772
|
fontWeight: "medium",
|
|
@@ -2559,7 +2795,7 @@ var SuccessfulPurchaseModal_default = SuccessfulPurchaseModal;
|
|
|
2559
2795
|
// src/react/ui/modals/TransferModal/index.tsx
|
|
2560
2796
|
import { CloseIcon as CloseIcon3, IconButton as IconButton4 } from "@0xsequence/design-system";
|
|
2561
2797
|
import { Show as Show5, observer as observer13 } from "@legendapp/state/react";
|
|
2562
|
-
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";
|
|
2563
2799
|
import { useAccount as useAccount5 } from "wagmi";
|
|
2564
2800
|
|
|
2565
2801
|
// src/react/ui/modals/TransferModal/_store.ts
|
|
@@ -2602,7 +2838,7 @@ var initialState7 = {
|
|
|
2602
2838
|
var transferModal$ = observable8(initialState7);
|
|
2603
2839
|
|
|
2604
2840
|
// src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
|
|
2605
|
-
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";
|
|
2606
2842
|
import { observable as observable9 } from "@legendapp/state";
|
|
2607
2843
|
import { isAddress } from "viem";
|
|
2608
2844
|
import { useAccount as useAccount4 } from "wagmi";
|
|
@@ -2688,7 +2924,7 @@ var useHandleTransfer = () => {
|
|
|
2688
2924
|
var useHandleTransfer_default = useHandleTransfer;
|
|
2689
2925
|
|
|
2690
2926
|
// src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
|
|
2691
|
-
import { Fragment, jsx as
|
|
2927
|
+
import { Fragment as Fragment2, jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2692
2928
|
var EnterWalletAddressView = () => {
|
|
2693
2929
|
const { address } = useAccount4();
|
|
2694
2930
|
const { collectionAddress, collectibleId, chainId, collectionType } = transferModal$.state.get();
|
|
@@ -2701,11 +2937,11 @@ var EnterWalletAddressView = () => {
|
|
|
2701
2937
|
chainId,
|
|
2702
2938
|
contractAddress: collectionAddress,
|
|
2703
2939
|
tokenId: collectibleId,
|
|
2704
|
-
accountAddress: address,
|
|
2940
|
+
accountAddress: address ?? "",
|
|
2705
2941
|
query: { enabled: !!address }
|
|
2706
2942
|
});
|
|
2707
2943
|
const balanceAmount = tokenBalance?.pages[0].balances[0].balance;
|
|
2708
|
-
const insufficientBalance = $quantity.get() > balanceAmount;
|
|
2944
|
+
const insufficientBalance = balanceAmount ? $quantity.get() > balanceAmount : true;
|
|
2709
2945
|
const { data: collection } = useCollection({
|
|
2710
2946
|
collectionAddress,
|
|
2711
2947
|
chainId
|
|
@@ -2721,17 +2957,17 @@ var EnterWalletAddressView = () => {
|
|
|
2721
2957
|
transfer();
|
|
2722
2958
|
transferModal$.view.set("followWalletInstructions");
|
|
2723
2959
|
}
|
|
2724
|
-
return /* @__PURE__ */
|
|
2725
|
-
/* @__PURE__ */
|
|
2726
|
-
/* @__PURE__ */
|
|
2727
|
-
/* @__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(
|
|
2728
2964
|
AlertMessage,
|
|
2729
2965
|
{
|
|
2730
2966
|
message: getMessage("enterReceiverAddress"),
|
|
2731
2967
|
type: "warning"
|
|
2732
2968
|
}
|
|
2733
2969
|
),
|
|
2734
|
-
/* @__PURE__ */
|
|
2970
|
+
/* @__PURE__ */ jsx24(
|
|
2735
2971
|
TextInput,
|
|
2736
2972
|
{
|
|
2737
2973
|
label: "Wallet address",
|
|
@@ -2742,8 +2978,8 @@ var EnterWalletAddressView = () => {
|
|
|
2742
2978
|
placeholder: "Enter wallet address of recipient"
|
|
2743
2979
|
}
|
|
2744
2980
|
),
|
|
2745
|
-
collectionType === "ERC1155" /* ERC1155 */ && balanceAmount && /* @__PURE__ */
|
|
2746
|
-
/* @__PURE__ */
|
|
2981
|
+
collectionType === "ERC1155" /* ERC1155 */ && balanceAmount && /* @__PURE__ */ jsxs17(Fragment2, { children: [
|
|
2982
|
+
/* @__PURE__ */ jsx24(
|
|
2747
2983
|
QuantityInput,
|
|
2748
2984
|
{
|
|
2749
2985
|
$quantity,
|
|
@@ -2752,8 +2988,8 @@ var EnterWalletAddressView = () => {
|
|
|
2752
2988
|
maxQuantity: balanceAmount
|
|
2753
2989
|
}
|
|
2754
2990
|
),
|
|
2755
|
-
/* @__PURE__ */
|
|
2756
|
-
|
|
2991
|
+
/* @__PURE__ */ jsx24(
|
|
2992
|
+
Text14,
|
|
2757
2993
|
{
|
|
2758
2994
|
color: insufficientBalance ? "negative" : "text50",
|
|
2759
2995
|
fontSize: "small",
|
|
@@ -2764,7 +3000,7 @@ var EnterWalletAddressView = () => {
|
|
|
2764
3000
|
)
|
|
2765
3001
|
] })
|
|
2766
3002
|
] }),
|
|
2767
|
-
/* @__PURE__ */
|
|
3003
|
+
/* @__PURE__ */ jsx24(
|
|
2768
3004
|
Button4,
|
|
2769
3005
|
{
|
|
2770
3006
|
onClick: handleChangeView,
|
|
@@ -2783,20 +3019,20 @@ var EnterWalletAddressView = () => {
|
|
|
2783
3019
|
var enterWalletAddress_default = EnterWalletAddressView;
|
|
2784
3020
|
|
|
2785
3021
|
// src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx
|
|
2786
|
-
import { Box as Box18, Button as Button5, Text as
|
|
3022
|
+
import { Box as Box18, Button as Button5, Text as Text15 } from "@0xsequence/design-system";
|
|
2787
3023
|
import { observer as observer12 } from "@legendapp/state/react";
|
|
2788
|
-
import { jsx as
|
|
3024
|
+
import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2789
3025
|
var FollowWalletInstructionsView = observer12(() => {
|
|
2790
|
-
return /* @__PURE__ */
|
|
2791
|
-
/* @__PURE__ */
|
|
2792
|
-
/* @__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(
|
|
2793
3029
|
AlertMessage,
|
|
2794
3030
|
{
|
|
2795
3031
|
message: getMessage("followWalletInstructions"),
|
|
2796
3032
|
type: "info"
|
|
2797
3033
|
}
|
|
2798
3034
|
) }),
|
|
2799
|
-
/* @__PURE__ */
|
|
3035
|
+
/* @__PURE__ */ jsx25(
|
|
2800
3036
|
Button5,
|
|
2801
3037
|
{
|
|
2802
3038
|
disabled: true,
|
|
@@ -2814,7 +3050,7 @@ var FollowWalletInstructionsView = observer12(() => {
|
|
|
2814
3050
|
var followWalletInstructions_default = FollowWalletInstructionsView;
|
|
2815
3051
|
|
|
2816
3052
|
// src/react/ui/modals/TransferModal/index.tsx
|
|
2817
|
-
import { jsx as
|
|
3053
|
+
import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2818
3054
|
var useTransferModal = () => {
|
|
2819
3055
|
const { chainId: accountChainId } = useAccount5();
|
|
2820
3056
|
const { show: showSwitchNetworkModal } = useSwitchChainModal();
|
|
@@ -2850,17 +3086,17 @@ var useTransferModal = () => {
|
|
|
2850
3086
|
};
|
|
2851
3087
|
};
|
|
2852
3088
|
var TransferModal = () => {
|
|
2853
|
-
return /* @__PURE__ */
|
|
3089
|
+
return /* @__PURE__ */ jsx26(Show5, { if: transferModal$.isOpen, children: /* @__PURE__ */ jsx26(Modal3, {}) });
|
|
2854
3090
|
};
|
|
2855
3091
|
var Modal3 = () => {
|
|
2856
|
-
return /* @__PURE__ */
|
|
3092
|
+
return /* @__PURE__ */ jsx26(ModalContent3, {});
|
|
2857
3093
|
};
|
|
2858
3094
|
var ModalContent3 = observer13(() => {
|
|
2859
|
-
return /* @__PURE__ */
|
|
2860
|
-
/* @__PURE__ */
|
|
2861
|
-
/* @__PURE__ */
|
|
2862
|
-
/* @__PURE__ */
|
|
2863
|
-
/* @__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 }) })
|
|
2864
3100
|
] })
|
|
2865
3101
|
] }) });
|
|
2866
3102
|
});
|
|
@@ -2868,39 +3104,39 @@ var TransactionModalView = observer13(() => {
|
|
|
2868
3104
|
const { view } = transferModal$.get();
|
|
2869
3105
|
switch (view) {
|
|
2870
3106
|
case "enterReceiverAddress":
|
|
2871
|
-
return /* @__PURE__ */
|
|
3107
|
+
return /* @__PURE__ */ jsx26(enterWalletAddress_default, {});
|
|
2872
3108
|
case "followWalletInstructions":
|
|
2873
|
-
return /* @__PURE__ */
|
|
3109
|
+
return /* @__PURE__ */ jsx26(followWalletInstructions_default, {});
|
|
2874
3110
|
default:
|
|
2875
3111
|
return null;
|
|
2876
3112
|
}
|
|
2877
3113
|
});
|
|
2878
3114
|
|
|
2879
3115
|
// src/react/ui/modals/modal-provider.tsx
|
|
2880
|
-
import { Fragment as
|
|
3116
|
+
import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2881
3117
|
var ModalProvider = observer14(() => {
|
|
2882
|
-
return /* @__PURE__ */
|
|
2883
|
-
/* @__PURE__ */
|
|
2884
|
-
/* @__PURE__ */
|
|
2885
|
-
/* @__PURE__ */
|
|
2886
|
-
/* @__PURE__ */
|
|
2887
|
-
/* @__PURE__ */
|
|
2888
|
-
/* @__PURE__ */
|
|
2889
|
-
/* @__PURE__ */
|
|
2890
|
-
/* @__PURE__ */
|
|
2891
|
-
/* @__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, {})
|
|
2892
3128
|
] });
|
|
2893
3129
|
});
|
|
2894
3130
|
|
|
2895
3131
|
// src/react/ui/components/collectible-card/CollectibleCard.tsx
|
|
2896
|
-
import { useState as
|
|
3132
|
+
import { useState as useState12 } from "react";
|
|
2897
3133
|
import { Box as Box22, IconButton as IconButton6, Skeleton as Skeleton8 } from "@0xsequence/design-system";
|
|
2898
3134
|
import { useAccount as useAccount7 } from "wagmi";
|
|
2899
3135
|
|
|
2900
3136
|
// src/react/ui/icons/DiamondEye.tsx
|
|
2901
3137
|
import { Box as Box19 } from "@0xsequence/design-system";
|
|
2902
|
-
import { jsx as
|
|
2903
|
-
var Svg = () => /* @__PURE__ */
|
|
3138
|
+
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3139
|
+
var Svg = () => /* @__PURE__ */ jsxs21(
|
|
2904
3140
|
"svg",
|
|
2905
3141
|
{
|
|
2906
3142
|
width: "16",
|
|
@@ -2908,18 +3144,23 @@ var Svg = () => /* @__PURE__ */ jsx29(
|
|
|
2908
3144
|
viewBox: "0 0 16 12",
|
|
2909
3145
|
fill: "none",
|
|
2910
3146
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
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
|
+
]
|
|
2920
3161
|
}
|
|
2921
3162
|
);
|
|
2922
|
-
var SvgDiamondEyeIcon = ({ size = "sm", ...props }) => /* @__PURE__ */
|
|
3163
|
+
var SvgDiamondEyeIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx28(
|
|
2923
3164
|
Box19,
|
|
2924
3165
|
{
|
|
2925
3166
|
as: Svg,
|
|
@@ -2934,7 +3175,7 @@ var DiamondEye_default = SvgDiamondEyeIcon;
|
|
|
2934
3175
|
// src/react/ui/components/_internals/action-button/ActionButton.tsx
|
|
2935
3176
|
import { Button as Button6 } from "@0xsequence/design-system";
|
|
2936
3177
|
import { observer as observer15 } from "@legendapp/state/react";
|
|
2937
|
-
import { jsx as
|
|
3178
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
2938
3179
|
var ActionButton = observer15(
|
|
2939
3180
|
({
|
|
2940
3181
|
collectionAddress,
|
|
@@ -2953,7 +3194,7 @@ var ActionButton = observer15(
|
|
|
2953
3194
|
if (action === "Buy" /* BUY */) {
|
|
2954
3195
|
if (!lowestListing)
|
|
2955
3196
|
throw new InvalidStepError("BUY", "lowestListing is required");
|
|
2956
|
-
return /* @__PURE__ */
|
|
3197
|
+
return /* @__PURE__ */ jsx29(
|
|
2957
3198
|
ActionButtonBody,
|
|
2958
3199
|
{
|
|
2959
3200
|
label: "Buy",
|
|
@@ -2969,7 +3210,7 @@ var ActionButton = observer15(
|
|
|
2969
3210
|
if (action === "Sell" /* SELL */) {
|
|
2970
3211
|
if (!highestOffer)
|
|
2971
3212
|
throw new InvalidStepError("SELL", "highestOffer is required");
|
|
2972
|
-
return /* @__PURE__ */
|
|
3213
|
+
return /* @__PURE__ */ jsx29(
|
|
2973
3214
|
ActionButtonBody,
|
|
2974
3215
|
{
|
|
2975
3216
|
label: "Sell",
|
|
@@ -2983,7 +3224,7 @@ var ActionButton = observer15(
|
|
|
2983
3224
|
);
|
|
2984
3225
|
}
|
|
2985
3226
|
if (action === "Create listing" /* LIST */) {
|
|
2986
|
-
return /* @__PURE__ */
|
|
3227
|
+
return /* @__PURE__ */ jsx29(
|
|
2987
3228
|
ActionButtonBody,
|
|
2988
3229
|
{
|
|
2989
3230
|
label: "Create listing",
|
|
@@ -2997,7 +3238,7 @@ var ActionButton = observer15(
|
|
|
2997
3238
|
);
|
|
2998
3239
|
}
|
|
2999
3240
|
if (action === "Make an offer" /* OFFER */) {
|
|
3000
|
-
return /* @__PURE__ */
|
|
3241
|
+
return /* @__PURE__ */ jsx29(
|
|
3001
3242
|
ActionButtonBody,
|
|
3002
3243
|
{
|
|
3003
3244
|
label: "Make an offer",
|
|
@@ -3011,7 +3252,7 @@ var ActionButton = observer15(
|
|
|
3011
3252
|
);
|
|
3012
3253
|
}
|
|
3013
3254
|
if (action === "Transfer" /* TRANSFER */) {
|
|
3014
|
-
return /* @__PURE__ */
|
|
3255
|
+
return /* @__PURE__ */ jsx29(
|
|
3015
3256
|
ActionButtonBody,
|
|
3016
3257
|
{
|
|
3017
3258
|
label: "Transfer",
|
|
@@ -3027,7 +3268,7 @@ var ActionButton = observer15(
|
|
|
3027
3268
|
}
|
|
3028
3269
|
);
|
|
3029
3270
|
function ActionButtonBody({ label, onClick }) {
|
|
3030
|
-
return /* @__PURE__ */
|
|
3271
|
+
return /* @__PURE__ */ jsx29(
|
|
3031
3272
|
Button6,
|
|
3032
3273
|
{
|
|
3033
3274
|
variant: "primary",
|
|
@@ -3045,14 +3286,14 @@ function ActionButtonBody({ label, onClick }) {
|
|
|
3045
3286
|
}
|
|
3046
3287
|
|
|
3047
3288
|
// src/react/ui/components/collectible-card/Footer.tsx
|
|
3048
|
-
import { Box as Box21, IconButton as IconButton5, Image as Image6, Text as
|
|
3049
|
-
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";
|
|
3050
3291
|
import { useAccount as useAccount6 } from "wagmi";
|
|
3051
3292
|
|
|
3052
3293
|
// src/react/ui/icons/Bell.tsx
|
|
3053
3294
|
import { Box as Box20 } from "@0xsequence/design-system";
|
|
3054
|
-
import { jsx as
|
|
3055
|
-
var Svg2 = () => /* @__PURE__ */
|
|
3295
|
+
import { jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3296
|
+
var Svg2 = () => /* @__PURE__ */ jsxs22(
|
|
3056
3297
|
"svg",
|
|
3057
3298
|
{
|
|
3058
3299
|
width: "17",
|
|
@@ -3060,18 +3301,23 @@ var Svg2 = () => /* @__PURE__ */ jsx31(
|
|
|
3060
3301
|
viewBox: "0 0 17 17",
|
|
3061
3302
|
fill: "none",
|
|
3062
3303
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
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
|
+
]
|
|
3072
3318
|
}
|
|
3073
3319
|
);
|
|
3074
|
-
var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */
|
|
3320
|
+
var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx30(
|
|
3075
3321
|
Box20,
|
|
3076
3322
|
{
|
|
3077
3323
|
as: Svg2,
|
|
@@ -3084,7 +3330,7 @@ var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx31(
|
|
|
3084
3330
|
var Bell_default = SvgBellIcon;
|
|
3085
3331
|
|
|
3086
3332
|
// src/react/ui/components/collectible-card/Footer.tsx
|
|
3087
|
-
import { jsx as
|
|
3333
|
+
import { jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3088
3334
|
var Footer = ({
|
|
3089
3335
|
name,
|
|
3090
3336
|
type,
|
|
@@ -3098,12 +3344,12 @@ var Footer = ({
|
|
|
3098
3344
|
const { address } = useAccount6();
|
|
3099
3345
|
const listed = !!lowestListingPriceAmount && !!lowestListingCurrency;
|
|
3100
3346
|
if (name.length > 15 && highestOffer) {
|
|
3101
|
-
name = name.substring(0, 13)
|
|
3347
|
+
name = `${name.substring(0, 13)}...`;
|
|
3102
3348
|
}
|
|
3103
3349
|
if (name.length > 17 && !highestOffer) {
|
|
3104
|
-
name = name.substring(0, 17)
|
|
3350
|
+
name = `${name.substring(0, 17)}...`;
|
|
3105
3351
|
}
|
|
3106
|
-
return /* @__PURE__ */
|
|
3352
|
+
return /* @__PURE__ */ jsxs23(
|
|
3107
3353
|
Box21,
|
|
3108
3354
|
{
|
|
3109
3355
|
display: "flex",
|
|
@@ -3115,7 +3361,7 @@ var Footer = ({
|
|
|
3115
3361
|
position: "relative",
|
|
3116
3362
|
className: !!address && isAnimated ? footer.animated : footer.static,
|
|
3117
3363
|
children: [
|
|
3118
|
-
/* @__PURE__ */
|
|
3364
|
+
/* @__PURE__ */ jsxs23(
|
|
3119
3365
|
Box21,
|
|
3120
3366
|
{
|
|
3121
3367
|
display: "flex",
|
|
@@ -3124,8 +3370,8 @@ var Footer = ({
|
|
|
3124
3370
|
position: "relative",
|
|
3125
3371
|
width: "full",
|
|
3126
3372
|
children: [
|
|
3127
|
-
/* @__PURE__ */
|
|
3128
|
-
|
|
3373
|
+
/* @__PURE__ */ jsx31(
|
|
3374
|
+
Text16,
|
|
3129
3375
|
{
|
|
3130
3376
|
color: "text100",
|
|
3131
3377
|
fontSize: "normal",
|
|
@@ -3135,7 +3381,7 @@ var Footer = ({
|
|
|
3135
3381
|
children: name
|
|
3136
3382
|
}
|
|
3137
3383
|
),
|
|
3138
|
-
highestOffer && onOfferClick && /* @__PURE__ */
|
|
3384
|
+
highestOffer && onOfferClick && /* @__PURE__ */ jsx31(
|
|
3139
3385
|
IconButton5,
|
|
3140
3386
|
{
|
|
3141
3387
|
size: "xs",
|
|
@@ -3148,16 +3394,16 @@ var Footer = ({
|
|
|
3148
3394
|
e.stopPropagation();
|
|
3149
3395
|
onOfferClick?.();
|
|
3150
3396
|
},
|
|
3151
|
-
icon: (props) => /* @__PURE__ */
|
|
3397
|
+
icon: (props) => /* @__PURE__ */ jsx31(Bell_default, { ...props, size: "xs" })
|
|
3152
3398
|
}
|
|
3153
3399
|
)
|
|
3154
3400
|
]
|
|
3155
3401
|
}
|
|
3156
3402
|
),
|
|
3157
|
-
/* @__PURE__ */
|
|
3158
|
-
listed && /* @__PURE__ */
|
|
3159
|
-
/* @__PURE__ */
|
|
3160
|
-
|
|
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,
|
|
3161
3407
|
{
|
|
3162
3408
|
color: listed ? "text100" : "text50",
|
|
3163
3409
|
fontSize: "small",
|
|
@@ -3165,16 +3411,16 @@ var Footer = ({
|
|
|
3165
3411
|
textAlign: "left",
|
|
3166
3412
|
fontFamily: "body",
|
|
3167
3413
|
children: [
|
|
3168
|
-
listed &&
|
|
3414
|
+
listed && `${formatUnits4(
|
|
3169
3415
|
BigInt(lowestListingPriceAmount),
|
|
3170
3416
|
lowestListingCurrency.decimals
|
|
3171
|
-
)
|
|
3417
|
+
)} ${lowestListingCurrency.symbol}`,
|
|
3172
3418
|
!listed && "Not listed yet"
|
|
3173
3419
|
]
|
|
3174
3420
|
}
|
|
3175
3421
|
)
|
|
3176
3422
|
] }),
|
|
3177
|
-
/* @__PURE__ */
|
|
3423
|
+
/* @__PURE__ */ jsx31(TokenTypeBalancePill, { balance, type })
|
|
3178
3424
|
]
|
|
3179
3425
|
}
|
|
3180
3426
|
);
|
|
@@ -3183,9 +3429,9 @@ var TokenTypeBalancePill = ({
|
|
|
3183
3429
|
balance,
|
|
3184
3430
|
type
|
|
3185
3431
|
}) => {
|
|
3186
|
-
const displayText = type === "ERC1155" /* ERC1155 */ ?
|
|
3187
|
-
return /* @__PURE__ */
|
|
3188
|
-
|
|
3432
|
+
const displayText = type === "ERC1155" /* ERC1155 */ ? balance ? `Owned: ${balance}` : "ERC-1155" : "ERC-721";
|
|
3433
|
+
return /* @__PURE__ */ jsx31(
|
|
3434
|
+
Text16,
|
|
3189
3435
|
{
|
|
3190
3436
|
background: "backgroundSecondary",
|
|
3191
3437
|
color: "text80",
|
|
@@ -3201,9 +3447,9 @@ var TokenTypeBalancePill = ({
|
|
|
3201
3447
|
};
|
|
3202
3448
|
|
|
3203
3449
|
// src/react/ui/components/collectible-card/CollectibleCard.tsx
|
|
3204
|
-
import { jsx as
|
|
3450
|
+
import { jsx as jsx32, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3205
3451
|
function CollectibleSkeleton() {
|
|
3206
|
-
return /* @__PURE__ */
|
|
3452
|
+
return /* @__PURE__ */ jsxs24(
|
|
3207
3453
|
Box22,
|
|
3208
3454
|
{
|
|
3209
3455
|
className: collectibleCard,
|
|
@@ -3211,14 +3457,14 @@ function CollectibleSkeleton() {
|
|
|
3211
3457
|
overflow: "hidden",
|
|
3212
3458
|
background: "backgroundPrimary",
|
|
3213
3459
|
children: [
|
|
3214
|
-
/* @__PURE__ */
|
|
3460
|
+
/* @__PURE__ */ jsx32(
|
|
3215
3461
|
Skeleton8,
|
|
3216
3462
|
{
|
|
3217
3463
|
size: "lg",
|
|
3218
3464
|
style: { width: "100%", height: 164, borderRadius: 0, paddingTop: 16 }
|
|
3219
3465
|
}
|
|
3220
3466
|
),
|
|
3221
|
-
/* @__PURE__ */
|
|
3467
|
+
/* @__PURE__ */ jsxs24(
|
|
3222
3468
|
Box22,
|
|
3223
3469
|
{
|
|
3224
3470
|
display: "flex",
|
|
@@ -3228,8 +3474,8 @@ function CollectibleSkeleton() {
|
|
|
3228
3474
|
paddingBottom: "4",
|
|
3229
3475
|
marginTop: "2",
|
|
3230
3476
|
children: [
|
|
3231
|
-
/* @__PURE__ */
|
|
3232
|
-
/* @__PURE__ */
|
|
3477
|
+
/* @__PURE__ */ jsx32(Skeleton8, { size: "lg" }),
|
|
3478
|
+
/* @__PURE__ */ jsx32(Skeleton8, { size: "sm" })
|
|
3233
3479
|
]
|
|
3234
3480
|
}
|
|
3235
3481
|
)
|
|
@@ -3251,7 +3497,7 @@ function CollectibleCard({
|
|
|
3251
3497
|
}) {
|
|
3252
3498
|
const { address: accountAddress } = useAccount7();
|
|
3253
3499
|
const collectibleMetadata = lowestListing?.metadata;
|
|
3254
|
-
const [imageLoadingError, setImageLoadingError] =
|
|
3500
|
+
const [imageLoadingError, setImageLoadingError] = useState12(false);
|
|
3255
3501
|
const { data: highestOffer, isLoading: highestOfferLoading } = useHighestOffer({
|
|
3256
3502
|
chainId: String(chainId),
|
|
3257
3503
|
collectionAddress,
|
|
@@ -3263,20 +3509,20 @@ function CollectibleCard({
|
|
|
3263
3509
|
(currency) => currency.contractAddress === lowestListing?.order?.priceCurrencyAddress
|
|
3264
3510
|
);
|
|
3265
3511
|
if (highestOfferLoading || cardLoading) {
|
|
3266
|
-
return /* @__PURE__ */
|
|
3512
|
+
return /* @__PURE__ */ jsx32(CollectibleSkeleton, {});
|
|
3267
3513
|
}
|
|
3268
|
-
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 */;
|
|
3269
3515
|
const name = collectibleMetadata?.name;
|
|
3270
3516
|
const image = collectibleMetadata?.image;
|
|
3271
3517
|
const externalUrl = collectibleMetadata?.external_url;
|
|
3272
|
-
return /* @__PURE__ */
|
|
3518
|
+
return /* @__PURE__ */ jsx32(
|
|
3273
3519
|
Box22,
|
|
3274
3520
|
{
|
|
3275
3521
|
className: collectibleCard,
|
|
3276
3522
|
borderRadius: "md",
|
|
3277
3523
|
overflow: "hidden",
|
|
3278
3524
|
background: "backgroundPrimary",
|
|
3279
|
-
children: /* @__PURE__ */
|
|
3525
|
+
children: /* @__PURE__ */ jsx32(
|
|
3280
3526
|
Box22,
|
|
3281
3527
|
{
|
|
3282
3528
|
display: "flex",
|
|
@@ -3292,8 +3538,8 @@ function CollectibleCard({
|
|
|
3292
3538
|
cursor: "pointer",
|
|
3293
3539
|
padding: "0",
|
|
3294
3540
|
className: collectibleTileWrapper,
|
|
3295
|
-
children: /* @__PURE__ */
|
|
3296
|
-
externalUrl && /* @__PURE__ */
|
|
3541
|
+
children: /* @__PURE__ */ jsxs24("article", { style: { width: "100%" }, children: [
|
|
3542
|
+
externalUrl && /* @__PURE__ */ jsx32(
|
|
3297
3543
|
IconButton6,
|
|
3298
3544
|
{
|
|
3299
3545
|
as: "a",
|
|
@@ -3310,7 +3556,7 @@ function CollectibleCard({
|
|
|
3310
3556
|
icon: DiamondEye_default
|
|
3311
3557
|
}
|
|
3312
3558
|
),
|
|
3313
|
-
/* @__PURE__ */
|
|
3559
|
+
/* @__PURE__ */ jsx32(
|
|
3314
3560
|
"img",
|
|
3315
3561
|
{
|
|
3316
3562
|
src: imageLoadingError ? chess_tile_default : image || chess_tile_default,
|
|
@@ -3319,10 +3565,10 @@ function CollectibleCard({
|
|
|
3319
3565
|
onError: () => setImageLoadingError(true)
|
|
3320
3566
|
}
|
|
3321
3567
|
),
|
|
3322
|
-
/* @__PURE__ */
|
|
3568
|
+
/* @__PURE__ */ jsx32(
|
|
3323
3569
|
Footer,
|
|
3324
3570
|
{
|
|
3325
|
-
name,
|
|
3571
|
+
name: name || "",
|
|
3326
3572
|
type: collectionType,
|
|
3327
3573
|
onOfferClick: () => onOfferClick?.({ order: highestOffer?.order }),
|
|
3328
3574
|
highestOffer: highestOffer?.order,
|
|
@@ -3332,7 +3578,7 @@ function CollectibleCard({
|
|
|
3332
3578
|
isAnimated: !!action
|
|
3333
3579
|
}
|
|
3334
3580
|
),
|
|
3335
|
-
accountAddress && (highestOffer || lowestListing) && /* @__PURE__ */
|
|
3581
|
+
accountAddress && (highestOffer || lowestListing) && /* @__PURE__ */ jsx32(
|
|
3336
3582
|
Box22,
|
|
3337
3583
|
{
|
|
3338
3584
|
display: "flex",
|
|
@@ -3340,7 +3586,7 @@ function CollectibleCard({
|
|
|
3340
3586
|
justifyContent: "center",
|
|
3341
3587
|
padding: "2",
|
|
3342
3588
|
className: actionWrapper,
|
|
3343
|
-
children: /* @__PURE__ */
|
|
3589
|
+
children: /* @__PURE__ */ jsx32(
|
|
3344
3590
|
ActionButton,
|
|
3345
3591
|
{
|
|
3346
3592
|
chainId: String(chainId),
|
|
@@ -3372,4 +3618,4 @@ export {
|
|
|
3372
3618
|
ModalProvider,
|
|
3373
3619
|
CollectibleCard
|
|
3374
3620
|
};
|
|
3375
|
-
//# sourceMappingURL=chunk-
|
|
3621
|
+
//# sourceMappingURL=chunk-IOTKCWOB.js.map
|