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