@0xsequence/marketplace-sdk 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chess-tile-6BS5MQT5.png +0 -0
- package/dist/{chunk-5EOVZAKT.js → chunk-BJE7AG6V.js} +213 -97
- package/dist/chunk-BJE7AG6V.js.map +1 -0
- package/dist/{chunk-FCQCNLFZ.js → chunk-G33554LK.js} +4 -1
- package/dist/chunk-G33554LK.js.map +1 -0
- package/dist/{chunk-GZIA25G4.js → chunk-GZG2QO64.js} +22 -6
- package/dist/chunk-GZG2QO64.js.map +1 -0
- package/dist/{chunk-4E34HVSA.js → chunk-MQR6SHXZ.js} +93 -93
- package/dist/chunk-MQR6SHXZ.js.map +1 -0
- package/dist/{chunk-LFQB477Y.js → chunk-OUWB3FHZ.js} +17 -17
- package/dist/chunk-OUWB3FHZ.js.map +1 -0
- package/dist/{chunk-MD4JHPMH.js → chunk-QXLZPSSR.js} +1195 -694
- package/dist/chunk-QXLZPSSR.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/{marketplace.gen-Ceofb9Cs.d.ts → marketplace.gen-BLP7822q.d.ts} +17 -5
- package/dist/react/_internal/api/index.d.ts +4 -2
- package/dist/react/_internal/api/index.js +1 -1
- package/dist/react/_internal/index.d.ts +3 -3
- package/dist/react/_internal/index.js +7 -7
- package/dist/react/hooks/index.d.ts +242 -31
- package/dist/react/hooks/index.js +15 -3
- package/dist/react/index.css +66 -26
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.ts +5 -4
- package/dist/react/index.js +23 -9
- package/dist/react/ssr/index.js +4 -3
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/index.css +276 -0
- package/dist/react/ui/components/index.css.map +1 -0
- package/dist/react/ui/components/index.d.ts +17 -0
- package/dist/react/ui/components/index.js +24 -0
- package/dist/react/ui/components/index.js.map +1 -0
- package/dist/react/ui/icons/index.js +1 -1
- package/dist/react/ui/index.css +66 -26
- package/dist/react/ui/index.css.map +1 -1
- package/dist/react/ui/index.d.ts +5 -2
- package/dist/react/ui/index.js +9 -7
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +1 -1
- package/dist/{services-Dei25J6_.d.ts → services-C9-lvWcC.d.ts} +1 -1
- package/dist/styles/index.js +4 -4
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +2 -2
- package/dist/{types-BzZVURNL.d.ts → types-QqXjNuUP.d.ts} +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +3 -3
- package/package.json +1 -1
- package/src/react/_internal/api/get-query-client.ts +3 -3
- package/src/react/_internal/api/marketplace.gen.ts +34 -10
- package/src/react/_internal/api/query-keys.ts +8 -0
- package/src/react/hooks/index.ts +3 -0
- package/src/react/hooks/useCheckoutOptions.tsx +43 -43
- package/src/react/hooks/useCountOfCollectables.tsx +52 -52
- package/src/react/hooks/useCurrencies.tsx +60 -60
- package/src/react/hooks/useCurrency.tsx +64 -0
- package/src/react/hooks/useGenerateCancleTransaction.tsx +50 -0
- package/src/react/hooks/useListBalances.tsx +2 -3
- package/src/react/hooks/useListCollectibles.tsx +5 -6
- package/src/react/hooks/useListCollections.tsx +88 -0
- package/src/react/hooks/useListListingsForCollectible.tsx +61 -0
- package/src/react/hooks/useListOffersForCollectible.tsx +14 -16
- package/src/react/ui/components/_internals/action-button/ActionButton.tsx +164 -0
- package/src/react/ui/components/_internals/custom-network-image/CustomNetworkImage.tsx +27 -0
- package/src/react/ui/components/_internals/custom-network-image/styles.css.ts +51 -0
- package/src/react/ui/components/_internals/pill/Pill.tsx +20 -0
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +194 -0
- package/src/react/ui/components/collectible-card/Footer.tsx +121 -0
- package/src/react/ui/components/collectible-card/styles.css.ts +62 -0
- package/src/react/ui/components/index.ts +1 -0
- package/src/react/ui/icons/Bell.tsx +31 -0
- package/src/react/ui/icons/DiamondEye.tsx +31 -0
- package/src/react/ui/images/chess-tile.png +0 -0
- package/src/react/ui/index.ts +3 -0
- package/src/react/ui/modals/CreateListingModal/index.tsx +152 -152
- package/src/react/ui/modals/SellModal/index.tsx +0 -1
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +92 -92
- package/src/react/ui/modals/TransferModal/index.tsx +1 -1
- package/src/react/ui/modals/modal-provider.tsx +2 -3
- package/src/types/custom.d.ts +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/chunk-4E34HVSA.js.map +0 -1
- package/dist/chunk-5EOVZAKT.js.map +0 -1
- package/dist/chunk-FCQCNLFZ.js.map +0 -1
- package/dist/chunk-GZIA25G4.js.map +0 -1
- package/dist/chunk-LFQB477Y.js.map +0 -1
- package/dist/chunk-MD4JHPMH.js.map +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client"
|
|
2
|
+
import {
|
|
3
|
+
ActionModal
|
|
4
|
+
} from "./chunk-CSN7YD5Q.js";
|
|
2
5
|
import {
|
|
3
6
|
CalendarIcon_default,
|
|
4
7
|
InfoIcon_default,
|
|
5
8
|
MinusIcon_default,
|
|
6
9
|
PlusIcon_default,
|
|
7
10
|
PositiveCircleIcon_default
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import {
|
|
10
|
-
ActionModal
|
|
11
|
-
} from "./chunk-CSN7YD5Q.js";
|
|
11
|
+
} from "./chunk-MQR6SHXZ.js";
|
|
12
12
|
import {
|
|
13
13
|
alertMessageBox,
|
|
14
14
|
alertMessageBoxVariants,
|
|
@@ -34,20 +34,25 @@ import {
|
|
|
34
34
|
switchChainModalContent,
|
|
35
35
|
tokenPreview,
|
|
36
36
|
transferModalContent
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-OUWB3FHZ.js";
|
|
38
38
|
import {
|
|
39
|
+
iconVariants
|
|
40
|
+
} from "./chunk-VEX7FDL6.js";
|
|
41
|
+
import {
|
|
42
|
+
useBalanceOfCollectible,
|
|
39
43
|
useCollectible,
|
|
40
44
|
useCollection,
|
|
41
45
|
useCurrencies,
|
|
42
46
|
useGenerateListingTransaction,
|
|
43
47
|
useGenerateOfferTransaction,
|
|
44
48
|
useGenerateSellTransaction,
|
|
49
|
+
useHighestOffer,
|
|
45
50
|
useListBalances,
|
|
46
51
|
useLowestListing,
|
|
47
52
|
useMarketplaceConfig,
|
|
48
53
|
useRoyaltyPercentage,
|
|
49
54
|
useTransferTokens
|
|
50
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-BJE7AG6V.js";
|
|
51
56
|
import {
|
|
52
57
|
calculatePriceDifferencePercentage,
|
|
53
58
|
truncateMiddle
|
|
@@ -56,635 +61,128 @@ import {
|
|
|
56
61
|
balanceQueries,
|
|
57
62
|
collectableKeys,
|
|
58
63
|
getQueryClient
|
|
59
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-GZG2QO64.js";
|
|
60
65
|
|
|
61
66
|
// src/react/ui/modals/modal-provider.tsx
|
|
62
67
|
import { observer as observer14 } from "@legendapp/state/react";
|
|
63
68
|
|
|
64
|
-
// src/react/ui/modals/
|
|
65
|
-
import {
|
|
66
|
-
|
|
67
|
-
// src/react/ui/modals/_internal/components/switchChainModal/store.ts
|
|
69
|
+
// src/react/ui/modals/Account/index.tsx
|
|
70
|
+
import { Box, Button, Modal, Text } from "@0xsequence/design-system";
|
|
68
71
|
import { observable } from "@legendapp/state";
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
open: ({ chainIdToSwitchTo, onSwitchChain, callbacks }) => {
|
|
72
|
-
switchChainModal$.state.set({
|
|
73
|
-
...switchChainModal$.state.get(),
|
|
74
|
-
chainIdToSwitchTo,
|
|
75
|
-
onSwitchChain,
|
|
76
|
-
callbacks
|
|
77
|
-
});
|
|
78
|
-
switchChainModal$.isOpen.set(true);
|
|
79
|
-
},
|
|
80
|
-
close: () => {
|
|
81
|
-
switchChainModal$.isOpen.set(false);
|
|
82
|
-
switchChainModal$.state.set({
|
|
83
|
-
...initialState.state
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
state: {
|
|
87
|
-
chainIdToSwitchTo: void 0,
|
|
88
|
-
onSwitchChain: () => {
|
|
89
|
-
},
|
|
90
|
-
isSwitching: false
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
var switchChainModal$ = observable(initialState);
|
|
94
|
-
|
|
95
|
-
// src/react/ui/modals/_internal/components/switchChainModal/index.tsx
|
|
96
|
-
import {
|
|
97
|
-
Button,
|
|
98
|
-
CloseIcon,
|
|
99
|
-
IconButton,
|
|
100
|
-
Spinner,
|
|
101
|
-
Text as Text2
|
|
102
|
-
} from "@0xsequence/design-system";
|
|
103
|
-
|
|
104
|
-
// src/react/ui/modals/_internal/components/alertMessage/index.tsx
|
|
105
|
-
import { Box, Text, WarningIcon } from "@0xsequence/design-system";
|
|
72
|
+
import { observer } from "@legendapp/state/react";
|
|
73
|
+
import { useAccount } from "wagmi";
|
|
106
74
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
75
|
+
var accountModalOpen$ = observable(false);
|
|
76
|
+
var AccountModal = observer(function AccountModal2() {
|
|
77
|
+
const { address } = useAccount();
|
|
78
|
+
return accountModalOpen$.get() && /* @__PURE__ */ jsxs(Modal, { children: [
|
|
79
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
80
|
+
/* @__PURE__ */ jsx(Text, { children: "Wallet address" }),
|
|
81
|
+
/* @__PURE__ */ jsx(Text, { children: address })
|
|
82
|
+
] }),
|
|
83
|
+
/* @__PURE__ */ jsx(Button, { label: "Sign out" })
|
|
112
84
|
] });
|
|
113
|
-
}
|
|
85
|
+
});
|
|
114
86
|
|
|
115
|
-
// src/react/ui/modals/
|
|
116
|
-
import {
|
|
117
|
-
import {
|
|
118
|
-
import {
|
|
87
|
+
// src/react/ui/modals/CreateListingModal/index.tsx
|
|
88
|
+
import { Box as Box12 } from "@0xsequence/design-system";
|
|
89
|
+
import { Show, observer as observer8 } from "@legendapp/state/react";
|
|
90
|
+
import { useAccount as useAccount4 } from "wagmi";
|
|
119
91
|
|
|
120
|
-
// src/
|
|
121
|
-
import {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
};
|
|
92
|
+
// src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
|
|
93
|
+
import { useState } from "react";
|
|
94
|
+
import { Box as Box2, Select, Text as Text2 } from "@0xsequence/design-system";
|
|
95
|
+
import { observer as observer2 } from "@legendapp/state/react";
|
|
96
|
+
import { addDays, isSameDay } from "date-fns";
|
|
125
97
|
|
|
126
|
-
// src/react/ui/modals/_internal/components/
|
|
127
|
-
import {
|
|
128
|
-
import {
|
|
129
|
-
import {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
await switchChainAsync({ chainId: chainIdToSwitchTo });
|
|
152
|
-
switchChainModal$.state.onSwitchChain();
|
|
153
|
-
onSuccess && onSuccess();
|
|
154
|
-
switchChainModal$.close();
|
|
155
|
-
} catch (error) {
|
|
156
|
-
if (error instanceof BaseError) {
|
|
157
|
-
const name = error.name;
|
|
158
|
-
switch (name) {
|
|
159
|
-
case SwitchChainNotSupportedError.name:
|
|
160
|
-
onSwitchingNotSupported && onSwitchingNotSupported();
|
|
161
|
-
break;
|
|
162
|
-
case UserRejectedRequestError.name:
|
|
163
|
-
onUserRejectedRequest && onUserRejectedRequest();
|
|
164
|
-
break;
|
|
165
|
-
default:
|
|
166
|
-
onUnknownError && onUnknownError(error);
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
} else {
|
|
170
|
-
onUnknownError && onUnknownError(error);
|
|
171
|
-
}
|
|
172
|
-
} finally {
|
|
173
|
-
isSwitching$.set(false);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return /* @__PURE__ */ jsx2(Root, { open: switchChainModal$.isOpen.get(), children: /* @__PURE__ */ jsxs2(Portal, { children: [
|
|
177
|
-
/* @__PURE__ */ jsx2(Overlay, { className: dialogOverlay }),
|
|
178
|
-
/* @__PURE__ */ jsxs2(Content, { className: switchChainModalContent, children: [
|
|
179
|
-
/* @__PURE__ */ jsx2(Text2, { fontSize: "large", fontWeight: "bold", color: "text100", children: "Wrong network" }),
|
|
180
|
-
/* @__PURE__ */ jsx2(
|
|
181
|
-
AlertMessage,
|
|
182
|
-
{
|
|
183
|
-
type: "warning",
|
|
184
|
-
message: `You need to switch to ${chainName} network before completing the transaction`
|
|
185
|
-
}
|
|
186
|
-
),
|
|
187
|
-
/* @__PURE__ */ jsx2(
|
|
188
|
-
Button,
|
|
189
|
-
{
|
|
190
|
-
name: "switch-chain",
|
|
191
|
-
size: "sm",
|
|
192
|
-
label: isSwitching$.get() ? /* @__PURE__ */ jsx2(Spinner, {}) : "Switch Network",
|
|
193
|
-
variant: "primary",
|
|
194
|
-
pending: isSwitching$.get(),
|
|
195
|
-
shape: "square",
|
|
196
|
-
className: isSwitching$.get() ? switchChainCta.pending : switchChainCta.default,
|
|
197
|
-
justifySelf: "flex-end",
|
|
198
|
-
onClick: handleSwitchChain
|
|
98
|
+
// src/react/ui/modals/_internal/components/calendarPopover/index.tsx
|
|
99
|
+
import { Button as Button2 } from "@0xsequence/design-system";
|
|
100
|
+
import { Content, Portal, Root, Trigger } from "@radix-ui/react-popover";
|
|
101
|
+
import { format } from "date-fns";
|
|
102
|
+
|
|
103
|
+
// src/react/ui/modals/_internal/components/calendar/index.tsx
|
|
104
|
+
import { DayPicker } from "react-day-picker";
|
|
105
|
+
import "react-day-picker/style.css";
|
|
106
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
107
|
+
function Calendar({ ...props }) {
|
|
108
|
+
const { selectedDate, setSelectedDate } = props;
|
|
109
|
+
return /* @__PURE__ */ jsx2(
|
|
110
|
+
DayPicker,
|
|
111
|
+
{
|
|
112
|
+
disabled: {
|
|
113
|
+
before: /* @__PURE__ */ new Date()
|
|
114
|
+
},
|
|
115
|
+
selected: selectedDate,
|
|
116
|
+
onDayClick: setSelectedDate,
|
|
117
|
+
defaultMonth: selectedDate,
|
|
118
|
+
modifiersStyles: {
|
|
119
|
+
selected: {
|
|
120
|
+
color: "hsl(var(--foreground))",
|
|
121
|
+
background: "hsl(var(--primary))",
|
|
122
|
+
border: "none"
|
|
199
123
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
124
|
+
},
|
|
125
|
+
styles: {
|
|
126
|
+
root: {
|
|
127
|
+
width: "max-content",
|
|
128
|
+
margin: 0,
|
|
129
|
+
color: "hsl(var(--foreground))",
|
|
130
|
+
background: "hsl(var(--background))",
|
|
131
|
+
border: `1px solid hsl(var(--border))`,
|
|
132
|
+
borderRadius: "var(--radius)",
|
|
133
|
+
padding: "0.5rem",
|
|
134
|
+
position: "relative"
|
|
135
|
+
},
|
|
136
|
+
day: {
|
|
137
|
+
margin: 0,
|
|
138
|
+
width: "1rem",
|
|
139
|
+
height: "1rem"
|
|
140
|
+
},
|
|
141
|
+
day_button: {
|
|
142
|
+
margin: 0,
|
|
143
|
+
width: "1.8rem",
|
|
144
|
+
height: "1.5rem",
|
|
145
|
+
padding: 0,
|
|
146
|
+
border: "none"
|
|
210
147
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
import {
|
|
219
|
-
CloseIcon as CloseIcon2,
|
|
220
|
-
IconButton as IconButton2,
|
|
221
|
-
Skeleton,
|
|
222
|
-
Text as Text6
|
|
223
|
-
} from "@0xsequence/design-system";
|
|
224
|
-
import { observer as observer3 } from "@legendapp/state/react";
|
|
225
|
-
import { Close as Close2, Content as Content2, Overlay as Overlay2, Portal as Portal2, Root as Root2 } from "@radix-ui/react-dialog";
|
|
226
|
-
import { useEffect as useEffect2 } from "react";
|
|
227
|
-
import { useTransactionReceipt } from "wagmi";
|
|
148
|
+
},
|
|
149
|
+
...props
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
Calendar.displayName = "Calendar";
|
|
154
|
+
var calendar_default = Calendar;
|
|
228
155
|
|
|
229
|
-
// src/react/ui/modals/_internal/components/
|
|
230
|
-
import {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
isConfirming,
|
|
235
|
-
isConfirmed,
|
|
236
|
-
isFailed
|
|
156
|
+
// src/react/ui/modals/_internal/components/calendarPopover/index.tsx
|
|
157
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
158
|
+
function CalendarPopover({
|
|
159
|
+
selectedDate,
|
|
160
|
+
setSelectedDate
|
|
237
161
|
}) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
icon,
|
|
242
|
-
/* @__PURE__ */ jsx3(Text3, { color: "text50", fontSize: "normal", fontWeight: "medium", marginLeft: "2", children: title }),
|
|
243
|
-
/* @__PURE__ */ jsx3(
|
|
244
|
-
Text3,
|
|
162
|
+
return /* @__PURE__ */ jsxs2(Root, { children: [
|
|
163
|
+
/* @__PURE__ */ jsx3(Trigger, { asChild: true, children: /* @__PURE__ */ jsx3(
|
|
164
|
+
Button2,
|
|
245
165
|
{
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
marginLeft: "2",
|
|
252
|
-
children: truncateMiddle(transactionHash, 4, 4)
|
|
166
|
+
leftIcon: CalendarIcon_default,
|
|
167
|
+
className: dateSelectButton,
|
|
168
|
+
variant: "ghost",
|
|
169
|
+
label: format(selectedDate, "dd/MM/yyyy HH:mm"),
|
|
170
|
+
shape: "square"
|
|
253
171
|
}
|
|
254
|
-
)
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
// src/react/ui/modals/_internal/components/timeAgo/index.tsx
|
|
264
|
-
import { Box as Box3, Text as Text4 } from "@0xsequence/design-system";
|
|
265
|
-
import { formatDistanceToNow } from "date-fns";
|
|
266
|
-
import { useState, useEffect } from "react";
|
|
267
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
268
|
-
function TimeAgo({ date }) {
|
|
269
|
-
const [timeAgo, setTimeAgo] = useState("");
|
|
270
|
-
useEffect(() => {
|
|
271
|
-
const interval = setInterval(() => {
|
|
272
|
-
setTimeAgo(formatDistanceToNow(date));
|
|
273
|
-
}, 1e3);
|
|
274
|
-
return () => clearInterval(interval);
|
|
275
|
-
}, [date]);
|
|
276
|
-
return /* @__PURE__ */ jsx4(
|
|
277
|
-
Box3,
|
|
278
|
-
{
|
|
279
|
-
flexGrow: "1",
|
|
280
|
-
display: "flex",
|
|
281
|
-
alignItems: "center",
|
|
282
|
-
justifyContent: "flex-end",
|
|
283
|
-
children: /* @__PURE__ */ jsx4(Text4, { color: "text50", fontSize: "small", children: timeAgo })
|
|
284
|
-
}
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// src/react/ui/modals/_internal/components/transactionStatusModal/store.ts
|
|
289
|
-
import { observable as observable2 } from "@legendapp/state";
|
|
290
|
-
var initialState2 = {
|
|
291
|
-
isOpen: false,
|
|
292
|
-
open: ({
|
|
293
|
-
hash,
|
|
294
|
-
price,
|
|
295
|
-
collectionAddress,
|
|
296
|
-
chainId,
|
|
297
|
-
tokenId,
|
|
298
|
-
getTitle,
|
|
299
|
-
getMessage: getMessage2,
|
|
300
|
-
type,
|
|
301
|
-
callbacks,
|
|
302
|
-
queriesToInvalidate
|
|
303
|
-
}) => {
|
|
304
|
-
transactionStatusModal$.state.set({
|
|
305
|
-
...transactionStatusModal$.state.get(),
|
|
306
|
-
hash,
|
|
307
|
-
price,
|
|
308
|
-
collectionAddress,
|
|
309
|
-
chainId,
|
|
310
|
-
tokenId,
|
|
311
|
-
getTitle,
|
|
312
|
-
getMessage: getMessage2,
|
|
313
|
-
type,
|
|
314
|
-
callbacks,
|
|
315
|
-
queriesToInvalidate
|
|
316
|
-
});
|
|
317
|
-
transactionStatusModal$.isOpen.set(true);
|
|
318
|
-
},
|
|
319
|
-
close: () => {
|
|
320
|
-
transactionStatusModal$.isOpen.set(false);
|
|
321
|
-
transactionStatusModal$.state.set({
|
|
322
|
-
...initialState2.state
|
|
323
|
-
});
|
|
324
|
-
},
|
|
325
|
-
state: {
|
|
326
|
-
hash: void 0,
|
|
327
|
-
status: "PENDING",
|
|
328
|
-
price: void 0,
|
|
329
|
-
collectionAddress: "",
|
|
330
|
-
chainId: "",
|
|
331
|
-
tokenId: "",
|
|
332
|
-
getTitle: void 0,
|
|
333
|
-
getMessage: void 0,
|
|
334
|
-
type: void 0
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
var transactionStatusModal$ = observable2(initialState2);
|
|
338
|
-
|
|
339
|
-
// src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx
|
|
340
|
-
import { useMemo } from "react";
|
|
341
|
-
|
|
342
|
-
// src/react/ui/modals/_internal/components/transactionPreview/consts.ts
|
|
343
|
-
var TRANSACTION_TITLES = {
|
|
344
|
-
sell: {
|
|
345
|
-
confirming: "Selling",
|
|
346
|
-
confirmed: "Sold",
|
|
347
|
-
failed: "Sale failed"
|
|
348
|
-
},
|
|
349
|
-
createListing: {
|
|
350
|
-
confirming: "Creating listing",
|
|
351
|
-
confirmed: "Listed",
|
|
352
|
-
failed: "Listing failed"
|
|
353
|
-
},
|
|
354
|
-
createOffer: {
|
|
355
|
-
confirming: "Creating offer",
|
|
356
|
-
confirmed: "Offer created",
|
|
357
|
-
failed: "Offer failed"
|
|
358
|
-
},
|
|
359
|
-
buy: {
|
|
360
|
-
confirming: "Buying",
|
|
361
|
-
confirmed: "Bought",
|
|
362
|
-
failed: "Purchase failed"
|
|
363
|
-
},
|
|
364
|
-
transfer: {
|
|
365
|
-
confirming: "Transferring",
|
|
366
|
-
confirmed: "Transferred",
|
|
367
|
-
failed: "Transfer failed"
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
// src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx
|
|
372
|
-
function useTransactionPreviewTitle(status, type) {
|
|
373
|
-
return useMemo(() => {
|
|
374
|
-
if (!type) return "";
|
|
375
|
-
const { isConfirming, isConfirmed, isFailed } = status;
|
|
376
|
-
const titles = TRANSACTION_TITLES[type];
|
|
377
|
-
if (isConfirming) return titles.confirming;
|
|
378
|
-
if (isConfirmed) return titles.confirmed;
|
|
379
|
-
if (isFailed) return titles.failed;
|
|
380
|
-
return "";
|
|
381
|
-
}, [status, type]);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
// src/react/ui/modals/_internal/components/transactionPreview/index.tsx
|
|
385
|
-
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
386
|
-
var TransactionPreview = observer2(
|
|
387
|
-
({
|
|
388
|
-
price,
|
|
389
|
-
collectionAddress,
|
|
390
|
-
chainId,
|
|
391
|
-
collectible,
|
|
392
|
-
isConfirming,
|
|
393
|
-
isConfirmed,
|
|
394
|
-
isFailed
|
|
395
|
-
}) => {
|
|
396
|
-
const { type } = transactionStatusModal$.state.get();
|
|
397
|
-
const title = useTransactionPreviewTitle(
|
|
398
|
-
{ isConfirmed, isConfirming, isFailed },
|
|
399
|
-
type
|
|
400
|
-
);
|
|
401
|
-
const { data: collection } = useCollection({
|
|
402
|
-
collectionAddress,
|
|
403
|
-
chainId
|
|
404
|
-
});
|
|
405
|
-
const collectibleImage = collectible.image;
|
|
406
|
-
const collectibleName = collectible.name;
|
|
407
|
-
const collectionName = collection?.name;
|
|
408
|
-
const priceFormatted = price ? formatUnits(BigInt(price.amountRaw), price.currency.decimals) : void 0;
|
|
409
|
-
return /* @__PURE__ */ jsxs4(Box4, { padding: "3", background: "backgroundSecondary", borderRadius: "md", children: [
|
|
410
|
-
/* @__PURE__ */ jsxs4(Box4, { display: "flex", alignItems: "center", children: [
|
|
411
|
-
/* @__PURE__ */ jsx5(
|
|
412
|
-
Text5,
|
|
413
|
-
{
|
|
414
|
-
color: "text50",
|
|
415
|
-
fontSize: "small",
|
|
416
|
-
fontWeight: "medium",
|
|
417
|
-
marginRight: "1",
|
|
418
|
-
children: title
|
|
419
|
-
}
|
|
420
|
-
),
|
|
421
|
-
/* @__PURE__ */ jsx5(NetworkImage, { chainId: Number(chainId), size: "xs" }),
|
|
422
|
-
isConfirming && /* @__PURE__ */ jsx5(TimeAgo, { date: /* @__PURE__ */ new Date() })
|
|
423
|
-
] }),
|
|
424
|
-
/* @__PURE__ */ jsxs4(Box4, { display: "flex", alignItems: "center", marginTop: "2", children: [
|
|
425
|
-
/* @__PURE__ */ jsx5(
|
|
426
|
-
Image,
|
|
427
|
-
{
|
|
428
|
-
src: collectibleImage,
|
|
429
|
-
alt: collectibleName,
|
|
430
|
-
width: "9",
|
|
431
|
-
height: "9",
|
|
432
|
-
borderRadius: "xs",
|
|
433
|
-
marginRight: "3"
|
|
434
|
-
}
|
|
435
|
-
),
|
|
436
|
-
/* @__PURE__ */ jsxs4(
|
|
437
|
-
Box4,
|
|
438
|
-
{
|
|
439
|
-
display: "flex",
|
|
440
|
-
flexDirection: "column",
|
|
441
|
-
alignItems: "flex-start",
|
|
442
|
-
gap: "0.5",
|
|
443
|
-
children: [
|
|
444
|
-
/* @__PURE__ */ jsx5(Text5, { color: "text80", fontSize: "small", fontWeight: "medium", children: collectibleName }),
|
|
445
|
-
/* @__PURE__ */ jsx5(Text5, { color: "text100", fontSize: "small", children: collectionName })
|
|
446
|
-
]
|
|
447
|
-
}
|
|
448
|
-
),
|
|
449
|
-
price && /* @__PURE__ */ jsxs4(
|
|
450
|
-
Box4,
|
|
451
|
-
{
|
|
452
|
-
flexGrow: "1",
|
|
453
|
-
display: "flex",
|
|
454
|
-
alignItems: "center",
|
|
455
|
-
justifyContent: "flex-end",
|
|
456
|
-
gap: "1",
|
|
457
|
-
children: [
|
|
458
|
-
/* @__PURE__ */ jsx5(NetworkImage, { chainId: Number(chainId), size: "xs" }),
|
|
459
|
-
/* @__PURE__ */ jsxs4(Text5, { color: "text80", fontSize: "small", fontWeight: "medium", children: [
|
|
460
|
-
priceFormatted,
|
|
461
|
-
" ",
|
|
462
|
-
price.currency.symbol
|
|
463
|
-
] })
|
|
464
|
-
]
|
|
465
|
-
}
|
|
466
|
-
)
|
|
467
|
-
] })
|
|
468
|
-
] });
|
|
469
|
-
}
|
|
470
|
-
);
|
|
471
|
-
var transactionPreview_default = TransactionPreview;
|
|
472
|
-
|
|
473
|
-
// src/react/ui/modals/_internal/components/transactionStatusModal/styles.css.ts
|
|
474
|
-
var closeButton4 = "fyvr11lw fyvr1tc fyvr1mo";
|
|
475
|
-
var dialogOverlay4 = "fyvr1m0 fyvr1o8 fyvr1qg fyvr1so fyvr11xl fyvr11m0 fyvr11rs";
|
|
476
|
-
var transactionStatusModalContent = "modal_dialogContent_wide__1ypl6nt3 modal_dialogContentBase__1ypl6nt1 fyvr11hg fyvr11i4 fyvr11g4 fyvr11gs fyvr11l8 fyvr11wl fyvr11m0 fyvr11rs fyvr1vo fyvr1xs fyvr1zw fyvr1120 fyvr11lc fyvr11mc fyvr11cw";
|
|
477
|
-
|
|
478
|
-
// src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
|
|
479
|
-
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
480
|
-
var useTransactionStatusModal = () => {
|
|
481
|
-
return {
|
|
482
|
-
show: (args) => transactionStatusModal$.open(args),
|
|
483
|
-
close: () => transactionStatusModal$.close()
|
|
484
|
-
};
|
|
485
|
-
};
|
|
486
|
-
var TransactionStatusModal = observer3(() => {
|
|
487
|
-
const {
|
|
488
|
-
hash,
|
|
489
|
-
price,
|
|
490
|
-
collectionAddress,
|
|
491
|
-
chainId,
|
|
492
|
-
tokenId,
|
|
493
|
-
getTitle,
|
|
494
|
-
getMessage: getMessage2,
|
|
495
|
-
callbacks,
|
|
496
|
-
queriesToInvalidate
|
|
497
|
-
} = transactionStatusModal$.state.get();
|
|
498
|
-
const { data: collectible } = useCollectible({
|
|
499
|
-
collectionAddress,
|
|
500
|
-
chainId,
|
|
501
|
-
collectibleId: tokenId
|
|
502
|
-
});
|
|
503
|
-
const {
|
|
504
|
-
isLoading: isConfirming,
|
|
505
|
-
isSuccess: isConfirmed,
|
|
506
|
-
isError: isFailed,
|
|
507
|
-
error
|
|
508
|
-
} = useTransactionReceipt({ hash });
|
|
509
|
-
const title = getTitle && getTitle({ isConfirmed, isConfirming, isFailed });
|
|
510
|
-
const message = getMessage2 && getMessage2({ isConfirmed, isConfirming, isFailed });
|
|
511
|
-
const { onUnknownError, onSuccess } = callbacks || {};
|
|
512
|
-
const queryClient = getQueryClient();
|
|
513
|
-
useEffect2(() => {
|
|
514
|
-
if (!transactionStatusModal$.isOpen.get()) return;
|
|
515
|
-
let isSubscribed = true;
|
|
516
|
-
if (isConfirmed && isSubscribed && onSuccess) {
|
|
517
|
-
onSuccess();
|
|
518
|
-
}
|
|
519
|
-
if (isFailed && isSubscribed && onUnknownError) {
|
|
520
|
-
onUnknownError(error);
|
|
521
|
-
}
|
|
522
|
-
if (isSubscribed && queriesToInvalidate) {
|
|
523
|
-
queryClient.invalidateQueries({ queryKey: [...queriesToInvalidate] });
|
|
524
|
-
}
|
|
525
|
-
return () => {
|
|
526
|
-
isSubscribed = false;
|
|
527
|
-
};
|
|
528
|
-
}, [isConfirmed, isFailed, onSuccess, onUnknownError, error]);
|
|
529
|
-
return /* @__PURE__ */ jsx6(Root2, { open: transactionStatusModal$.isOpen.get(), children: /* @__PURE__ */ jsxs5(Portal2, { children: [
|
|
530
|
-
/* @__PURE__ */ jsx6(Overlay2, { className: dialogOverlay4 }),
|
|
531
|
-
/* @__PURE__ */ jsxs5(Content2, { className: transactionStatusModalContent, children: [
|
|
532
|
-
title ? /* @__PURE__ */ jsx6(Text6, { fontSize: "large", fontWeight: "bold", color: "text100", children: title }) : /* @__PURE__ */ jsx6(Skeleton, { width: "16", height: "6" }),
|
|
533
|
-
message ? /* @__PURE__ */ jsx6(Text6, { fontSize: "small", color: "text80", children: message }) : /* @__PURE__ */ jsx6(Skeleton, { width: "20", height: "4" }),
|
|
534
|
-
/* @__PURE__ */ jsx6(
|
|
535
|
-
transactionPreview_default,
|
|
536
|
-
{
|
|
537
|
-
price,
|
|
538
|
-
collectionAddress,
|
|
539
|
-
chainId,
|
|
540
|
-
collectible,
|
|
541
|
-
isConfirming,
|
|
542
|
-
isConfirmed,
|
|
543
|
-
isFailed
|
|
544
|
-
}
|
|
545
|
-
),
|
|
546
|
-
/* @__PURE__ */ jsx6(
|
|
547
|
-
TransactionFooter,
|
|
548
|
-
{
|
|
549
|
-
transactionHash: hash,
|
|
550
|
-
isConfirming,
|
|
551
|
-
isConfirmed,
|
|
552
|
-
isFailed
|
|
553
|
-
}
|
|
554
|
-
),
|
|
555
|
-
/* @__PURE__ */ jsx6(
|
|
556
|
-
Close2,
|
|
557
|
-
{
|
|
558
|
-
onClick: () => {
|
|
559
|
-
transactionStatusModal$.close();
|
|
560
|
-
},
|
|
561
|
-
className: closeButton4,
|
|
562
|
-
asChild: true,
|
|
563
|
-
children: /* @__PURE__ */ jsx6(IconButton2, { size: "xs", "aria-label": "Close modal", icon: CloseIcon2 })
|
|
564
|
-
}
|
|
565
|
-
)
|
|
566
|
-
] })
|
|
567
|
-
] }) });
|
|
568
|
-
});
|
|
569
|
-
var transactionStatusModal_default = TransactionStatusModal;
|
|
570
|
-
|
|
571
|
-
// src/react/ui/modals/Account/index.tsx
|
|
572
|
-
import { Box as Box5, Button as Button2, Modal, Text as Text7 } from "@0xsequence/design-system";
|
|
573
|
-
import { observable as observable3 } from "@legendapp/state";
|
|
574
|
-
import { observer as observer4 } from "@legendapp/state/react";
|
|
575
|
-
import { useAccount } from "wagmi";
|
|
576
|
-
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
577
|
-
var accountModalOpen$ = observable3(false);
|
|
578
|
-
var AccountModal = observer4(function AccountModal2() {
|
|
579
|
-
const { address } = useAccount();
|
|
580
|
-
return accountModalOpen$.get() && /* @__PURE__ */ jsxs6(Modal, { children: [
|
|
581
|
-
/* @__PURE__ */ jsxs6(Box5, { children: [
|
|
582
|
-
/* @__PURE__ */ jsx7(Text7, { children: "Wallet address" }),
|
|
583
|
-
/* @__PURE__ */ jsx7(Text7, { children: address })
|
|
584
|
-
] }),
|
|
585
|
-
/* @__PURE__ */ jsx7(Button2, { label: "Sign out" })
|
|
586
|
-
] });
|
|
587
|
-
});
|
|
588
|
-
|
|
589
|
-
// src/react/ui/modals/CreateListingModal/index.tsx
|
|
590
|
-
import { Box as Box12 } from "@0xsequence/design-system";
|
|
591
|
-
import { Show, observer as observer8 } from "@legendapp/state/react";
|
|
592
|
-
import { useAccount as useAccount4 } from "wagmi";
|
|
593
|
-
|
|
594
|
-
// src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
|
|
595
|
-
import { useState as useState2 } from "react";
|
|
596
|
-
import { Box as Box6, Select, Text as Text8 } from "@0xsequence/design-system";
|
|
597
|
-
import { observer as observer5 } from "@legendapp/state/react";
|
|
598
|
-
import { addDays, isSameDay } from "date-fns";
|
|
599
|
-
|
|
600
|
-
// src/react/ui/modals/_internal/components/calendarPopover/index.tsx
|
|
601
|
-
import { Button as Button3 } from "@0xsequence/design-system";
|
|
602
|
-
import { Content as Content3, Portal as Portal3, Root as Root3, Trigger } from "@radix-ui/react-popover";
|
|
603
|
-
import { format } from "date-fns";
|
|
604
|
-
|
|
605
|
-
// src/react/ui/modals/_internal/components/calendar/index.tsx
|
|
606
|
-
import { DayPicker } from "react-day-picker";
|
|
607
|
-
import "react-day-picker/style.css";
|
|
608
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
609
|
-
function Calendar({ ...props }) {
|
|
610
|
-
const { selectedDate, setSelectedDate } = props;
|
|
611
|
-
return /* @__PURE__ */ jsx8(
|
|
612
|
-
DayPicker,
|
|
613
|
-
{
|
|
614
|
-
disabled: {
|
|
615
|
-
before: /* @__PURE__ */ new Date()
|
|
616
|
-
},
|
|
617
|
-
selected: selectedDate,
|
|
618
|
-
onDayClick: setSelectedDate,
|
|
619
|
-
defaultMonth: selectedDate,
|
|
620
|
-
modifiersStyles: {
|
|
621
|
-
selected: {
|
|
622
|
-
color: "hsl(var(--foreground))",
|
|
623
|
-
background: "hsl(var(--primary))",
|
|
624
|
-
border: "none"
|
|
625
|
-
}
|
|
626
|
-
},
|
|
627
|
-
styles: {
|
|
628
|
-
root: {
|
|
629
|
-
width: "max-content",
|
|
630
|
-
margin: 0,
|
|
631
|
-
color: "hsl(var(--foreground))",
|
|
632
|
-
background: "hsl(var(--background))",
|
|
633
|
-
border: `1px solid hsl(var(--border))`,
|
|
634
|
-
borderRadius: "var(--radius)",
|
|
635
|
-
padding: "0.5rem",
|
|
636
|
-
position: "relative"
|
|
637
|
-
},
|
|
638
|
-
day: {
|
|
639
|
-
margin: 0,
|
|
640
|
-
width: "1rem",
|
|
641
|
-
height: "1rem"
|
|
642
|
-
},
|
|
643
|
-
day_button: {
|
|
644
|
-
margin: 0,
|
|
645
|
-
width: "1.8rem",
|
|
646
|
-
height: "1.5rem",
|
|
647
|
-
padding: 0,
|
|
648
|
-
border: "none"
|
|
649
|
-
}
|
|
650
|
-
},
|
|
651
|
-
...props
|
|
652
|
-
}
|
|
653
|
-
);
|
|
654
|
-
}
|
|
655
|
-
Calendar.displayName = "Calendar";
|
|
656
|
-
var calendar_default = Calendar;
|
|
657
|
-
|
|
658
|
-
// src/react/ui/modals/_internal/components/calendarPopover/index.tsx
|
|
659
|
-
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
660
|
-
function CalendarPopover({
|
|
661
|
-
selectedDate,
|
|
662
|
-
setSelectedDate
|
|
663
|
-
}) {
|
|
664
|
-
return /* @__PURE__ */ jsxs7(Root3, { children: [
|
|
665
|
-
/* @__PURE__ */ jsx9(Trigger, { asChild: true, children: /* @__PURE__ */ jsx9(
|
|
666
|
-
Button3,
|
|
667
|
-
{
|
|
668
|
-
leftIcon: CalendarIcon_default,
|
|
669
|
-
className: dateSelectButton,
|
|
670
|
-
variant: "ghost",
|
|
671
|
-
label: format(selectedDate, "dd/MM/yyyy HH:mm"),
|
|
672
|
-
shape: "square"
|
|
673
|
-
}
|
|
674
|
-
) }),
|
|
675
|
-
/* @__PURE__ */ jsx9(Portal3, { children: /* @__PURE__ */ jsx9(Content3, { className: dateSelectPopoverContent, sideOffset: 5, children: /* @__PURE__ */ jsx9(
|
|
676
|
-
calendar_default,
|
|
677
|
-
{
|
|
678
|
-
selectedDate,
|
|
679
|
-
setSelectedDate,
|
|
680
|
-
mode: "single"
|
|
681
|
-
}
|
|
682
|
-
) }) })
|
|
172
|
+
) }),
|
|
173
|
+
/* @__PURE__ */ jsx3(Portal, { children: /* @__PURE__ */ jsx3(Content, { className: dateSelectPopoverContent, sideOffset: 5, children: /* @__PURE__ */ jsx3(
|
|
174
|
+
calendar_default,
|
|
175
|
+
{
|
|
176
|
+
selectedDate,
|
|
177
|
+
setSelectedDate,
|
|
178
|
+
mode: "single"
|
|
179
|
+
}
|
|
180
|
+
) }) })
|
|
683
181
|
] });
|
|
684
182
|
}
|
|
685
183
|
|
|
686
184
|
// src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
|
|
687
|
-
import { jsx as
|
|
185
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
688
186
|
var PRESET_RANGES = {
|
|
689
187
|
TODAY: {
|
|
690
188
|
label: "Today",
|
|
@@ -712,11 +210,11 @@ var PRESET_RANGES = {
|
|
|
712
210
|
offset: 30
|
|
713
211
|
}
|
|
714
212
|
};
|
|
715
|
-
var ExpirationDateSelect =
|
|
213
|
+
var ExpirationDateSelect = observer2(function ExpirationDateSelect2({
|
|
716
214
|
className,
|
|
717
215
|
$date
|
|
718
216
|
}) {
|
|
719
|
-
const [_, setRange] =
|
|
217
|
+
const [_, setRange] = useState("1_week");
|
|
720
218
|
function handleSelectPresetRange(range) {
|
|
721
219
|
setRange(range);
|
|
722
220
|
const presetRange = Object.values(PRESET_RANGES).find(
|
|
@@ -737,9 +235,9 @@ var ExpirationDateSelect = observer5(function ExpirationDateSelect2({
|
|
|
737
235
|
}
|
|
738
236
|
$date.set(date);
|
|
739
237
|
}
|
|
740
|
-
return /* @__PURE__ */
|
|
741
|
-
/* @__PURE__ */
|
|
742
|
-
|
|
238
|
+
return /* @__PURE__ */ jsxs3(Box2, { width: "full", position: "relative", children: [
|
|
239
|
+
/* @__PURE__ */ jsx4(
|
|
240
|
+
Text2,
|
|
743
241
|
{
|
|
744
242
|
fontSize: "small",
|
|
745
243
|
fontWeight: "medium",
|
|
@@ -749,8 +247,8 @@ var ExpirationDateSelect = observer5(function ExpirationDateSelect2({
|
|
|
749
247
|
children: "Set expiry"
|
|
750
248
|
}
|
|
751
249
|
),
|
|
752
|
-
/* @__PURE__ */
|
|
753
|
-
|
|
250
|
+
/* @__PURE__ */ jsxs3(
|
|
251
|
+
Box2,
|
|
754
252
|
{
|
|
755
253
|
className,
|
|
756
254
|
width: "full",
|
|
@@ -759,7 +257,7 @@ var ExpirationDateSelect = observer5(function ExpirationDateSelect2({
|
|
|
759
257
|
gap: "2",
|
|
760
258
|
marginTop: "0.5",
|
|
761
259
|
children: [
|
|
762
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ jsx4(Box2, { className: rangeSelect, position: "absolute", right: "2", children: /* @__PURE__ */ jsx4(
|
|
763
261
|
Select,
|
|
764
262
|
{
|
|
765
263
|
name: "expirationDate",
|
|
@@ -774,7 +272,7 @@ var ExpirationDateSelect = observer5(function ExpirationDateSelect2({
|
|
|
774
272
|
onValueChange: (value) => handleSelectPresetRange(value)
|
|
775
273
|
}
|
|
776
274
|
) }),
|
|
777
|
-
/* @__PURE__ */
|
|
275
|
+
/* @__PURE__ */ jsx4(
|
|
778
276
|
CalendarPopover,
|
|
779
277
|
{
|
|
780
278
|
selectedDate: $date.get(),
|
|
@@ -789,8 +287,8 @@ var ExpirationDateSelect = observer5(function ExpirationDateSelect2({
|
|
|
789
287
|
var expirationDateSelect_default = ExpirationDateSelect;
|
|
790
288
|
|
|
791
289
|
// src/react/ui/modals/_internal/components/floorPriceText/index.tsx
|
|
792
|
-
import { Text as
|
|
793
|
-
import { jsx as
|
|
290
|
+
import { Text as Text3 } from "@0xsequence/design-system";
|
|
291
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
794
292
|
function FloorPriceText({
|
|
795
293
|
chainId,
|
|
796
294
|
collectionAddress,
|
|
@@ -815,8 +313,8 @@ function FloorPriceText({
|
|
|
815
313
|
decimals: price.currency.decimals
|
|
816
314
|
});
|
|
817
315
|
const floorPriceDifferenceText = floorPriceRaw === price.amountRaw ? "Same as floor price" : `${floorPriceDifference}% ${floorPriceRaw > price.amountRaw ? "below" : "above"} floor price`;
|
|
818
|
-
return /* @__PURE__ */
|
|
819
|
-
|
|
316
|
+
return /* @__PURE__ */ jsx5(
|
|
317
|
+
Text3,
|
|
820
318
|
{
|
|
821
319
|
fontSize: "small",
|
|
822
320
|
fontWeight: "medium",
|
|
@@ -829,34 +327,34 @@ function FloorPriceText({
|
|
|
829
327
|
}
|
|
830
328
|
|
|
831
329
|
// src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
832
|
-
import { Box as
|
|
833
|
-
import { observer as
|
|
834
|
-
import { useState as
|
|
835
|
-
import { erc20Abi, formatUnits
|
|
330
|
+
import { Box as Box4, NumericInput, TokenImage } from "@0xsequence/design-system";
|
|
331
|
+
import { observer as observer4 } from "@legendapp/state/react";
|
|
332
|
+
import { useState as useState3 } from "react";
|
|
333
|
+
import { erc20Abi, formatUnits, parseUnits } from "viem";
|
|
836
334
|
import { useAccount as useAccount2, useReadContract } from "wagmi";
|
|
837
335
|
|
|
838
336
|
// src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx
|
|
839
|
-
import { Box as
|
|
840
|
-
import { observer as
|
|
841
|
-
import { useEffect
|
|
842
|
-
import { jsx as
|
|
843
|
-
var CurrencyOptionsSelect =
|
|
337
|
+
import { Box as Box3, Select as Select2, Skeleton } from "@0xsequence/design-system";
|
|
338
|
+
import { observer as observer3 } from "@legendapp/state/react";
|
|
339
|
+
import { useEffect, useState as useState2 } from "react";
|
|
340
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
341
|
+
var CurrencyOptionsSelect = observer3(function CurrencyOptionsSelect2({
|
|
844
342
|
chainId,
|
|
845
343
|
collectionAddress,
|
|
846
344
|
$selectedCurrency
|
|
847
345
|
}) {
|
|
848
|
-
const [value, setValue] =
|
|
346
|
+
const [value, setValue] = useState2(null);
|
|
849
347
|
const { data: currencies, isLoading: currenciesLoading } = useCurrencies({
|
|
850
348
|
collectionAddress,
|
|
851
349
|
chainId
|
|
852
350
|
});
|
|
853
|
-
|
|
351
|
+
useEffect(() => {
|
|
854
352
|
if (currencies && currencies.length > 0 && !$selectedCurrency.contractAddress.get()) {
|
|
855
353
|
$selectedCurrency.set(currencies[0]);
|
|
856
354
|
}
|
|
857
355
|
}, [currencies]);
|
|
858
356
|
if (!currencies || currenciesLoading) {
|
|
859
|
-
return /* @__PURE__ */
|
|
357
|
+
return /* @__PURE__ */ jsx6(Skeleton, { borderRadius: "lg", width: "20", height: "7", marginRight: "3" });
|
|
860
358
|
}
|
|
861
359
|
const options = currencies.map(
|
|
862
360
|
(currency) => ({
|
|
@@ -871,7 +369,7 @@ var CurrencyOptionsSelect = observer6(function CurrencyOptionsSelect2({
|
|
|
871
369
|
setValue(value2);
|
|
872
370
|
$selectedCurrency.set(c);
|
|
873
371
|
};
|
|
874
|
-
return /* @__PURE__ */
|
|
372
|
+
return /* @__PURE__ */ jsx6(Box3, { className: currencySelect, children: /* @__PURE__ */ jsx6(
|
|
875
373
|
Select2,
|
|
876
374
|
{
|
|
877
375
|
name: "currencies",
|
|
@@ -884,14 +382,14 @@ var CurrencyOptionsSelect = observer6(function CurrencyOptionsSelect2({
|
|
|
884
382
|
var currencyOptionsSelect_default = CurrencyOptionsSelect;
|
|
885
383
|
|
|
886
384
|
// src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
887
|
-
import { jsx as
|
|
888
|
-
var PriceInput =
|
|
385
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
386
|
+
var PriceInput = observer4(function PriceInput2({
|
|
889
387
|
chainId,
|
|
890
388
|
collectionAddress,
|
|
891
389
|
$listingPrice,
|
|
892
390
|
checkBalance
|
|
893
391
|
}) {
|
|
894
|
-
const [balanceError, setBalanceError] =
|
|
392
|
+
const [balanceError, setBalanceError] = useState3("");
|
|
895
393
|
const { address: accountAddress } = useAccount2();
|
|
896
394
|
const { data: balance, isSuccess: isBalanceSuccess } = useReadContract({
|
|
897
395
|
address: $listingPrice.currency.contractAddress.get(),
|
|
@@ -923,19 +421,19 @@ var PriceInput = observer7(function PriceInput2({
|
|
|
923
421
|
$listingPrice.amountRaw.set(parsedAmount.toString());
|
|
924
422
|
checkBalance && checkInsufficientBalance(parsedAmount.toString());
|
|
925
423
|
};
|
|
926
|
-
return /* @__PURE__ */
|
|
927
|
-
/* @__PURE__ */
|
|
928
|
-
|
|
424
|
+
return /* @__PURE__ */ jsxs4(Box4, { className: priceInputWrapper, position: "relative", children: [
|
|
425
|
+
/* @__PURE__ */ jsx7(
|
|
426
|
+
Box4,
|
|
929
427
|
{
|
|
930
428
|
className: priceInputCurrencyImage,
|
|
931
429
|
position: "absolute",
|
|
932
430
|
left: "2",
|
|
933
431
|
display: "flex",
|
|
934
432
|
alignItems: "center",
|
|
935
|
-
children: /* @__PURE__ */
|
|
433
|
+
children: /* @__PURE__ */ jsx7(TokenImage, { src: $listingPrice.currency.imageUrl.get(), size: "xs" })
|
|
936
434
|
}
|
|
937
435
|
),
|
|
938
|
-
/* @__PURE__ */
|
|
436
|
+
/* @__PURE__ */ jsx7(
|
|
939
437
|
NumericInput,
|
|
940
438
|
{
|
|
941
439
|
name: "listingPrice",
|
|
@@ -943,7 +441,7 @@ var PriceInput = observer7(function PriceInput2({
|
|
|
943
441
|
label: "Enter price",
|
|
944
442
|
labelLocation: "top",
|
|
945
443
|
placeholder: "0.00",
|
|
946
|
-
controls: /* @__PURE__ */
|
|
444
|
+
controls: /* @__PURE__ */ jsx7(
|
|
947
445
|
currencyOptionsSelect_default,
|
|
948
446
|
{
|
|
949
447
|
$selectedCurrency: $listingPrice?.currency,
|
|
@@ -952,7 +450,7 @@ var PriceInput = observer7(function PriceInput2({
|
|
|
952
450
|
}
|
|
953
451
|
),
|
|
954
452
|
numeric: true,
|
|
955
|
-
value: listingPriceAmountRaw ?
|
|
453
|
+
value: listingPriceAmountRaw ? formatUnits(
|
|
956
454
|
BigInt(listingPriceAmountRaw),
|
|
957
455
|
Number(currencyDecimals)
|
|
958
456
|
) : "",
|
|
@@ -960,14 +458,14 @@ var PriceInput = observer7(function PriceInput2({
|
|
|
960
458
|
width: "full"
|
|
961
459
|
}
|
|
962
460
|
),
|
|
963
|
-
balanceError && /* @__PURE__ */
|
|
461
|
+
balanceError && /* @__PURE__ */ jsx7(Box4, { color: "negative", fontSize: "small", children: balanceError })
|
|
964
462
|
] });
|
|
965
463
|
});
|
|
966
464
|
var priceInput_default = PriceInput;
|
|
967
465
|
|
|
968
466
|
// src/react/ui/modals/_internal/components/quantityInput/index.tsx
|
|
969
|
-
import { Box as
|
|
970
|
-
import { jsx as
|
|
467
|
+
import { Box as Box5, IconButton, NumericInput as NumericInput2 } from "@0xsequence/design-system";
|
|
468
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
971
469
|
function QuantityInput({
|
|
972
470
|
$quantity,
|
|
973
471
|
chainId,
|
|
@@ -1045,7 +543,7 @@ function QuantityInput({
|
|
|
1045
543
|
if (collectableLoading) {
|
|
1046
544
|
return null;
|
|
1047
545
|
}
|
|
1048
|
-
return /* @__PURE__ */
|
|
546
|
+
return /* @__PURE__ */ jsx8(Box5, { className: quantityInputWrapper, children: /* @__PURE__ */ jsx8(
|
|
1049
547
|
NumericInput2,
|
|
1050
548
|
{
|
|
1051
549
|
name: "quantity",
|
|
@@ -1054,16 +552,16 @@ function QuantityInput({
|
|
|
1054
552
|
label: "Enter quantity",
|
|
1055
553
|
labelLocation: "top",
|
|
1056
554
|
placeholder: getPlaceholder(quantityDecimals || 0),
|
|
1057
|
-
controls: /* @__PURE__ */
|
|
1058
|
-
|
|
555
|
+
controls: /* @__PURE__ */ jsxs5(
|
|
556
|
+
Box5,
|
|
1059
557
|
{
|
|
1060
558
|
display: "flex",
|
|
1061
559
|
alignItems: "center",
|
|
1062
560
|
gap: "1",
|
|
1063
561
|
marginRight: "2",
|
|
1064
562
|
children: [
|
|
1065
|
-
/* @__PURE__ */
|
|
1066
|
-
|
|
563
|
+
/* @__PURE__ */ jsx8(
|
|
564
|
+
IconButton,
|
|
1067
565
|
{
|
|
1068
566
|
disabled: Number.parseFloat(quantity) === 0 || !quantity,
|
|
1069
567
|
onClick: handleDecrement,
|
|
@@ -1072,8 +570,8 @@ function QuantityInput({
|
|
|
1072
570
|
icon: MinusIcon_default
|
|
1073
571
|
}
|
|
1074
572
|
),
|
|
1075
|
-
/* @__PURE__ */
|
|
1076
|
-
|
|
573
|
+
/* @__PURE__ */ jsx8(
|
|
574
|
+
IconButton,
|
|
1077
575
|
{
|
|
1078
576
|
onClick: handleIncrement,
|
|
1079
577
|
background: "buttonGlass",
|
|
@@ -1092,9 +590,162 @@ function QuantityInput({
|
|
|
1092
590
|
) });
|
|
1093
591
|
}
|
|
1094
592
|
|
|
593
|
+
// src/react/ui/modals/_internal/components/switchChainModal/index.tsx
|
|
594
|
+
import { Close, Content as Content2, Overlay, Portal as Portal2, Root as Root2 } from "@radix-ui/react-dialog";
|
|
595
|
+
|
|
596
|
+
// src/react/ui/modals/_internal/components/switchChainModal/store.ts
|
|
597
|
+
import { observable as observable2 } from "@legendapp/state";
|
|
598
|
+
var initialState = {
|
|
599
|
+
isOpen: false,
|
|
600
|
+
open: ({ chainIdToSwitchTo, onSwitchChain, callbacks }) => {
|
|
601
|
+
switchChainModal$.state.set({
|
|
602
|
+
...switchChainModal$.state.get(),
|
|
603
|
+
chainIdToSwitchTo,
|
|
604
|
+
onSwitchChain,
|
|
605
|
+
callbacks
|
|
606
|
+
});
|
|
607
|
+
switchChainModal$.isOpen.set(true);
|
|
608
|
+
},
|
|
609
|
+
close: () => {
|
|
610
|
+
switchChainModal$.isOpen.set(false);
|
|
611
|
+
switchChainModal$.state.set({
|
|
612
|
+
...initialState.state
|
|
613
|
+
});
|
|
614
|
+
},
|
|
615
|
+
state: {
|
|
616
|
+
chainIdToSwitchTo: void 0,
|
|
617
|
+
onSwitchChain: () => {
|
|
618
|
+
},
|
|
619
|
+
isSwitching: false
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
var switchChainModal$ = observable2(initialState);
|
|
623
|
+
|
|
624
|
+
// src/react/ui/modals/_internal/components/switchChainModal/index.tsx
|
|
625
|
+
import {
|
|
626
|
+
Button as Button3,
|
|
627
|
+
CloseIcon,
|
|
628
|
+
IconButton as IconButton2,
|
|
629
|
+
Spinner,
|
|
630
|
+
Text as Text5
|
|
631
|
+
} from "@0xsequence/design-system";
|
|
632
|
+
|
|
633
|
+
// src/react/ui/modals/_internal/components/alertMessage/index.tsx
|
|
634
|
+
import { Box as Box6, Text as Text4, WarningIcon } from "@0xsequence/design-system";
|
|
635
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
636
|
+
function AlertMessage({ message, type }) {
|
|
637
|
+
return /* @__PURE__ */ jsxs6(Box6, { className: `${alertMessageBox} ${alertMessageBoxVariants[type]}`, children: [
|
|
638
|
+
/* @__PURE__ */ jsx9(Text4, { color: "white", fontSize: "normal", fontWeight: "medium", children: message }),
|
|
639
|
+
type === "warning" && /* @__PURE__ */ jsx9(WarningIcon, { size: "sm", color: "white" }),
|
|
640
|
+
type === "info" && /* @__PURE__ */ jsx9(InfoIcon_default, { size: "sm", color: "white" })
|
|
641
|
+
] });
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// src/react/ui/modals/_internal/components/switchChainModal/index.tsx
|
|
645
|
+
import { observer as observer5 } from "@legendapp/state/react";
|
|
646
|
+
import { useSwitchChain } from "wagmi";
|
|
647
|
+
import { BaseError } from "viem";
|
|
648
|
+
|
|
649
|
+
// src/utils/network.ts
|
|
650
|
+
import { networks } from "@0xsequence/network";
|
|
651
|
+
var getPresentableChainName = (chainId) => {
|
|
652
|
+
return networks[chainId]?.name;
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
// src/react/ui/modals/_internal/components/switchChainModal/index.tsx
|
|
656
|
+
import { UserRejectedRequestError } from "viem";
|
|
657
|
+
import { SwitchChainNotSupportedError } from "wagmi";
|
|
658
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
659
|
+
var useSwitchChainModal = () => {
|
|
660
|
+
return {
|
|
661
|
+
show: (args) => switchChainModal$.open(args),
|
|
662
|
+
close: () => switchChainModal$.close(),
|
|
663
|
+
isSwitching$: switchChainModal$.state.isSwitching
|
|
664
|
+
};
|
|
665
|
+
};
|
|
666
|
+
var SwitchChainModal = observer5(() => {
|
|
667
|
+
const chainIdToSwitchTo = switchChainModal$.state.chainIdToSwitchTo.get();
|
|
668
|
+
const isSwitching$ = switchChainModal$.state.isSwitching;
|
|
669
|
+
const chainName = getPresentableChainName(chainIdToSwitchTo);
|
|
670
|
+
const { switchChainAsync } = useSwitchChain();
|
|
671
|
+
const {
|
|
672
|
+
onSwitchingNotSupported,
|
|
673
|
+
onUserRejectedRequest,
|
|
674
|
+
onUnknownError,
|
|
675
|
+
onSuccess
|
|
676
|
+
} = switchChainModal$.state.callbacks.get() || {};
|
|
677
|
+
async function handleSwitchChain() {
|
|
678
|
+
isSwitching$.set(true);
|
|
679
|
+
try {
|
|
680
|
+
await switchChainAsync({ chainId: chainIdToSwitchTo });
|
|
681
|
+
switchChainModal$.state.onSwitchChain();
|
|
682
|
+
onSuccess && onSuccess();
|
|
683
|
+
switchChainModal$.close();
|
|
684
|
+
} catch (error) {
|
|
685
|
+
if (error instanceof BaseError) {
|
|
686
|
+
const name = error.name;
|
|
687
|
+
switch (name) {
|
|
688
|
+
case SwitchChainNotSupportedError.name:
|
|
689
|
+
onSwitchingNotSupported && onSwitchingNotSupported();
|
|
690
|
+
break;
|
|
691
|
+
case UserRejectedRequestError.name:
|
|
692
|
+
onUserRejectedRequest && onUserRejectedRequest();
|
|
693
|
+
break;
|
|
694
|
+
default:
|
|
695
|
+
onUnknownError && onUnknownError(error);
|
|
696
|
+
break;
|
|
697
|
+
}
|
|
698
|
+
} else {
|
|
699
|
+
onUnknownError && onUnknownError(error);
|
|
700
|
+
}
|
|
701
|
+
} finally {
|
|
702
|
+
isSwitching$.set(false);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
return /* @__PURE__ */ jsx10(Root2, { open: switchChainModal$.isOpen.get(), children: /* @__PURE__ */ jsxs7(Portal2, { children: [
|
|
706
|
+
/* @__PURE__ */ jsx10(Overlay, { className: dialogOverlay }),
|
|
707
|
+
/* @__PURE__ */ jsxs7(Content2, { className: switchChainModalContent, children: [
|
|
708
|
+
/* @__PURE__ */ jsx10(Text5, { fontSize: "large", fontWeight: "bold", color: "text100", children: "Wrong network" }),
|
|
709
|
+
/* @__PURE__ */ jsx10(
|
|
710
|
+
AlertMessage,
|
|
711
|
+
{
|
|
712
|
+
type: "warning",
|
|
713
|
+
message: `You need to switch to ${chainName} network before completing the transaction`
|
|
714
|
+
}
|
|
715
|
+
),
|
|
716
|
+
/* @__PURE__ */ jsx10(
|
|
717
|
+
Button3,
|
|
718
|
+
{
|
|
719
|
+
name: "switch-chain",
|
|
720
|
+
size: "sm",
|
|
721
|
+
label: isSwitching$.get() ? /* @__PURE__ */ jsx10(Spinner, {}) : "Switch Network",
|
|
722
|
+
variant: "primary",
|
|
723
|
+
pending: isSwitching$.get(),
|
|
724
|
+
shape: "square",
|
|
725
|
+
className: isSwitching$.get() ? switchChainCta.pending : switchChainCta.default,
|
|
726
|
+
justifySelf: "flex-end",
|
|
727
|
+
onClick: handleSwitchChain
|
|
728
|
+
}
|
|
729
|
+
),
|
|
730
|
+
/* @__PURE__ */ jsx10(
|
|
731
|
+
Close,
|
|
732
|
+
{
|
|
733
|
+
onClick: () => {
|
|
734
|
+
switchChainModal$.delete();
|
|
735
|
+
},
|
|
736
|
+
className: closeButton,
|
|
737
|
+
asChild: true,
|
|
738
|
+
children: /* @__PURE__ */ jsx10(IconButton2, { size: "xs", "aria-label": "Close modal", icon: CloseIcon })
|
|
739
|
+
}
|
|
740
|
+
)
|
|
741
|
+
] })
|
|
742
|
+
] }) });
|
|
743
|
+
});
|
|
744
|
+
var switchChainModal_default = SwitchChainModal;
|
|
745
|
+
|
|
1095
746
|
// src/react/ui/modals/_internal/components/tokenPreview/index.tsx
|
|
1096
|
-
import { Box as
|
|
1097
|
-
import { jsx as
|
|
747
|
+
import { Box as Box7, Image, Skeleton as Skeleton2, Text as Text6 } from "@0xsequence/design-system";
|
|
748
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1098
749
|
function TokenPreview({
|
|
1099
750
|
collectionName,
|
|
1100
751
|
collectionAddress,
|
|
@@ -1107,17 +758,17 @@ function TokenPreview({
|
|
|
1107
758
|
collectibleId
|
|
1108
759
|
});
|
|
1109
760
|
if (collectibleLoading) {
|
|
1110
|
-
return /* @__PURE__ */
|
|
1111
|
-
/* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1113
|
-
/* @__PURE__ */
|
|
1114
|
-
/* @__PURE__ */
|
|
761
|
+
return /* @__PURE__ */ jsxs8(Box7, { display: "flex", alignItems: "center", gap: "3", width: "full", children: [
|
|
762
|
+
/* @__PURE__ */ jsx11(Skeleton2, { width: "9", height: "9", borderRadius: "xs" }),
|
|
763
|
+
/* @__PURE__ */ jsxs8(Box7, { display: "flex", flexGrow: "1", gap: "1", flexDirection: "column", children: [
|
|
764
|
+
/* @__PURE__ */ jsx11(Skeleton2, { width: "1/3", height: "3" }),
|
|
765
|
+
/* @__PURE__ */ jsx11(Skeleton2, { width: "1/2", height: "3" })
|
|
1115
766
|
] })
|
|
1116
767
|
] });
|
|
1117
768
|
}
|
|
1118
|
-
return /* @__PURE__ */
|
|
1119
|
-
/* @__PURE__ */
|
|
1120
|
-
|
|
769
|
+
return /* @__PURE__ */ jsxs8(Box7, { className: tokenPreview, children: [
|
|
770
|
+
/* @__PURE__ */ jsx11(
|
|
771
|
+
Image,
|
|
1121
772
|
{
|
|
1122
773
|
src: collectable?.image,
|
|
1123
774
|
alt: collectable?.name,
|
|
@@ -1126,17 +777,17 @@ function TokenPreview({
|
|
|
1126
777
|
borderRadius: "xs"
|
|
1127
778
|
}
|
|
1128
779
|
),
|
|
1129
|
-
/* @__PURE__ */
|
|
1130
|
-
/* @__PURE__ */
|
|
1131
|
-
/* @__PURE__ */
|
|
780
|
+
/* @__PURE__ */ jsxs8(Box7, { display: "flex", flexDirection: "column", marginLeft: "3", children: [
|
|
781
|
+
/* @__PURE__ */ jsx11(Text6, { fontSize: "small", color: "text80", fontWeight: "medium", children: collectionName }),
|
|
782
|
+
/* @__PURE__ */ jsx11(Text6, { fontSize: "small", fontWeight: "bold", color: "text100", children: collectable?.name })
|
|
1132
783
|
] })
|
|
1133
784
|
] });
|
|
1134
785
|
}
|
|
1135
786
|
|
|
1136
787
|
// src/react/ui/modals/_internal/components/transactionDetails/index.tsx
|
|
1137
|
-
import { Box as
|
|
1138
|
-
import { formatUnits as
|
|
1139
|
-
import { jsx as
|
|
788
|
+
import { Box as Box8, NetworkImage, Skeleton as Skeleton3, Text as Text7 } from "@0xsequence/design-system";
|
|
789
|
+
import { formatUnits as formatUnits2 } from "viem";
|
|
790
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1140
791
|
var DEFAULT_MARKETPLACE_FEE_PERCENTAGE = 2.5;
|
|
1141
792
|
function TransactionDetails({
|
|
1142
793
|
collectibleId,
|
|
@@ -1154,25 +805,25 @@ function TransactionDetails({
|
|
|
1154
805
|
collectibleId
|
|
1155
806
|
});
|
|
1156
807
|
const priceLoading = !price || marketplaceConfigLoading || royaltyPercentageLoading;
|
|
1157
|
-
let formattedAmount = price &&
|
|
808
|
+
let formattedAmount = price && formatUnits2(BigInt(price.amountRaw), price.currency.decimals);
|
|
1158
809
|
if (royaltyPercentage !== void 0 && formattedAmount) {
|
|
1159
810
|
formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * Number(royaltyPercentage) / 100).toString();
|
|
1160
811
|
}
|
|
1161
812
|
if (marketplaceFeePercentage !== void 0 && formattedAmount) {
|
|
1162
813
|
formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * marketplaceFeePercentage / 100).toString();
|
|
1163
814
|
}
|
|
1164
|
-
return /* @__PURE__ */
|
|
1165
|
-
|
|
815
|
+
return /* @__PURE__ */ jsxs9(
|
|
816
|
+
Box8,
|
|
1166
817
|
{
|
|
1167
818
|
width: "full",
|
|
1168
819
|
display: "flex",
|
|
1169
820
|
justifyContent: "space-between",
|
|
1170
821
|
alignItems: "center",
|
|
1171
822
|
children: [
|
|
1172
|
-
/* @__PURE__ */
|
|
1173
|
-
/* @__PURE__ */
|
|
1174
|
-
/* @__PURE__ */
|
|
1175
|
-
priceLoading ? /* @__PURE__ */
|
|
823
|
+
/* @__PURE__ */ jsx12(Text7, { fontSize: "small", color: "text50", children: "Total earnings" }),
|
|
824
|
+
/* @__PURE__ */ jsxs9(Box8, { display: "flex", alignItems: "center", gap: "2", children: [
|
|
825
|
+
/* @__PURE__ */ jsx12(NetworkImage, { chainId: Number(chainId), size: "xs" }),
|
|
826
|
+
priceLoading ? /* @__PURE__ */ jsx12(Skeleton3, { width: "16", height: "4" }) : /* @__PURE__ */ jsxs9(Text7, { fontSize: "small", color: "text100", children: [
|
|
1176
827
|
formattedAmount,
|
|
1177
828
|
" ",
|
|
1178
829
|
price.currency.symbol
|
|
@@ -1180,14 +831,368 @@ function TransactionDetails({
|
|
|
1180
831
|
] })
|
|
1181
832
|
]
|
|
1182
833
|
}
|
|
1183
|
-
);
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
// src/react/ui/modals/CreateListingModal/_store.ts
|
|
1187
|
-
import { observable as observable4, when } from "@legendapp/state";
|
|
1188
|
-
import { useMount, useSelector } from "@legendapp/state/react";
|
|
1189
|
-
import { addDays as addDays2 } from "date-fns/addDays";
|
|
1190
|
-
import { useAccount as useAccount3, useSendTransaction } from "wagmi";
|
|
834
|
+
);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
// src/react/ui/modals/CreateListingModal/_store.ts
|
|
838
|
+
import { observable as observable4, when } from "@legendapp/state";
|
|
839
|
+
import { useMount, useSelector } from "@legendapp/state/react";
|
|
840
|
+
import { addDays as addDays2 } from "date-fns/addDays";
|
|
841
|
+
import { useAccount as useAccount3, useSendTransaction } from "wagmi";
|
|
842
|
+
|
|
843
|
+
// src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
|
|
844
|
+
import {
|
|
845
|
+
CloseIcon as CloseIcon2,
|
|
846
|
+
IconButton as IconButton3,
|
|
847
|
+
Skeleton as Skeleton4,
|
|
848
|
+
Text as Text11
|
|
849
|
+
} from "@0xsequence/design-system";
|
|
850
|
+
import { observer as observer7 } from "@legendapp/state/react";
|
|
851
|
+
import { Close as Close2, Content as Content3, Overlay as Overlay2, Portal as Portal3, Root as Root3 } from "@radix-ui/react-dialog";
|
|
852
|
+
import { useEffect as useEffect3 } from "react";
|
|
853
|
+
import { useTransactionReceipt } from "wagmi";
|
|
854
|
+
|
|
855
|
+
// src/react/ui/modals/_internal/components/transaction-footer/index.tsx
|
|
856
|
+
import { Box as Box9, Spinner as Spinner2, Text as Text8 } from "@0xsequence/design-system";
|
|
857
|
+
import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
858
|
+
function TransactionFooter({
|
|
859
|
+
transactionHash,
|
|
860
|
+
isConfirming,
|
|
861
|
+
isConfirmed,
|
|
862
|
+
isFailed
|
|
863
|
+
}) {
|
|
864
|
+
const icon = isConfirming && /* @__PURE__ */ jsx13(Spinner2, { size: "md" }) || isConfirmed && /* @__PURE__ */ jsx13(PositiveCircleIcon_default, { size: "md" });
|
|
865
|
+
const title = isConfirming && "Processing transaction" || isConfirmed && "Transaction complete" || isFailed && "Transaction failed";
|
|
866
|
+
return /* @__PURE__ */ jsxs10(Box9, { display: "flex", alignItems: "center", children: [
|
|
867
|
+
icon,
|
|
868
|
+
/* @__PURE__ */ jsx13(Text8, { color: "text50", fontSize: "normal", fontWeight: "medium", marginLeft: "2", children: title }),
|
|
869
|
+
/* @__PURE__ */ jsx13(
|
|
870
|
+
Text8,
|
|
871
|
+
{
|
|
872
|
+
color: "polygonLight",
|
|
873
|
+
flexGrow: "1",
|
|
874
|
+
textAlign: "right",
|
|
875
|
+
fontSize: "normal",
|
|
876
|
+
fontWeight: "medium",
|
|
877
|
+
marginLeft: "2",
|
|
878
|
+
children: truncateMiddle(transactionHash, 4, 4)
|
|
879
|
+
}
|
|
880
|
+
)
|
|
881
|
+
] });
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
// src/react/ui/modals/_internal/components/transactionPreview/index.tsx
|
|
885
|
+
import { Box as Box11, Image as Image2, NetworkImage as NetworkImage2, Text as Text10 } from "@0xsequence/design-system";
|
|
886
|
+
import { observer as observer6 } from "@legendapp/state/react";
|
|
887
|
+
import { formatUnits as formatUnits3 } from "viem";
|
|
888
|
+
|
|
889
|
+
// src/react/ui/modals/_internal/components/timeAgo/index.tsx
|
|
890
|
+
import { Box as Box10, Text as Text9 } from "@0xsequence/design-system";
|
|
891
|
+
import { formatDistanceToNow } from "date-fns";
|
|
892
|
+
import { useState as useState4, useEffect as useEffect2 } from "react";
|
|
893
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
894
|
+
function TimeAgo({ date }) {
|
|
895
|
+
const [timeAgo, setTimeAgo] = useState4("");
|
|
896
|
+
useEffect2(() => {
|
|
897
|
+
const interval = setInterval(() => {
|
|
898
|
+
setTimeAgo(formatDistanceToNow(date));
|
|
899
|
+
}, 1e3);
|
|
900
|
+
return () => clearInterval(interval);
|
|
901
|
+
}, [date]);
|
|
902
|
+
return /* @__PURE__ */ jsx14(
|
|
903
|
+
Box10,
|
|
904
|
+
{
|
|
905
|
+
flexGrow: "1",
|
|
906
|
+
display: "flex",
|
|
907
|
+
alignItems: "center",
|
|
908
|
+
justifyContent: "flex-end",
|
|
909
|
+
children: /* @__PURE__ */ jsx14(Text9, { color: "text50", fontSize: "small", children: timeAgo })
|
|
910
|
+
}
|
|
911
|
+
);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
// src/react/ui/modals/_internal/components/transactionStatusModal/store.ts
|
|
915
|
+
import { observable as observable3 } from "@legendapp/state";
|
|
916
|
+
var initialState2 = {
|
|
917
|
+
isOpen: false,
|
|
918
|
+
open: ({
|
|
919
|
+
hash,
|
|
920
|
+
price,
|
|
921
|
+
collectionAddress,
|
|
922
|
+
chainId,
|
|
923
|
+
tokenId,
|
|
924
|
+
getTitle,
|
|
925
|
+
getMessage: getMessage2,
|
|
926
|
+
type,
|
|
927
|
+
callbacks,
|
|
928
|
+
queriesToInvalidate
|
|
929
|
+
}) => {
|
|
930
|
+
transactionStatusModal$.state.set({
|
|
931
|
+
...transactionStatusModal$.state.get(),
|
|
932
|
+
hash,
|
|
933
|
+
price,
|
|
934
|
+
collectionAddress,
|
|
935
|
+
chainId,
|
|
936
|
+
tokenId,
|
|
937
|
+
getTitle,
|
|
938
|
+
getMessage: getMessage2,
|
|
939
|
+
type,
|
|
940
|
+
callbacks,
|
|
941
|
+
queriesToInvalidate
|
|
942
|
+
});
|
|
943
|
+
transactionStatusModal$.isOpen.set(true);
|
|
944
|
+
},
|
|
945
|
+
close: () => {
|
|
946
|
+
transactionStatusModal$.isOpen.set(false);
|
|
947
|
+
transactionStatusModal$.state.set({
|
|
948
|
+
...initialState2.state
|
|
949
|
+
});
|
|
950
|
+
},
|
|
951
|
+
state: {
|
|
952
|
+
hash: void 0,
|
|
953
|
+
status: "PENDING",
|
|
954
|
+
price: void 0,
|
|
955
|
+
collectionAddress: "",
|
|
956
|
+
chainId: "",
|
|
957
|
+
tokenId: "",
|
|
958
|
+
getTitle: void 0,
|
|
959
|
+
getMessage: void 0,
|
|
960
|
+
type: void 0
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
var transactionStatusModal$ = observable3(initialState2);
|
|
964
|
+
|
|
965
|
+
// src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx
|
|
966
|
+
import { useMemo } from "react";
|
|
967
|
+
|
|
968
|
+
// src/react/ui/modals/_internal/components/transactionPreview/consts.ts
|
|
969
|
+
var TRANSACTION_TITLES = {
|
|
970
|
+
sell: {
|
|
971
|
+
confirming: "Selling",
|
|
972
|
+
confirmed: "Sold",
|
|
973
|
+
failed: "Sale failed"
|
|
974
|
+
},
|
|
975
|
+
createListing: {
|
|
976
|
+
confirming: "Creating listing",
|
|
977
|
+
confirmed: "Listed",
|
|
978
|
+
failed: "Listing failed"
|
|
979
|
+
},
|
|
980
|
+
createOffer: {
|
|
981
|
+
confirming: "Creating offer",
|
|
982
|
+
confirmed: "Offer created",
|
|
983
|
+
failed: "Offer failed"
|
|
984
|
+
},
|
|
985
|
+
buy: {
|
|
986
|
+
confirming: "Buying",
|
|
987
|
+
confirmed: "Bought",
|
|
988
|
+
failed: "Purchase failed"
|
|
989
|
+
},
|
|
990
|
+
transfer: {
|
|
991
|
+
confirming: "Transferring",
|
|
992
|
+
confirmed: "Transferred",
|
|
993
|
+
failed: "Transfer failed"
|
|
994
|
+
}
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
// src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx
|
|
998
|
+
function useTransactionPreviewTitle(status, type) {
|
|
999
|
+
return useMemo(() => {
|
|
1000
|
+
if (!type) return "";
|
|
1001
|
+
const { isConfirming, isConfirmed, isFailed } = status;
|
|
1002
|
+
const titles = TRANSACTION_TITLES[type];
|
|
1003
|
+
if (isConfirming) return titles.confirming;
|
|
1004
|
+
if (isConfirmed) return titles.confirmed;
|
|
1005
|
+
if (isFailed) return titles.failed;
|
|
1006
|
+
return "";
|
|
1007
|
+
}, [status, type]);
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
// src/react/ui/modals/_internal/components/transactionPreview/index.tsx
|
|
1011
|
+
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1012
|
+
var TransactionPreview = observer6(
|
|
1013
|
+
({
|
|
1014
|
+
price,
|
|
1015
|
+
collectionAddress,
|
|
1016
|
+
chainId,
|
|
1017
|
+
collectible,
|
|
1018
|
+
isConfirming,
|
|
1019
|
+
isConfirmed,
|
|
1020
|
+
isFailed
|
|
1021
|
+
}) => {
|
|
1022
|
+
const { type } = transactionStatusModal$.state.get();
|
|
1023
|
+
const title = useTransactionPreviewTitle(
|
|
1024
|
+
{ isConfirmed, isConfirming, isFailed },
|
|
1025
|
+
type
|
|
1026
|
+
);
|
|
1027
|
+
const { data: collection } = useCollection({
|
|
1028
|
+
collectionAddress,
|
|
1029
|
+
chainId
|
|
1030
|
+
});
|
|
1031
|
+
const collectibleImage2 = collectible.image;
|
|
1032
|
+
const collectibleName = collectible.name;
|
|
1033
|
+
const collectionName = collection?.name;
|
|
1034
|
+
const priceFormatted = price ? formatUnits3(BigInt(price.amountRaw), price.currency.decimals) : void 0;
|
|
1035
|
+
return /* @__PURE__ */ jsxs11(Box11, { padding: "3", background: "backgroundSecondary", borderRadius: "md", children: [
|
|
1036
|
+
/* @__PURE__ */ jsxs11(Box11, { display: "flex", alignItems: "center", children: [
|
|
1037
|
+
/* @__PURE__ */ jsx15(
|
|
1038
|
+
Text10,
|
|
1039
|
+
{
|
|
1040
|
+
color: "text50",
|
|
1041
|
+
fontSize: "small",
|
|
1042
|
+
fontWeight: "medium",
|
|
1043
|
+
marginRight: "1",
|
|
1044
|
+
children: title
|
|
1045
|
+
}
|
|
1046
|
+
),
|
|
1047
|
+
/* @__PURE__ */ jsx15(NetworkImage2, { chainId: Number(chainId), size: "xs" }),
|
|
1048
|
+
isConfirming && /* @__PURE__ */ jsx15(TimeAgo, { date: /* @__PURE__ */ new Date() })
|
|
1049
|
+
] }),
|
|
1050
|
+
/* @__PURE__ */ jsxs11(Box11, { display: "flex", alignItems: "center", marginTop: "2", children: [
|
|
1051
|
+
/* @__PURE__ */ jsx15(
|
|
1052
|
+
Image2,
|
|
1053
|
+
{
|
|
1054
|
+
src: collectibleImage2,
|
|
1055
|
+
alt: collectibleName,
|
|
1056
|
+
width: "9",
|
|
1057
|
+
height: "9",
|
|
1058
|
+
borderRadius: "xs",
|
|
1059
|
+
marginRight: "3"
|
|
1060
|
+
}
|
|
1061
|
+
),
|
|
1062
|
+
/* @__PURE__ */ jsxs11(
|
|
1063
|
+
Box11,
|
|
1064
|
+
{
|
|
1065
|
+
display: "flex",
|
|
1066
|
+
flexDirection: "column",
|
|
1067
|
+
alignItems: "flex-start",
|
|
1068
|
+
gap: "0.5",
|
|
1069
|
+
children: [
|
|
1070
|
+
/* @__PURE__ */ jsx15(Text10, { color: "text80", fontSize: "small", fontWeight: "medium", children: collectibleName }),
|
|
1071
|
+
/* @__PURE__ */ jsx15(Text10, { color: "text100", fontSize: "small", children: collectionName })
|
|
1072
|
+
]
|
|
1073
|
+
}
|
|
1074
|
+
),
|
|
1075
|
+
price && /* @__PURE__ */ jsxs11(
|
|
1076
|
+
Box11,
|
|
1077
|
+
{
|
|
1078
|
+
flexGrow: "1",
|
|
1079
|
+
display: "flex",
|
|
1080
|
+
alignItems: "center",
|
|
1081
|
+
justifyContent: "flex-end",
|
|
1082
|
+
gap: "1",
|
|
1083
|
+
children: [
|
|
1084
|
+
/* @__PURE__ */ jsx15(NetworkImage2, { chainId: Number(chainId), size: "xs" }),
|
|
1085
|
+
/* @__PURE__ */ jsxs11(Text10, { color: "text80", fontSize: "small", fontWeight: "medium", children: [
|
|
1086
|
+
priceFormatted,
|
|
1087
|
+
" ",
|
|
1088
|
+
price.currency.symbol
|
|
1089
|
+
] })
|
|
1090
|
+
]
|
|
1091
|
+
}
|
|
1092
|
+
)
|
|
1093
|
+
] })
|
|
1094
|
+
] });
|
|
1095
|
+
}
|
|
1096
|
+
);
|
|
1097
|
+
var transactionPreview_default = TransactionPreview;
|
|
1098
|
+
|
|
1099
|
+
// src/react/ui/modals/_internal/components/transactionStatusModal/styles.css.ts
|
|
1100
|
+
var closeButton4 = "fyvr11lw fyvr1tc fyvr1mo";
|
|
1101
|
+
var dialogOverlay4 = "fyvr1m0 fyvr1o8 fyvr1qg fyvr1so fyvr11xl fyvr11m0 fyvr11rs";
|
|
1102
|
+
var transactionStatusModalContent = "modal_dialogContent_wide__1ypl6nt3 modal_dialogContentBase__1ypl6nt1 fyvr11hg fyvr11i4 fyvr11g4 fyvr11gs fyvr11l8 fyvr11wl fyvr11m0 fyvr11rs fyvr1vo fyvr1xs fyvr1zw fyvr1120 fyvr11lc fyvr11mc fyvr11cw";
|
|
1103
|
+
|
|
1104
|
+
// src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
|
|
1105
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1106
|
+
var useTransactionStatusModal = () => {
|
|
1107
|
+
return {
|
|
1108
|
+
show: (args) => transactionStatusModal$.open(args),
|
|
1109
|
+
close: () => transactionStatusModal$.close()
|
|
1110
|
+
};
|
|
1111
|
+
};
|
|
1112
|
+
var TransactionStatusModal = observer7(() => {
|
|
1113
|
+
const {
|
|
1114
|
+
hash,
|
|
1115
|
+
price,
|
|
1116
|
+
collectionAddress,
|
|
1117
|
+
chainId,
|
|
1118
|
+
tokenId,
|
|
1119
|
+
getTitle,
|
|
1120
|
+
getMessage: getMessage2,
|
|
1121
|
+
callbacks,
|
|
1122
|
+
queriesToInvalidate
|
|
1123
|
+
} = transactionStatusModal$.state.get();
|
|
1124
|
+
const { data: collectible } = useCollectible({
|
|
1125
|
+
collectionAddress,
|
|
1126
|
+
chainId,
|
|
1127
|
+
collectibleId: tokenId
|
|
1128
|
+
});
|
|
1129
|
+
const {
|
|
1130
|
+
isLoading: isConfirming,
|
|
1131
|
+
isSuccess: isConfirmed,
|
|
1132
|
+
isError: isFailed,
|
|
1133
|
+
error
|
|
1134
|
+
} = useTransactionReceipt({ hash });
|
|
1135
|
+
const title = getTitle && getTitle({ isConfirmed, isConfirming, isFailed });
|
|
1136
|
+
const message = getMessage2 && getMessage2({ isConfirmed, isConfirming, isFailed });
|
|
1137
|
+
const { onUnknownError, onSuccess } = callbacks || {};
|
|
1138
|
+
const queryClient = getQueryClient();
|
|
1139
|
+
useEffect3(() => {
|
|
1140
|
+
if (!transactionStatusModal$.isOpen.get()) return;
|
|
1141
|
+
let isSubscribed = true;
|
|
1142
|
+
if (isConfirmed && isSubscribed && onSuccess) {
|
|
1143
|
+
onSuccess();
|
|
1144
|
+
}
|
|
1145
|
+
if (isFailed && isSubscribed && onUnknownError) {
|
|
1146
|
+
onUnknownError(error);
|
|
1147
|
+
}
|
|
1148
|
+
if (isSubscribed && queriesToInvalidate) {
|
|
1149
|
+
queryClient.invalidateQueries({ queryKey: [...queriesToInvalidate] });
|
|
1150
|
+
}
|
|
1151
|
+
return () => {
|
|
1152
|
+
isSubscribed = false;
|
|
1153
|
+
};
|
|
1154
|
+
}, [isConfirmed, isFailed, onSuccess, onUnknownError, error]);
|
|
1155
|
+
return /* @__PURE__ */ jsx16(Root3, { open: transactionStatusModal$.isOpen.get(), children: /* @__PURE__ */ jsxs12(Portal3, { children: [
|
|
1156
|
+
/* @__PURE__ */ jsx16(Overlay2, { className: dialogOverlay4 }),
|
|
1157
|
+
/* @__PURE__ */ jsxs12(Content3, { className: transactionStatusModalContent, children: [
|
|
1158
|
+
title ? /* @__PURE__ */ jsx16(Text11, { fontSize: "large", fontWeight: "bold", color: "text100", children: title }) : /* @__PURE__ */ jsx16(Skeleton4, { width: "16", height: "6" }),
|
|
1159
|
+
message ? /* @__PURE__ */ jsx16(Text11, { fontSize: "small", color: "text80", children: message }) : /* @__PURE__ */ jsx16(Skeleton4, { width: "20", height: "4" }),
|
|
1160
|
+
/* @__PURE__ */ jsx16(
|
|
1161
|
+
transactionPreview_default,
|
|
1162
|
+
{
|
|
1163
|
+
price,
|
|
1164
|
+
collectionAddress,
|
|
1165
|
+
chainId,
|
|
1166
|
+
collectible,
|
|
1167
|
+
isConfirming,
|
|
1168
|
+
isConfirmed,
|
|
1169
|
+
isFailed
|
|
1170
|
+
}
|
|
1171
|
+
),
|
|
1172
|
+
/* @__PURE__ */ jsx16(
|
|
1173
|
+
TransactionFooter,
|
|
1174
|
+
{
|
|
1175
|
+
transactionHash: hash,
|
|
1176
|
+
isConfirming,
|
|
1177
|
+
isConfirmed,
|
|
1178
|
+
isFailed
|
|
1179
|
+
}
|
|
1180
|
+
),
|
|
1181
|
+
/* @__PURE__ */ jsx16(
|
|
1182
|
+
Close2,
|
|
1183
|
+
{
|
|
1184
|
+
onClick: () => {
|
|
1185
|
+
transactionStatusModal$.close();
|
|
1186
|
+
},
|
|
1187
|
+
className: closeButton4,
|
|
1188
|
+
asChild: true,
|
|
1189
|
+
children: /* @__PURE__ */ jsx16(IconButton3, { size: "xs", "aria-label": "Close modal", icon: CloseIcon2 })
|
|
1190
|
+
}
|
|
1191
|
+
)
|
|
1192
|
+
] })
|
|
1193
|
+
] }) });
|
|
1194
|
+
});
|
|
1195
|
+
var transactionStatusModal_default = TransactionStatusModal;
|
|
1191
1196
|
|
|
1192
1197
|
// src/react/ui/modals/CreateListingModal/_utils/getCreateListingTransactionTitleMessage.ts
|
|
1193
1198
|
var getCreateListingTransactionTitle = (params) => {
|
|
@@ -2804,12 +2809,508 @@ var ModalProvider = observer14(() => {
|
|
|
2804
2809
|
] });
|
|
2805
2810
|
});
|
|
2806
2811
|
|
|
2812
|
+
// src/react/ui/components/collectible-card/CollectibleCard.tsx
|
|
2813
|
+
import { useState as useState6 } from "react";
|
|
2814
|
+
import { Box as Box21, IconButton as IconButton7, Skeleton as Skeleton6 } from "@0xsequence/design-system";
|
|
2815
|
+
|
|
2816
|
+
// src/react/ui/components/_internals/action-button/ActionButton.tsx
|
|
2817
|
+
import { Button as Button7 } from "@0xsequence/design-system";
|
|
2818
|
+
import { observer as observer15 } from "@legendapp/state/react";
|
|
2819
|
+
import { useAccount as useAccount11 } from "wagmi";
|
|
2820
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
2821
|
+
var ActionButton = observer15(function AddToCartButton({
|
|
2822
|
+
collectionAddress,
|
|
2823
|
+
chainId,
|
|
2824
|
+
tokenId,
|
|
2825
|
+
isTransfer
|
|
2826
|
+
}) {
|
|
2827
|
+
const { address: accountAddress } = useAccount11();
|
|
2828
|
+
const { data: balance, isLoading: balanceLoading } = useBalanceOfCollectible({
|
|
2829
|
+
chainId,
|
|
2830
|
+
collectionAddress,
|
|
2831
|
+
collectableId: tokenId,
|
|
2832
|
+
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
2833
|
+
userAddress: accountAddress
|
|
2834
|
+
});
|
|
2835
|
+
const { data: highestOffer, isLoading: highestOfferLoading } = useHighestOffer({
|
|
2836
|
+
collectionAddress,
|
|
2837
|
+
chainId: String(chainId),
|
|
2838
|
+
tokenId
|
|
2839
|
+
});
|
|
2840
|
+
const { data: lowestListing, isLoading: lowestListingLoading } = useLowestListing({
|
|
2841
|
+
collectionAddress,
|
|
2842
|
+
chainId: String(chainId),
|
|
2843
|
+
tokenId
|
|
2844
|
+
});
|
|
2845
|
+
const collectibleOwned = balance?.balance ?? 0;
|
|
2846
|
+
const { show: showCreateListingModal } = useCreateListingModal();
|
|
2847
|
+
const { show: showMakeOfferModal } = useMakeOfferModal();
|
|
2848
|
+
const { show: showSellModal } = useSellModal();
|
|
2849
|
+
const { show: showTransferModal } = useTransferModal();
|
|
2850
|
+
if (balanceLoading || highestOfferLoading || lowestListingLoading || !accountAddress) {
|
|
2851
|
+
return null;
|
|
2852
|
+
}
|
|
2853
|
+
if (isTransfer && collectibleOwned) {
|
|
2854
|
+
return /* @__PURE__ */ jsx26(
|
|
2855
|
+
ActionButtonBody,
|
|
2856
|
+
{
|
|
2857
|
+
label: "Transfer",
|
|
2858
|
+
onClick: () => showTransferModal({
|
|
2859
|
+
collectionAddress,
|
|
2860
|
+
chainId,
|
|
2861
|
+
tokenId
|
|
2862
|
+
})
|
|
2863
|
+
}
|
|
2864
|
+
);
|
|
2865
|
+
}
|
|
2866
|
+
if (!collectibleOwned) {
|
|
2867
|
+
return /* @__PURE__ */ jsx26(
|
|
2868
|
+
ActionButtonBody,
|
|
2869
|
+
{
|
|
2870
|
+
label: "Make an offer",
|
|
2871
|
+
onClick: () => showMakeOfferModal({
|
|
2872
|
+
collectionAddress,
|
|
2873
|
+
chainId,
|
|
2874
|
+
collectibleId: tokenId
|
|
2875
|
+
})
|
|
2876
|
+
}
|
|
2877
|
+
);
|
|
2878
|
+
}
|
|
2879
|
+
if (!collectibleOwned && lowestListing?.order) {
|
|
2880
|
+
return /* @__PURE__ */ jsx26(
|
|
2881
|
+
ActionButtonBody,
|
|
2882
|
+
{
|
|
2883
|
+
label: "Add to cart",
|
|
2884
|
+
onClick: () => {
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2887
|
+
);
|
|
2888
|
+
}
|
|
2889
|
+
if (collectibleOwned && !lowestListing?.order) {
|
|
2890
|
+
return /* @__PURE__ */ jsx26(
|
|
2891
|
+
ActionButtonBody,
|
|
2892
|
+
{
|
|
2893
|
+
label: "Create listing",
|
|
2894
|
+
onClick: () => showCreateListingModal({
|
|
2895
|
+
collectionAddress,
|
|
2896
|
+
chainId,
|
|
2897
|
+
collectibleId: tokenId
|
|
2898
|
+
})
|
|
2899
|
+
}
|
|
2900
|
+
);
|
|
2901
|
+
}
|
|
2902
|
+
if (collectibleOwned && highestOffer?.order) {
|
|
2903
|
+
return /* @__PURE__ */ jsx26(
|
|
2904
|
+
ActionButtonBody,
|
|
2905
|
+
{
|
|
2906
|
+
label: "Sell",
|
|
2907
|
+
onClick: () => showSellModal({
|
|
2908
|
+
collectionAddress,
|
|
2909
|
+
chainId,
|
|
2910
|
+
tokenId,
|
|
2911
|
+
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
2912
|
+
order: highestOffer.order
|
|
2913
|
+
})
|
|
2914
|
+
}
|
|
2915
|
+
);
|
|
2916
|
+
}
|
|
2917
|
+
return null;
|
|
2918
|
+
});
|
|
2919
|
+
function ActionButtonBody({ label, onClick }) {
|
|
2920
|
+
return /* @__PURE__ */ jsx26(
|
|
2921
|
+
Button7,
|
|
2922
|
+
{
|
|
2923
|
+
variant: "primary",
|
|
2924
|
+
label,
|
|
2925
|
+
onClick: (e) => {
|
|
2926
|
+
e.preventDefault();
|
|
2927
|
+
e.stopPropagation();
|
|
2928
|
+
onClick();
|
|
2929
|
+
},
|
|
2930
|
+
size: "xs",
|
|
2931
|
+
shape: "square",
|
|
2932
|
+
width: "full"
|
|
2933
|
+
}
|
|
2934
|
+
);
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2937
|
+
// src/react/ui/icons/DiamondEye.tsx
|
|
2938
|
+
import { Box as Box17 } from "@0xsequence/design-system";
|
|
2939
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
2940
|
+
var Svg = () => /* @__PURE__ */ jsx27(
|
|
2941
|
+
"svg",
|
|
2942
|
+
{
|
|
2943
|
+
width: "16",
|
|
2944
|
+
height: "12",
|
|
2945
|
+
viewBox: "0 0 16 12",
|
|
2946
|
+
fill: "none",
|
|
2947
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2948
|
+
children: /* @__PURE__ */ jsx27(
|
|
2949
|
+
"path",
|
|
2950
|
+
{
|
|
2951
|
+
fillRule: "evenodd",
|
|
2952
|
+
clipRule: "evenodd",
|
|
2953
|
+
d: "M5.00447 0.108826L0.611084 4.50526L7.99997 11.8911L15.3889 4.50526L10.9955 0.108826H5.00447ZM4.60507 2.90461C6.4718 1.0297 9.52815 1.02968 11.3949 2.90459L12.9925 4.50223L11.3949 6.09983C9.52815 7.97473 6.4718 7.97473 4.60507 6.09985L3.00749 4.50223L4.60507 2.90461ZM5.70321 4.50209C5.70321 5.77095 6.73193 6.79865 7.99974 6.79865C9.2676 6.79865 10.2963 5.77095 10.2963 4.50209C10.2963 3.23322 9.2676 2.20553 7.99974 2.20553C6.73193 2.20553 5.70321 3.23322 5.70321 4.50209ZM7.99974 5.50058C7.44853 5.50058 7.00125 5.05377 7.00125 4.50209C7.00125 3.9504 7.44853 3.50359 7.99974 3.50359C8.55095 3.50359 8.99825 3.9504 8.99825 4.50209C8.99825 5.05377 8.55095 5.50058 7.99974 5.50058Z",
|
|
2954
|
+
fill: "white"
|
|
2955
|
+
}
|
|
2956
|
+
)
|
|
2957
|
+
}
|
|
2958
|
+
);
|
|
2959
|
+
var SvgDiamondEyeIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx27(
|
|
2960
|
+
Box17,
|
|
2961
|
+
{
|
|
2962
|
+
as: Svg,
|
|
2963
|
+
className: iconVariants({
|
|
2964
|
+
size
|
|
2965
|
+
}),
|
|
2966
|
+
...props
|
|
2967
|
+
}
|
|
2968
|
+
);
|
|
2969
|
+
var DiamondEye_default = SvgDiamondEyeIcon;
|
|
2970
|
+
|
|
2971
|
+
// src/react/ui/components/collectible-card/Footer.tsx
|
|
2972
|
+
import { Box as Box20, IconButton as IconButton6, Image as Image4, Text as Text17 } from "@0xsequence/design-system";
|
|
2973
|
+
import { useAccount as useAccount12 } from "wagmi";
|
|
2974
|
+
import { formatUnits as formatUnits4 } from "viem";
|
|
2975
|
+
|
|
2976
|
+
// src/react/ui/components/_internals/pill/Pill.tsx
|
|
2977
|
+
import { Box as Box18, Text as Text16 } from "@0xsequence/design-system";
|
|
2978
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
2979
|
+
function Pill({ text }) {
|
|
2980
|
+
return /* @__PURE__ */ jsx28(
|
|
2981
|
+
Box18,
|
|
2982
|
+
{
|
|
2983
|
+
background: "backgroundRaised",
|
|
2984
|
+
display: "flex",
|
|
2985
|
+
alignItems: "center",
|
|
2986
|
+
justifyContent: "center",
|
|
2987
|
+
paddingY: "1",
|
|
2988
|
+
paddingX: "2",
|
|
2989
|
+
borderRadius: "sm",
|
|
2990
|
+
width: "max",
|
|
2991
|
+
children: /* @__PURE__ */ jsx28(Text16, { fontSize: "small", fontWeight: "medium", color: "text80", children: text })
|
|
2992
|
+
}
|
|
2993
|
+
);
|
|
2994
|
+
}
|
|
2995
|
+
|
|
2996
|
+
// src/react/ui/icons/Bell.tsx
|
|
2997
|
+
import { Box as Box19 } from "@0xsequence/design-system";
|
|
2998
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
2999
|
+
var Svg2 = () => /* @__PURE__ */ jsx29(
|
|
3000
|
+
"svg",
|
|
3001
|
+
{
|
|
3002
|
+
width: "17",
|
|
3003
|
+
height: "17",
|
|
3004
|
+
viewBox: "0 0 17 17",
|
|
3005
|
+
fill: "none",
|
|
3006
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3007
|
+
children: /* @__PURE__ */ jsx29(
|
|
3008
|
+
"path",
|
|
3009
|
+
{
|
|
3010
|
+
"fill-rule": "evenodd",
|
|
3011
|
+
"clip-rule": "evenodd",
|
|
3012
|
+
d: "M12.3127 7.45705V9.74274C12.3127 10.3805 12.6293 10.6971 12.9647 11.0326L12.9652 11.033L12.9679 11.0358C13.3205 11.3893 13.6843 11.754 13.6843 12.4854C13.6843 12.5491 13.6335 12.5998 13.57 12.5998H3.51277C3.44959 12.5998 3.39844 12.5489 3.39844 12.4854C3.39844 11.7539 3.76242 11.389 4.11507 11.0354L4.11754 11.033C4.45305 10.6975 4.76984 10.3807 4.76984 9.74245V7.45676C4.76984 5.6932 5.98854 4.21248 7.62704 3.802V3.11399C7.62704 2.60926 8.03659 2.19971 8.54132 2.19971C9.04606 2.19971 9.45561 2.60926 9.45561 3.11399V3.802C11.094 4.21286 12.3127 5.69335 12.3127 7.45705ZM10.3698 13.1711C10.3698 14.1809 9.55099 14.9997 8.54121 14.9997C7.53128 14.9997 6.71272 14.181 6.71272 13.1711H10.3698ZM8.758 7.70501C9.30005 7.85574 9.6696 7.99832 9.86302 8.13224C10.1776 8.35015 10.3374 8.67657 10.338 9.106C10.338 9.7284 10.1359 10.1706 9.72956 10.4326C9.50571 10.5778 9.18295 10.6723 8.75846 10.7195V11.4005H8.42657V10.7195C7.74604 10.6746 7.28244 10.4349 7.04094 9.99812C6.90703 9.76157 6.83984 9.44246 6.83984 9.04019H7.46277C7.48004 9.35983 7.53041 9.59501 7.6135 9.74163C7.75837 10.0063 8.0303 10.1548 8.42664 10.1861V8.27703C7.9177 8.18078 7.54357 8.01963 7.30116 7.79532C7.0605 7.57102 6.93929 7.25914 6.93929 6.86234C6.93929 6.50686 7.06917 6.18768 7.32977 5.90212C7.58991 5.61657 7.95581 5.47132 8.42619 5.46675V5.00049H8.75808V5.45861C9.22343 5.4927 9.58119 5.62981 9.82863 5.87039C10.0787 6.11144 10.2086 6.43062 10.2204 6.82651H9.60569C9.5907 6.64899 9.54299 6.49507 9.4631 6.36884C9.31595 6.13183 9.08076 6.00697 8.758 5.99518V7.70501ZM7.80143 7.36315C7.95574 7.49478 8.16369 7.58608 8.42611 7.63691L8.42619 5.98886C8.11651 5.99936 7.89723 6.09424 7.76651 6.2681C7.63572 6.4447 7.57036 6.62815 7.57036 6.82019C7.57036 7.05081 7.64705 7.23289 7.80143 7.36315ZM8.75747 10.2033C9.15883 10.1847 9.43305 10.0394 9.58606 9.76522C9.66504 9.62408 9.70415 9.46285 9.70399 9.27948C9.70399 8.98624 9.59686 8.76376 9.38123 8.61121C9.2582 8.52219 9.05079 8.4391 8.75747 8.35921V10.2033Z",
|
|
3013
|
+
fill: "white"
|
|
3014
|
+
}
|
|
3015
|
+
)
|
|
3016
|
+
}
|
|
3017
|
+
);
|
|
3018
|
+
var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx29(
|
|
3019
|
+
Box19,
|
|
3020
|
+
{
|
|
3021
|
+
as: Svg2,
|
|
3022
|
+
className: iconVariants({
|
|
3023
|
+
size
|
|
3024
|
+
}),
|
|
3025
|
+
...props
|
|
3026
|
+
}
|
|
3027
|
+
);
|
|
3028
|
+
var Bell_default = SvgBellIcon;
|
|
3029
|
+
|
|
3030
|
+
// src/react/ui/components/collectible-card/styles.css.ts
|
|
3031
|
+
var actionWrapper = "styles_actionWrapper__biep7a7";
|
|
3032
|
+
var collectibleCard = "styles_collectibleCard__biep7a0";
|
|
3033
|
+
var collectibleImage = "styles_collectibleImage__biep7a1";
|
|
3034
|
+
var collectibleTileWrapper = "styles_collectibleTileWrapper__biep7a2";
|
|
3035
|
+
var footer = { animated: "styles_footer_animated__biep7a5 fyvr11wl", "static": "fyvr11wl" };
|
|
3036
|
+
var offerBellButton = "styles_offerBellButton__biep7a3";
|
|
3037
|
+
|
|
3038
|
+
// src/react/ui/components/collectible-card/Footer.tsx
|
|
3039
|
+
import { jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3040
|
+
var Footer = ({
|
|
3041
|
+
name,
|
|
3042
|
+
type,
|
|
3043
|
+
chainId,
|
|
3044
|
+
tokenId,
|
|
3045
|
+
collectionAddress,
|
|
3046
|
+
onOfferClick
|
|
3047
|
+
}) => {
|
|
3048
|
+
const { address: accountAddress } = useAccount12();
|
|
3049
|
+
const { data: balance } = useBalanceOfCollectible({
|
|
3050
|
+
chainId: String(chainId),
|
|
3051
|
+
collectionAddress,
|
|
3052
|
+
collectableId: tokenId,
|
|
3053
|
+
userAddress: accountAddress
|
|
3054
|
+
});
|
|
3055
|
+
const { data: lowestListing } = useLowestListing({
|
|
3056
|
+
chainId: String(chainId),
|
|
3057
|
+
collectionAddress,
|
|
3058
|
+
tokenId
|
|
3059
|
+
});
|
|
3060
|
+
const { data: highestOffer } = useHighestOffer({
|
|
3061
|
+
chainId: String(chainId),
|
|
3062
|
+
collectionAddress,
|
|
3063
|
+
tokenId
|
|
3064
|
+
});
|
|
3065
|
+
const { data: currencies } = useCurrencies({
|
|
3066
|
+
chainId: String(chainId),
|
|
3067
|
+
collectionAddress,
|
|
3068
|
+
query: {
|
|
3069
|
+
enabled: !!lowestListing?.order
|
|
3070
|
+
}
|
|
3071
|
+
});
|
|
3072
|
+
const currency = currencies?.find(
|
|
3073
|
+
(currency2) => currency2.contractAddress === lowestListing?.order?.priceCurrencyAddress
|
|
3074
|
+
);
|
|
3075
|
+
if (name.length > 15 && highestOffer?.order) {
|
|
3076
|
+
name = name.substring(0, 13) + "...";
|
|
3077
|
+
}
|
|
3078
|
+
if (name.length > 17 && !highestOffer?.order) {
|
|
3079
|
+
name = name.substring(0, 17) + "...";
|
|
3080
|
+
}
|
|
3081
|
+
return /* @__PURE__ */ jsxs22(
|
|
3082
|
+
Box20,
|
|
3083
|
+
{
|
|
3084
|
+
display: "flex",
|
|
3085
|
+
flexDirection: "column",
|
|
3086
|
+
gap: "2",
|
|
3087
|
+
padding: "4",
|
|
3088
|
+
whiteSpace: "nowrap",
|
|
3089
|
+
position: "relative",
|
|
3090
|
+
className: accountAddress ? footer.animated : footer.static,
|
|
3091
|
+
children: [
|
|
3092
|
+
/* @__PURE__ */ jsxs22(
|
|
3093
|
+
Box20,
|
|
3094
|
+
{
|
|
3095
|
+
display: "flex",
|
|
3096
|
+
alignItems: "center",
|
|
3097
|
+
justifyContent: "space-between",
|
|
3098
|
+
position: "relative",
|
|
3099
|
+
children: [
|
|
3100
|
+
/* @__PURE__ */ jsx30(Text17, { color: "text100", fontSize: "normal", fontWeight: "bold", textAlign: "left", children: name }),
|
|
3101
|
+
highestOffer?.order && onOfferClick && /* @__PURE__ */ jsx30(
|
|
3102
|
+
IconButton6,
|
|
3103
|
+
{
|
|
3104
|
+
variant: "primary",
|
|
3105
|
+
className: offerBellButton,
|
|
3106
|
+
onClick: (e) => {
|
|
3107
|
+
e.stopPropagation();
|
|
3108
|
+
onOfferClick?.();
|
|
3109
|
+
},
|
|
3110
|
+
icon: Bell_default
|
|
3111
|
+
}
|
|
3112
|
+
)
|
|
3113
|
+
]
|
|
3114
|
+
}
|
|
3115
|
+
),
|
|
3116
|
+
lowestListing?.order && currency && /* @__PURE__ */ jsxs22(Box20, { display: "flex", alignItems: "center", gap: "1", children: [
|
|
3117
|
+
/* @__PURE__ */ jsx30(Image4, { src: currency?.imageUrl, width: "3", height: "3" }),
|
|
3118
|
+
/* @__PURE__ */ jsxs22(Text17, { color: "text100", fontSize: "small", fontWeight: "bold", textAlign: "left", children: [
|
|
3119
|
+
formatUnits4(
|
|
3120
|
+
BigInt(lowestListing.order.priceAmount),
|
|
3121
|
+
currency.decimals
|
|
3122
|
+
),
|
|
3123
|
+
" "
|
|
3124
|
+
] })
|
|
3125
|
+
] }),
|
|
3126
|
+
balance && type !== "ERC721" /* ERC721 */ && /* @__PURE__ */ jsx30(Pill, { text: `Owned: ${balance}` }),
|
|
3127
|
+
type === "ERC721" /* ERC721 */ && /* @__PURE__ */ jsx30(Pill, { text: "ERC-721" })
|
|
3128
|
+
]
|
|
3129
|
+
}
|
|
3130
|
+
);
|
|
3131
|
+
};
|
|
3132
|
+
|
|
3133
|
+
// src/react/ui/images/chess-tile.png
|
|
3134
|
+
var chess_tile_default = "./chess-tile-6BS5MQT5.png";
|
|
3135
|
+
|
|
3136
|
+
// src/react/ui/components/collectible-card/CollectibleCard.tsx
|
|
3137
|
+
import { useAccount as useAccount13 } from "wagmi";
|
|
3138
|
+
import { jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3139
|
+
function CollectibleSkeleton() {
|
|
3140
|
+
return /* @__PURE__ */ jsxs23(
|
|
3141
|
+
Box21,
|
|
3142
|
+
{
|
|
3143
|
+
display: "flex",
|
|
3144
|
+
flexDirection: "column",
|
|
3145
|
+
gap: "3",
|
|
3146
|
+
alignItems: "center",
|
|
3147
|
+
overflow: "hidden",
|
|
3148
|
+
children: [
|
|
3149
|
+
/* @__PURE__ */ jsx31(
|
|
3150
|
+
Skeleton6,
|
|
3151
|
+
{
|
|
3152
|
+
size: "lg",
|
|
3153
|
+
style: { width: "100%", height: 164, borderRadius: 0, paddingTop: 16 }
|
|
3154
|
+
}
|
|
3155
|
+
),
|
|
3156
|
+
/* @__PURE__ */ jsxs23(
|
|
3157
|
+
Box21,
|
|
3158
|
+
{
|
|
3159
|
+
display: "flex",
|
|
3160
|
+
flexDirection: "column",
|
|
3161
|
+
gap: "2",
|
|
3162
|
+
paddingX: "4",
|
|
3163
|
+
paddingBottom: "4",
|
|
3164
|
+
children: [
|
|
3165
|
+
/* @__PURE__ */ jsx31(Skeleton6, { size: "lg" }),
|
|
3166
|
+
/* @__PURE__ */ jsx31(Skeleton6, { size: "sm" })
|
|
3167
|
+
]
|
|
3168
|
+
}
|
|
3169
|
+
)
|
|
3170
|
+
]
|
|
3171
|
+
}
|
|
3172
|
+
);
|
|
3173
|
+
}
|
|
3174
|
+
function CollectibleCard({
|
|
3175
|
+
tokenId,
|
|
3176
|
+
chainId,
|
|
3177
|
+
collectionAddress,
|
|
3178
|
+
onCollectibleClick,
|
|
3179
|
+
onOfferClick
|
|
3180
|
+
}) {
|
|
3181
|
+
const { data: collectible, isLoading: collectibleLoading } = useCollectible({
|
|
3182
|
+
chainId: String(chainId),
|
|
3183
|
+
collectionAddress,
|
|
3184
|
+
collectibleId: tokenId
|
|
3185
|
+
});
|
|
3186
|
+
const { data: collection } = useCollection({
|
|
3187
|
+
chainId: String(chainId),
|
|
3188
|
+
collectionAddress
|
|
3189
|
+
});
|
|
3190
|
+
if (collectibleLoading || !collectible || !collection) {
|
|
3191
|
+
return /* @__PURE__ */ jsx31(CollectibleSkeleton, {});
|
|
3192
|
+
}
|
|
3193
|
+
return /* @__PURE__ */ jsx31(
|
|
3194
|
+
Box21,
|
|
3195
|
+
{
|
|
3196
|
+
className: collectibleCard,
|
|
3197
|
+
borderRadius: "md",
|
|
3198
|
+
overflow: "hidden",
|
|
3199
|
+
background: "backgroundPrimary",
|
|
3200
|
+
children: /* @__PURE__ */ jsx31(
|
|
3201
|
+
CardWrapper,
|
|
3202
|
+
{
|
|
3203
|
+
name: collectible.name,
|
|
3204
|
+
type: collection.type,
|
|
3205
|
+
imageSrc: collectible.image,
|
|
3206
|
+
tokenId,
|
|
3207
|
+
chainId: String(chainId),
|
|
3208
|
+
collectionAddress,
|
|
3209
|
+
marketplaceSource: collectible.external_url,
|
|
3210
|
+
onCollectibleClick,
|
|
3211
|
+
onOfferClick
|
|
3212
|
+
}
|
|
3213
|
+
)
|
|
3214
|
+
}
|
|
3215
|
+
);
|
|
3216
|
+
}
|
|
3217
|
+
var CardWrapper = ({
|
|
3218
|
+
name,
|
|
3219
|
+
type,
|
|
3220
|
+
imageSrc,
|
|
3221
|
+
tokenId,
|
|
3222
|
+
chainId,
|
|
3223
|
+
collectionAddress,
|
|
3224
|
+
marketplaceSource,
|
|
3225
|
+
onCollectibleClick,
|
|
3226
|
+
onOfferClick
|
|
3227
|
+
}) => {
|
|
3228
|
+
const { address: accountAddress } = useAccount13();
|
|
3229
|
+
const [loadingError, setLoadingError] = useState6(false);
|
|
3230
|
+
return /* @__PURE__ */ jsx31(
|
|
3231
|
+
Box21,
|
|
3232
|
+
{
|
|
3233
|
+
display: "flex",
|
|
3234
|
+
flexDirection: "column",
|
|
3235
|
+
alignItems: "flex-start",
|
|
3236
|
+
position: "relative",
|
|
3237
|
+
width: "full",
|
|
3238
|
+
height: "full",
|
|
3239
|
+
zIndex: "10",
|
|
3240
|
+
overflow: "hidden",
|
|
3241
|
+
onClick: onCollectibleClick,
|
|
3242
|
+
as: "button",
|
|
3243
|
+
border: "none",
|
|
3244
|
+
padding: "0",
|
|
3245
|
+
className: collectibleTileWrapper,
|
|
3246
|
+
children: /* @__PURE__ */ jsxs23("article", { style: { width: "100%" }, children: [
|
|
3247
|
+
marketplaceSource && /* @__PURE__ */ jsx31(
|
|
3248
|
+
IconButton7,
|
|
3249
|
+
{
|
|
3250
|
+
as: "a",
|
|
3251
|
+
href: marketplaceSource,
|
|
3252
|
+
size: "sm",
|
|
3253
|
+
backdropFilter: "blur",
|
|
3254
|
+
variant: "glass",
|
|
3255
|
+
onClick: (e) => {
|
|
3256
|
+
e.stopPropagation();
|
|
3257
|
+
},
|
|
3258
|
+
position: "absolute",
|
|
3259
|
+
top: "2",
|
|
3260
|
+
left: "2",
|
|
3261
|
+
icon: DiamondEye_default
|
|
3262
|
+
}
|
|
3263
|
+
),
|
|
3264
|
+
/* @__PURE__ */ jsx31(
|
|
3265
|
+
"img",
|
|
3266
|
+
{
|
|
3267
|
+
src: loadingError ? chess_tile_default : imageSrc || chess_tile_default,
|
|
3268
|
+
alt: name,
|
|
3269
|
+
className: collectibleImage,
|
|
3270
|
+
onError: () => setLoadingError(true)
|
|
3271
|
+
}
|
|
3272
|
+
),
|
|
3273
|
+
/* @__PURE__ */ jsx31(
|
|
3274
|
+
Footer,
|
|
3275
|
+
{
|
|
3276
|
+
name,
|
|
3277
|
+
type,
|
|
3278
|
+
tokenId,
|
|
3279
|
+
chainId,
|
|
3280
|
+
collectionAddress,
|
|
3281
|
+
onOfferClick
|
|
3282
|
+
}
|
|
3283
|
+
),
|
|
3284
|
+
accountAddress && /* @__PURE__ */ jsx31(
|
|
3285
|
+
Box21,
|
|
3286
|
+
{
|
|
3287
|
+
display: "flex",
|
|
3288
|
+
alignItems: "center",
|
|
3289
|
+
justifyContent: "center",
|
|
3290
|
+
padding: "2",
|
|
3291
|
+
className: actionWrapper,
|
|
3292
|
+
children: /* @__PURE__ */ jsx31(
|
|
3293
|
+
ActionButton,
|
|
3294
|
+
{
|
|
3295
|
+
chainId: String(chainId),
|
|
3296
|
+
collectionAddress,
|
|
3297
|
+
tokenId
|
|
3298
|
+
}
|
|
3299
|
+
)
|
|
3300
|
+
}
|
|
3301
|
+
)
|
|
3302
|
+
] })
|
|
3303
|
+
}
|
|
3304
|
+
);
|
|
3305
|
+
};
|
|
3306
|
+
|
|
2807
3307
|
export {
|
|
2808
3308
|
useCreateListingModal,
|
|
2809
3309
|
useMakeOfferModal,
|
|
2810
3310
|
useSellModal,
|
|
2811
3311
|
useSuccessfulPurchaseModal,
|
|
2812
3312
|
useTransferModal,
|
|
2813
|
-
ModalProvider
|
|
3313
|
+
ModalProvider,
|
|
3314
|
+
CollectibleCard
|
|
2814
3315
|
};
|
|
2815
|
-
//# sourceMappingURL=chunk-
|
|
3316
|
+
//# sourceMappingURL=chunk-QXLZPSSR.js.map
|