@0xsequence/marketplace-sdk 0.4.3 → 0.4.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-2AMLJ2TA.js → chunk-6XUCLBZC.js} +294 -153
- package/dist/chunk-6XUCLBZC.js.map +1 -0
- package/dist/{chunk-ST6RH2IB.js → chunk-GLOIEUWC.js} +8 -8
- package/dist/chunk-GLOIEUWC.js.map +1 -0
- package/dist/{chunk-VYSWBIWC.js → chunk-J4TRSLTB.js} +2 -2
- package/dist/{chunk-YZE7RXC2.js → chunk-LHN6EBLM.js} +8 -5
- package/dist/{chunk-YZE7RXC2.js.map → chunk-LHN6EBLM.js.map} +1 -1
- package/dist/index.js +13 -13
- package/dist/react/_internal/index.js +6 -6
- package/dist/react/hooks/index.js +7 -7
- package/dist/react/index.js +11 -11
- package/dist/react/ui/components/index.js +9 -9
- package/dist/react/ui/index.d.ts +4 -1
- package/dist/react/ui/index.js +9 -9
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +6 -6
- package/dist/types/index.js +1 -1
- package/dist/utils/abi/index.js +5 -5
- package/dist/utils/index.js +6 -6
- package/package.json +1 -1
- package/src/react/hooks/useCancelTransactionSteps.tsx +1 -1
- package/src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts +2 -1
- package/src/react/ui/modals/CreateListingModal/Modal.tsx +1 -1
- package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +22 -1
- package/src/react/ui/modals/MakeOfferModal/Modal.tsx +43 -9
- package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +35 -7
- package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +28 -9
- package/src/react/ui/modals/_internal/components/currencyImage/index.tsx +8 -10
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +9 -1
- package/src/react/ui/modals/_internal/components/priceInput/hooks/useBalanceCheck.ts +67 -0
- package/src/react/ui/modals/_internal/components/priceInput/hooks/usePriceInput.ts +54 -0
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +48 -71
- package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +3 -3
- package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +3 -3
- package/src/react/ui/modals/_internal/types.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/chunk-2AMLJ2TA.js.map +0 -1
- package/dist/chunk-ST6RH2IB.js.map +0 -1
- /package/dist/{chunk-VYSWBIWC.js.map → chunk-J4TRSLTB.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
ActionModal,
|
|
4
4
|
CustomSelect,
|
|
5
5
|
useCurrencyBalance
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-J4TRSLTB.js";
|
|
7
7
|
import {
|
|
8
8
|
CalendarIcon_default,
|
|
9
9
|
MinusIcon_default,
|
|
@@ -53,13 +53,13 @@ import {
|
|
|
53
53
|
useMarketplaceConfig,
|
|
54
54
|
useRoyaltyPercentage,
|
|
55
55
|
useTransferTokens
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-GLOIEUWC.js";
|
|
57
57
|
import {
|
|
58
58
|
AlertMessage,
|
|
59
59
|
switchChainModal_default,
|
|
60
60
|
useSwitchChainModal,
|
|
61
61
|
useWallet
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-LHN6EBLM.js";
|
|
63
63
|
import {
|
|
64
64
|
iconVariants
|
|
65
65
|
} from "./chunk-LF44FCG5.js";
|
|
@@ -68,6 +68,9 @@ import {
|
|
|
68
68
|
getPublicRpcClient,
|
|
69
69
|
truncateMiddle
|
|
70
70
|
} from "./chunk-4VS5NKDD.js";
|
|
71
|
+
import {
|
|
72
|
+
getProviderEl
|
|
73
|
+
} from "./chunk-ZEKRTFBU.js";
|
|
71
74
|
import {
|
|
72
75
|
balanceQueries,
|
|
73
76
|
getMarketplaceClient,
|
|
@@ -100,9 +103,9 @@ var AccountModal = observer(function AccountModal2() {
|
|
|
100
103
|
});
|
|
101
104
|
|
|
102
105
|
// src/react/ui/modals/MakeOfferModal/Modal.tsx
|
|
103
|
-
import { Show, observer as observer7 } from "@legendapp/state/react";
|
|
104
|
-
import { useState as
|
|
105
|
-
import { parseUnits as parseUnits2 } from "viem";
|
|
106
|
+
import { Show, observer as observer7, use$ } from "@legendapp/state/react";
|
|
107
|
+
import { useState as useState7 } from "react";
|
|
108
|
+
import { parseUnits as parseUnits2, zeroAddress } from "viem";
|
|
106
109
|
|
|
107
110
|
// src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx
|
|
108
111
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -595,7 +598,7 @@ var TransactionStatusModal = observer3(() => {
|
|
|
595
598
|
console.log("receipt", receipt);
|
|
596
599
|
setTransactionStatus("SUCCESS");
|
|
597
600
|
if (callbacks?.onSuccess) {
|
|
598
|
-
callbacks.onSuccess(hash || "
|
|
601
|
+
callbacks.onSuccess({ hash: hash || "0x0" });
|
|
599
602
|
} else {
|
|
600
603
|
console.debug("onSuccess callback not provided:", hash);
|
|
601
604
|
}
|
|
@@ -643,7 +646,7 @@ var TransactionStatusModal = observer3(() => {
|
|
|
643
646
|
confirmations: confirmations || TRANSACTION_CONFIRMATIONS_DEFAULT,
|
|
644
647
|
hash: hash || "0x"
|
|
645
648
|
});
|
|
646
|
-
return /* @__PURE__ */ jsx5(Root, { open: transactionStatusModal$.isOpen.get(), children: /* @__PURE__ */ jsxs4(Portal, { children: [
|
|
649
|
+
return /* @__PURE__ */ jsx5(Root, { open: transactionStatusModal$.isOpen.get(), children: /* @__PURE__ */ jsxs4(Portal, { container: getProviderEl(), children: [
|
|
647
650
|
/* @__PURE__ */ jsx5(Overlay, { className: dialogOverlay3 }),
|
|
648
651
|
/* @__PURE__ */ jsxs4(Content, { className: transactionStatusModalContent, children: [
|
|
649
652
|
title ? /* @__PURE__ */ jsx5(
|
|
@@ -773,11 +776,12 @@ var useTransactionSteps = ({
|
|
|
773
776
|
if (!wallet) return;
|
|
774
777
|
try {
|
|
775
778
|
steps$.transaction.isExecuting.set(true);
|
|
776
|
-
const
|
|
777
|
-
|
|
779
|
+
const steps = await getOfferSteps();
|
|
780
|
+
const transactionStep = steps?.find(
|
|
781
|
+
(step) => step.id === "createOffer" /* createOffer */
|
|
778
782
|
);
|
|
779
|
-
const signatureStep =
|
|
780
|
-
(
|
|
783
|
+
const signatureStep = steps?.find(
|
|
784
|
+
(step) => step.id === "signEIP712" /* signEIP712 */
|
|
781
785
|
);
|
|
782
786
|
console.debug("transactionStep", transactionStep);
|
|
783
787
|
console.debug("signatureStep", signatureStep);
|
|
@@ -801,9 +805,27 @@ var useTransactionSteps = ({
|
|
|
801
805
|
orderId,
|
|
802
806
|
callbacks
|
|
803
807
|
});
|
|
804
|
-
|
|
808
|
+
if (hash) {
|
|
809
|
+
await waitForReceipt(hash);
|
|
810
|
+
steps$.transaction.isExecuting.set(false);
|
|
811
|
+
steps$.transaction.exist.set(false);
|
|
812
|
+
if (callbacks?.onSuccess && typeof callbacks.onSuccess === "function") {
|
|
813
|
+
callbacks.onSuccess({ hash });
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
if (orderId) {
|
|
817
|
+
steps$.transaction.isExecuting.set(false);
|
|
818
|
+
steps$.transaction.exist.set(false);
|
|
819
|
+
if (callbacks?.onSuccess && typeof callbacks.onSuccess === "function") {
|
|
820
|
+
callbacks.onSuccess({ orderId });
|
|
821
|
+
}
|
|
822
|
+
}
|
|
805
823
|
} catch (error) {
|
|
806
824
|
steps$.transaction.isExecuting.set(false);
|
|
825
|
+
steps$.transaction.exist.set(false);
|
|
826
|
+
if (callbacks?.onError && typeof callbacks.onError === "function") {
|
|
827
|
+
callbacks.onError(error);
|
|
828
|
+
}
|
|
807
829
|
throw error;
|
|
808
830
|
}
|
|
809
831
|
};
|
|
@@ -1169,20 +1191,17 @@ function FloorPriceText({
|
|
|
1169
1191
|
// src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
1170
1192
|
import { Box as Box9, NumericInput, Text as Text8 } from "@0xsequence/design-system";
|
|
1171
1193
|
import { observer as observer6 } from "@legendapp/state/react";
|
|
1172
|
-
import {
|
|
1173
|
-
import { parseUnits } from "viem";
|
|
1194
|
+
import { useCallback, useMemo } from "react";
|
|
1174
1195
|
import { useAccount as useAccount2 } from "wagmi";
|
|
1175
1196
|
|
|
1176
1197
|
// src/react/ui/modals/_internal/components/currencyImage/index.tsx
|
|
1177
1198
|
import { Box as Box8, TokenImage } from "@0xsequence/design-system";
|
|
1178
1199
|
import { useState as useState4 } from "react";
|
|
1179
1200
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1180
|
-
function CurrencyImage({
|
|
1181
|
-
$listingPrice
|
|
1182
|
-
}) {
|
|
1201
|
+
function CurrencyImage({ price$ }) {
|
|
1183
1202
|
const [imageLoadErrorCurrencyAddresses, setImageLoadErrorCurrencyAddresses] = useState4(null);
|
|
1184
1203
|
if (imageLoadErrorCurrencyAddresses?.includes(
|
|
1185
|
-
|
|
1204
|
+
price$.currency.contractAddress.get()
|
|
1186
1205
|
)) {
|
|
1187
1206
|
return /* @__PURE__ */ jsx12(
|
|
1188
1207
|
Box8,
|
|
@@ -1197,17 +1216,17 @@ function CurrencyImage({
|
|
|
1197
1216
|
return /* @__PURE__ */ jsx12(
|
|
1198
1217
|
TokenImage,
|
|
1199
1218
|
{
|
|
1200
|
-
src:
|
|
1219
|
+
src: price$.currency.imageUrl.get(),
|
|
1201
1220
|
onError: () => {
|
|
1202
|
-
const
|
|
1203
|
-
if (
|
|
1221
|
+
const price = price$?.get();
|
|
1222
|
+
if (price) {
|
|
1204
1223
|
setImageLoadErrorCurrencyAddresses((prev) => {
|
|
1205
1224
|
if (!prev)
|
|
1206
|
-
return [
|
|
1207
|
-
if (!prev.includes(
|
|
1225
|
+
return [price$.currency.contractAddress.get()];
|
|
1226
|
+
if (!prev.includes(price$.currency.contractAddress.get())) {
|
|
1208
1227
|
return [
|
|
1209
1228
|
...prev,
|
|
1210
|
-
|
|
1229
|
+
price$.currency.contractAddress.get()
|
|
1211
1230
|
];
|
|
1212
1231
|
}
|
|
1213
1232
|
return prev;
|
|
@@ -1228,6 +1247,7 @@ import { jsx as jsx13 } from "react/jsx-runtime";
|
|
|
1228
1247
|
var CurrencyOptionsSelect = observer5(function CurrencyOptionsSelect2({
|
|
1229
1248
|
chainId,
|
|
1230
1249
|
collectionAddress,
|
|
1250
|
+
secondCurrencyAsDefault,
|
|
1231
1251
|
selectedCurrency$
|
|
1232
1252
|
}) {
|
|
1233
1253
|
const currency = selectedCurrency$.get();
|
|
@@ -1238,7 +1258,11 @@ var CurrencyOptionsSelect = observer5(function CurrencyOptionsSelect2({
|
|
|
1238
1258
|
});
|
|
1239
1259
|
useEffect4(() => {
|
|
1240
1260
|
if (currencies && currencies.length > 0 && !selectedCurrency$.get()?.contractAddress) {
|
|
1241
|
-
|
|
1261
|
+
if (secondCurrencyAsDefault) {
|
|
1262
|
+
selectedCurrency$.set(currencies[1]);
|
|
1263
|
+
} else {
|
|
1264
|
+
selectedCurrency$.set(currencies[0]);
|
|
1265
|
+
}
|
|
1242
1266
|
}
|
|
1243
1267
|
}, [currencies]);
|
|
1244
1268
|
if (!currencies || currenciesLoading || !currency.symbol) {
|
|
@@ -1271,44 +1295,70 @@ var CurrencyOptionsSelect = observer5(function CurrencyOptionsSelect2({
|
|
|
1271
1295
|
});
|
|
1272
1296
|
var currencyOptionsSelect_default = CurrencyOptionsSelect;
|
|
1273
1297
|
|
|
1274
|
-
// src/react/ui/modals/_internal/components/priceInput/
|
|
1275
|
-
import {
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
onPriceChange
|
|
1281
|
-
|
|
1282
|
-
}) {
|
|
1283
|
-
const [balanceError, setBalanceError] = useState5("");
|
|
1284
|
-
const { address: accountAddress } = useAccount2();
|
|
1285
|
-
const { data: balance, isSuccess: isBalanceSuccess } = useCurrencyBalance({
|
|
1286
|
-
currencyAddress: $listingPrice.currency.contractAddress.get(),
|
|
1287
|
-
chainId: Number(chainId),
|
|
1288
|
-
userAddress: accountAddress
|
|
1289
|
-
});
|
|
1290
|
-
const currencyDecimals = $listingPrice.currency.decimals.get();
|
|
1298
|
+
// src/react/ui/modals/_internal/components/priceInput/hooks/usePriceInput.ts
|
|
1299
|
+
import { useState as useState5, useEffect as useEffect5 } from "react";
|
|
1300
|
+
import { parseUnits } from "viem";
|
|
1301
|
+
var usePriceInput = ({
|
|
1302
|
+
price$,
|
|
1303
|
+
currencyDecimals,
|
|
1304
|
+
onPriceChange
|
|
1305
|
+
}) => {
|
|
1291
1306
|
const [value, setValue] = useState5("");
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1307
|
+
useEffect5(() => {
|
|
1308
|
+
const currentAmount = value.replace(/,/g, "");
|
|
1309
|
+
if (currentAmount) {
|
|
1310
|
+
try {
|
|
1311
|
+
const parsedAmount = parseUnits(
|
|
1312
|
+
currentAmount,
|
|
1313
|
+
Number(currencyDecimals)
|
|
1314
|
+
);
|
|
1315
|
+
price$.amountRaw.set(parsedAmount.toString());
|
|
1316
|
+
} catch {
|
|
1317
|
+
price$.amountRaw.set("0");
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
}, [currencyDecimals, value, price$]);
|
|
1321
|
+
const handlePriceChange = (newValue) => {
|
|
1322
|
+
setValue(newValue);
|
|
1299
1323
|
try {
|
|
1300
|
-
const parsedAmount = parseUnits(
|
|
1301
|
-
|
|
1302
|
-
if (onPriceChange &&
|
|
1324
|
+
const parsedAmount = parseUnits(newValue, Number(currencyDecimals));
|
|
1325
|
+
price$.amountRaw.set(parsedAmount.toString());
|
|
1326
|
+
if (onPriceChange && parsedAmount !== 0n) {
|
|
1303
1327
|
onPriceChange();
|
|
1304
1328
|
}
|
|
1305
1329
|
} catch {
|
|
1306
|
-
|
|
1330
|
+
price$.amountRaw.set("0");
|
|
1307
1331
|
}
|
|
1308
1332
|
};
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1333
|
+
return {
|
|
1334
|
+
value,
|
|
1335
|
+
handlePriceChange
|
|
1336
|
+
};
|
|
1337
|
+
};
|
|
1338
|
+
|
|
1339
|
+
// src/react/ui/modals/_internal/components/priceInput/hooks/useBalanceCheck.ts
|
|
1340
|
+
import { useState as useState6, useEffect as useEffect6 } from "react";
|
|
1341
|
+
var useBalanceCheck = ({
|
|
1342
|
+
checkBalance,
|
|
1343
|
+
price$,
|
|
1344
|
+
currencyAddress,
|
|
1345
|
+
chainId,
|
|
1346
|
+
userAddress,
|
|
1347
|
+
currencyDecimals
|
|
1348
|
+
}) => {
|
|
1349
|
+
const [balanceError, setBalanceError] = useState6("");
|
|
1350
|
+
const { data: balance, isSuccess: isBalanceSuccess } = useCurrencyBalance({
|
|
1351
|
+
currencyAddress,
|
|
1352
|
+
chainId,
|
|
1353
|
+
userAddress
|
|
1354
|
+
});
|
|
1355
|
+
useEffect6(() => {
|
|
1356
|
+
if (!checkBalance?.enabled) {
|
|
1357
|
+
setBalanceError("");
|
|
1358
|
+
return;
|
|
1359
|
+
}
|
|
1360
|
+
const priceAmountRaw = price$.amountRaw.get() || "0";
|
|
1361
|
+
const hasInsufficientBalance = isBalanceSuccess && priceAmountRaw && currencyDecimals && BigInt(priceAmountRaw) > (balance?.value || 0n);
|
|
1312
1362
|
if (hasInsufficientBalance) {
|
|
1313
1363
|
setBalanceError("Insufficient balance");
|
|
1314
1364
|
checkBalance.callback(true);
|
|
@@ -1316,13 +1366,66 @@ var PriceInput = observer6(function PriceInput2({
|
|
|
1316
1366
|
setBalanceError("");
|
|
1317
1367
|
checkBalance.callback(false);
|
|
1318
1368
|
}
|
|
1369
|
+
}, [
|
|
1370
|
+
price$.amountRaw.get(),
|
|
1371
|
+
currencyAddress,
|
|
1372
|
+
balance?.value,
|
|
1373
|
+
isBalanceSuccess,
|
|
1374
|
+
checkBalance,
|
|
1375
|
+
currencyDecimals
|
|
1376
|
+
]);
|
|
1377
|
+
return {
|
|
1378
|
+
balanceError
|
|
1319
1379
|
};
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1380
|
+
};
|
|
1381
|
+
|
|
1382
|
+
// src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
1383
|
+
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1384
|
+
var PriceInput = observer6(function PriceInput2({
|
|
1385
|
+
chainId,
|
|
1386
|
+
collectionAddress,
|
|
1387
|
+
$price,
|
|
1388
|
+
onPriceChange,
|
|
1389
|
+
checkBalance,
|
|
1390
|
+
secondCurrencyAsDefault
|
|
1391
|
+
}) {
|
|
1392
|
+
const { address: accountAddress } = useAccount2();
|
|
1393
|
+
const currencyDecimals = $price.currency.decimals.get() || 18;
|
|
1394
|
+
const currencyAddress = $price.currency.contractAddress.get();
|
|
1395
|
+
const { value, handlePriceChange } = usePriceInput({
|
|
1396
|
+
price$: $price,
|
|
1397
|
+
currencyDecimals,
|
|
1398
|
+
onPriceChange
|
|
1399
|
+
});
|
|
1400
|
+
const { balanceError } = useBalanceCheck({
|
|
1401
|
+
checkBalance,
|
|
1402
|
+
price$: $price,
|
|
1403
|
+
currencyAddress,
|
|
1404
|
+
chainId: Number(chainId),
|
|
1405
|
+
userAddress: accountAddress,
|
|
1406
|
+
currencyDecimals
|
|
1407
|
+
});
|
|
1408
|
+
const renderBalanceError = useMemo(() => {
|
|
1409
|
+
if (!balanceError) return null;
|
|
1410
|
+
return /* @__PURE__ */ jsx14(
|
|
1411
|
+
Text8,
|
|
1412
|
+
{
|
|
1413
|
+
color: "negative",
|
|
1414
|
+
fontSize: "xsmall",
|
|
1415
|
+
fontFamily: "body",
|
|
1416
|
+
fontWeight: "semibold",
|
|
1417
|
+
position: "absolute",
|
|
1418
|
+
style: { bottom: "-13px" },
|
|
1419
|
+
children: balanceError
|
|
1420
|
+
}
|
|
1421
|
+
);
|
|
1422
|
+
}, [balanceError]);
|
|
1423
|
+
const handleChange = useCallback(
|
|
1424
|
+
(event) => {
|
|
1425
|
+
handlePriceChange(event.target.value);
|
|
1426
|
+
},
|
|
1427
|
+
[handlePriceChange]
|
|
1428
|
+
);
|
|
1326
1429
|
return /* @__PURE__ */ jsxs7(Box9, { className: priceInputWrapper, position: "relative", children: [
|
|
1327
1430
|
/* @__PURE__ */ jsx14(
|
|
1328
1431
|
Box9,
|
|
@@ -1332,41 +1435,31 @@ var PriceInput = observer6(function PriceInput2({
|
|
|
1332
1435
|
left: "2",
|
|
1333
1436
|
display: "flex",
|
|
1334
1437
|
alignItems: "center",
|
|
1335
|
-
children: /* @__PURE__ */ jsx14(currencyImage_default, { $
|
|
1438
|
+
children: /* @__PURE__ */ jsx14(currencyImage_default, { price$: $price })
|
|
1336
1439
|
}
|
|
1337
1440
|
),
|
|
1338
1441
|
/* @__PURE__ */ jsx14(
|
|
1339
1442
|
NumericInput,
|
|
1340
1443
|
{
|
|
1341
|
-
name: "
|
|
1444
|
+
name: "price-input",
|
|
1342
1445
|
decimals: currencyDecimals,
|
|
1343
1446
|
label: "Enter price",
|
|
1344
1447
|
labelLocation: "top",
|
|
1345
1448
|
controls: /* @__PURE__ */ jsx14(
|
|
1346
1449
|
currencyOptionsSelect_default,
|
|
1347
1450
|
{
|
|
1348
|
-
selectedCurrency$: $
|
|
1451
|
+
selectedCurrency$: $price.currency,
|
|
1349
1452
|
collectionAddress,
|
|
1350
|
-
chainId
|
|
1453
|
+
chainId,
|
|
1454
|
+
secondCurrencyAsDefault
|
|
1351
1455
|
}
|
|
1352
1456
|
),
|
|
1353
1457
|
value,
|
|
1354
|
-
onChange:
|
|
1458
|
+
onChange: handleChange,
|
|
1355
1459
|
width: "full"
|
|
1356
1460
|
}
|
|
1357
1461
|
),
|
|
1358
|
-
|
|
1359
|
-
Text8,
|
|
1360
|
-
{
|
|
1361
|
-
color: "negative",
|
|
1362
|
-
fontSize: "xsmall",
|
|
1363
|
-
fontFamily: "body",
|
|
1364
|
-
fontWeight: "semibold",
|
|
1365
|
-
position: "absolute",
|
|
1366
|
-
style: { bottom: "-13px" },
|
|
1367
|
-
children: balanceError
|
|
1368
|
-
}
|
|
1369
|
-
)
|
|
1462
|
+
renderBalanceError
|
|
1370
1463
|
] });
|
|
1371
1464
|
});
|
|
1372
1465
|
var priceInput_default = PriceInput;
|
|
@@ -1595,6 +1688,7 @@ var makeOfferModal$ = observable3({
|
|
|
1595
1688
|
});
|
|
1596
1689
|
|
|
1597
1690
|
// src/react/ui/modals/MakeOfferModal/Modal.tsx
|
|
1691
|
+
import { Box as Box12 } from "@0xsequence/design-system";
|
|
1598
1692
|
import { Fragment, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1599
1693
|
var MakeOfferModal = () => {
|
|
1600
1694
|
return /* @__PURE__ */ jsx17(Show, { if: makeOfferModal$.isOpen, children: () => /* @__PURE__ */ jsx17(Modal2, {}) });
|
|
@@ -1612,7 +1706,7 @@ var Modal2 = observer7(() => {
|
|
|
1612
1706
|
callbacks
|
|
1613
1707
|
} = state;
|
|
1614
1708
|
const steps$ = makeOfferModal$.steps;
|
|
1615
|
-
const [insufficientBalance, setInsufficientBalance] =
|
|
1709
|
+
const [insufficientBalance, setInsufficientBalance] = useState7(false);
|
|
1616
1710
|
const {
|
|
1617
1711
|
data: collectible,
|
|
1618
1712
|
isLoading: collectableIsLoading,
|
|
@@ -1630,6 +1724,16 @@ var Modal2 = observer7(() => {
|
|
|
1630
1724
|
chainId,
|
|
1631
1725
|
collectionAddress
|
|
1632
1726
|
});
|
|
1727
|
+
const currencyOptions = useCurrencyOptions({ collectionAddress });
|
|
1728
|
+
const {
|
|
1729
|
+
data: currencies,
|
|
1730
|
+
isLoading: currenciesLoading,
|
|
1731
|
+
isError: currenciesIsError
|
|
1732
|
+
} = useCurrencies({
|
|
1733
|
+
chainId,
|
|
1734
|
+
currencyOptions
|
|
1735
|
+
});
|
|
1736
|
+
const selectedCurrency = use$(makeOfferModal$.offerPrice.currency);
|
|
1633
1737
|
const { isLoading, executeApproval, makeOffer } = useMakeOffer({
|
|
1634
1738
|
offerInput: {
|
|
1635
1739
|
contractType: collection?.type,
|
|
@@ -1651,7 +1755,7 @@ var Modal2 = observer7(() => {
|
|
|
1651
1755
|
closeMainModal: () => makeOfferModal$.close(),
|
|
1652
1756
|
steps$
|
|
1653
1757
|
});
|
|
1654
|
-
if (collectableIsLoading || collectionIsLoading) {
|
|
1758
|
+
if (collectableIsLoading || collectionIsLoading || currenciesLoading) {
|
|
1655
1759
|
return /* @__PURE__ */ jsx17(
|
|
1656
1760
|
LoadingModal,
|
|
1657
1761
|
{
|
|
@@ -1662,7 +1766,7 @@ var Modal2 = observer7(() => {
|
|
|
1662
1766
|
}
|
|
1663
1767
|
);
|
|
1664
1768
|
}
|
|
1665
|
-
if (collectableIsError || collectionIsError) {
|
|
1769
|
+
if (collectableIsError || collectionIsError || currenciesIsError) {
|
|
1666
1770
|
return /* @__PURE__ */ jsx17(
|
|
1667
1771
|
ErrorModal,
|
|
1668
1772
|
{
|
|
@@ -1673,6 +1777,7 @@ var Modal2 = observer7(() => {
|
|
|
1673
1777
|
}
|
|
1674
1778
|
);
|
|
1675
1779
|
}
|
|
1780
|
+
const invalidCurrency = selectedCurrency?.contractAddress === zeroAddress && orderbookKind !== "sequence_marketplace_v2" /* sequence_marketplace_v2 */;
|
|
1676
1781
|
const ctas = [
|
|
1677
1782
|
{
|
|
1678
1783
|
label: "Approve TOKEN",
|
|
@@ -1686,9 +1791,10 @@ var Modal2 = observer7(() => {
|
|
|
1686
1791
|
label: "Make offer",
|
|
1687
1792
|
onClick: () => makeOffer(),
|
|
1688
1793
|
pending: steps$.transaction.isExecuting.get(),
|
|
1689
|
-
disabled: steps$.approval.isExecuting.get() || steps$.approval.exist.get() || offerPrice.amountRaw === "0" || insufficientBalance || isLoading || invalidQuantity ||
|
|
1794
|
+
disabled: steps$.approval.isExecuting.get() || steps$.approval.exist.get() || offerPrice.amountRaw === "0" || insufficientBalance || isLoading || invalidQuantity || invalidCurrency
|
|
1690
1795
|
}
|
|
1691
1796
|
];
|
|
1797
|
+
const secondCurrencyAsDefault = orderbookKind !== "sequence_marketplace_v2" /* sequence_marketplace_v2 */ && currencies && currencies[0]?.contractAddress === zeroAddress;
|
|
1692
1798
|
return /* @__PURE__ */ jsx17(Fragment, { children: /* @__PURE__ */ jsxs10(
|
|
1693
1799
|
ActionModal,
|
|
1694
1800
|
{
|
|
@@ -1712,8 +1818,9 @@ var Modal2 = observer7(() => {
|
|
|
1712
1818
|
{
|
|
1713
1819
|
chainId,
|
|
1714
1820
|
collectionAddress,
|
|
1715
|
-
$
|
|
1821
|
+
$price: makeOfferModal$.offerPrice,
|
|
1716
1822
|
onPriceChange: () => makeOfferModal$.offerPriceChanged.set(true),
|
|
1823
|
+
secondCurrencyAsDefault,
|
|
1717
1824
|
checkBalance: {
|
|
1718
1825
|
enabled: true,
|
|
1719
1826
|
callback: (state2) => setInsufficientBalance(state2)
|
|
@@ -1738,7 +1845,8 @@ var Modal2 = observer7(() => {
|
|
|
1738
1845
|
price: offerPrice
|
|
1739
1846
|
}
|
|
1740
1847
|
),
|
|
1741
|
-
/* @__PURE__ */ jsx17(expirationDateSelect_default, { $date: makeOfferModal$.expiry })
|
|
1848
|
+
/* @__PURE__ */ jsx17(expirationDateSelect_default, { $date: makeOfferModal$.expiry }),
|
|
1849
|
+
invalidCurrency && /* @__PURE__ */ jsx17(Box12, { color: "negative", fontSize: "small", children: "Native currency offers are not supported on this marketplace. Please select another currency to continue" })
|
|
1742
1850
|
]
|
|
1743
1851
|
}
|
|
1744
1852
|
) });
|
|
@@ -1749,7 +1857,7 @@ import { Show as Show2, observer as observer8 } from "@legendapp/state/react";
|
|
|
1749
1857
|
import { parseUnits as parseUnits3 } from "viem";
|
|
1750
1858
|
|
|
1751
1859
|
// src/react/ui/modals/_internal/components/transactionDetails/index.tsx
|
|
1752
|
-
import { Box as
|
|
1860
|
+
import { Box as Box13, Image as Image3, Skeleton as Skeleton6, Text as Text10 } from "@0xsequence/design-system";
|
|
1753
1861
|
import { formatUnits as formatUnits2 } from "viem";
|
|
1754
1862
|
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1755
1863
|
var DEFAULT_MARKETPLACE_FEE_PERCENTAGE = 2.5;
|
|
@@ -1779,7 +1887,7 @@ function TransactionDetails({
|
|
|
1779
1887
|
formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * marketplaceFeePercentage / 100).toFixed(price.currency.decimals);
|
|
1780
1888
|
}
|
|
1781
1889
|
return /* @__PURE__ */ jsxs11(
|
|
1782
|
-
|
|
1890
|
+
Box13,
|
|
1783
1891
|
{
|
|
1784
1892
|
width: "full",
|
|
1785
1893
|
display: "flex",
|
|
@@ -1787,7 +1895,7 @@ function TransactionDetails({
|
|
|
1787
1895
|
alignItems: "center",
|
|
1788
1896
|
children: [
|
|
1789
1897
|
/* @__PURE__ */ jsx18(Text10, { fontSize: "small", color: "text50", fontFamily: "body", children: "Total earnings" }),
|
|
1790
|
-
/* @__PURE__ */ jsxs11(
|
|
1898
|
+
/* @__PURE__ */ jsxs11(Box13, { display: "flex", alignItems: "center", gap: "2", children: [
|
|
1791
1899
|
/* @__PURE__ */ jsx18(Image3, { src: currencyImageUrl, width: "3", height: "3" }),
|
|
1792
1900
|
priceLoading ? /* @__PURE__ */ jsx18(Skeleton6, { width: "16", height: "4" }) : /* @__PURE__ */ jsxs11(Text10, { fontSize: "small", color: "text100", fontFamily: "body", children: [
|
|
1793
1901
|
showPlaceholderPrice ? "0" : formattedAmount,
|
|
@@ -1801,7 +1909,7 @@ function TransactionDetails({
|
|
|
1801
1909
|
}
|
|
1802
1910
|
|
|
1803
1911
|
// src/react/ui/modals/_internal/components/transactionHeader/index.tsx
|
|
1804
|
-
import { Box as
|
|
1912
|
+
import { Box as Box14, Image as Image4, Skeleton as Skeleton7, Text as Text11 } from "@0xsequence/design-system";
|
|
1805
1913
|
import { formatDistanceToNow as formatDistanceToNow2 } from "date-fns";
|
|
1806
1914
|
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1807
1915
|
function TransactionHeader({
|
|
@@ -1809,7 +1917,7 @@ function TransactionHeader({
|
|
|
1809
1917
|
currencyImageUrl,
|
|
1810
1918
|
date
|
|
1811
1919
|
}) {
|
|
1812
|
-
return /* @__PURE__ */ jsxs12(
|
|
1920
|
+
return /* @__PURE__ */ jsxs12(Box14, { display: "flex", alignItems: "center", width: "full", children: [
|
|
1813
1921
|
/* @__PURE__ */ jsx19(
|
|
1814
1922
|
Text11,
|
|
1815
1923
|
{
|
|
@@ -1976,8 +2084,6 @@ var useTransactionSteps2 = ({
|
|
|
1976
2084
|
if (!steps) return;
|
|
1977
2085
|
}
|
|
1978
2086
|
});
|
|
1979
|
-
console.log("amount", amount);
|
|
1980
|
-
console.log("receiver", receiver);
|
|
1981
2087
|
const getSellSteps = async () => {
|
|
1982
2088
|
if (!wallet) return;
|
|
1983
2089
|
try {
|
|
@@ -2030,11 +2136,10 @@ var useTransactionSteps2 = ({
|
|
|
2030
2136
|
if (!wallet) return;
|
|
2031
2137
|
try {
|
|
2032
2138
|
steps$.transaction.isExecuting.set(true);
|
|
2033
|
-
const
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
(steps) => steps?.find((step) => step.id === "signEIP712" /* signEIP712 */)
|
|
2139
|
+
const steps = await getSellSteps();
|
|
2140
|
+
const transactionStep = steps?.find((step) => step.id === "sell" /* sell */);
|
|
2141
|
+
const signatureStep = steps?.find(
|
|
2142
|
+
(step) => step.id === "signEIP712" /* signEIP712 */
|
|
2038
2143
|
);
|
|
2039
2144
|
console.debug("transactionStep", transactionStep);
|
|
2040
2145
|
console.debug("signatureStep", signatureStep);
|
|
@@ -2058,9 +2163,27 @@ var useTransactionSteps2 = ({
|
|
|
2058
2163
|
orderId,
|
|
2059
2164
|
callbacks
|
|
2060
2165
|
});
|
|
2061
|
-
|
|
2166
|
+
if (hash) {
|
|
2167
|
+
await waitForReceipt(hash);
|
|
2168
|
+
steps$.transaction.isExecuting.set(false);
|
|
2169
|
+
steps$.transaction.exist.set(false);
|
|
2170
|
+
if (callbacks?.onSuccess && typeof callbacks.onSuccess === "function") {
|
|
2171
|
+
callbacks.onSuccess({ hash });
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
if (orderId) {
|
|
2175
|
+
steps$.transaction.isExecuting.set(false);
|
|
2176
|
+
steps$.transaction.exist.set(false);
|
|
2177
|
+
if (callbacks?.onSuccess && typeof callbacks.onSuccess === "function") {
|
|
2178
|
+
callbacks.onSuccess({ orderId });
|
|
2179
|
+
}
|
|
2180
|
+
}
|
|
2062
2181
|
} catch (error) {
|
|
2063
2182
|
steps$.transaction.isExecuting.set(false);
|
|
2183
|
+
steps$.transaction.exist.set(false);
|
|
2184
|
+
if (callbacks?.onError && typeof callbacks.onError === "function") {
|
|
2185
|
+
callbacks.onError(error);
|
|
2186
|
+
}
|
|
2064
2187
|
throw error;
|
|
2065
2188
|
}
|
|
2066
2189
|
};
|
|
@@ -2096,7 +2219,7 @@ var useTransactionSteps2 = ({
|
|
|
2096
2219
|
};
|
|
2097
2220
|
|
|
2098
2221
|
// src/react/ui/modals/SellModal/hooks/useSell.tsx
|
|
2099
|
-
import { useEffect as
|
|
2222
|
+
import { useEffect as useEffect7 } from "react";
|
|
2100
2223
|
var useSell = ({
|
|
2101
2224
|
collectibleId,
|
|
2102
2225
|
chainId,
|
|
@@ -2113,7 +2236,7 @@ var useSell = ({
|
|
|
2113
2236
|
ordersData,
|
|
2114
2237
|
marketplace
|
|
2115
2238
|
});
|
|
2116
|
-
|
|
2239
|
+
useEffect7(() => {
|
|
2117
2240
|
if (tokenApproval?.step && !tokenApprovalIsLoading) {
|
|
2118
2241
|
steps$.approval.exist.set(true);
|
|
2119
2242
|
}
|
|
@@ -2267,7 +2390,7 @@ var Modal3 = observer8(() => {
|
|
|
2267
2390
|
|
|
2268
2391
|
// src/react/ui/modals/SuccessfulPurchaseModal/index.tsx
|
|
2269
2392
|
import {
|
|
2270
|
-
Box as
|
|
2393
|
+
Box as Box15,
|
|
2271
2394
|
Button as Button3,
|
|
2272
2395
|
CloseIcon as CloseIcon2,
|
|
2273
2396
|
ExternalLinkIcon,
|
|
@@ -2332,7 +2455,7 @@ var SuccessfulPurchaseModal = observer9(() => {
|
|
|
2332
2455
|
return /* @__PURE__ */ jsx21(Root3, { open: successfulPurchaseModal$.isOpen.get(), children: /* @__PURE__ */ jsxs14(Portal3, { children: [
|
|
2333
2456
|
/* @__PURE__ */ jsx21(Overlay2, { className: dialogOverlay }),
|
|
2334
2457
|
/* @__PURE__ */ jsxs14(Content3, { className: dialogContent.narrow, children: [
|
|
2335
|
-
/* @__PURE__ */ jsxs14(
|
|
2458
|
+
/* @__PURE__ */ jsxs14(Box15, { display: "flex", flexDirection: "column", gap: "4", width: "full", children: [
|
|
2336
2459
|
/* @__PURE__ */ jsx21(
|
|
2337
2460
|
Text12,
|
|
2338
2461
|
{
|
|
@@ -2349,7 +2472,7 @@ var SuccessfulPurchaseModal = observer9(() => {
|
|
|
2349
2472
|
collectibles: successfulPurchaseModal$.state.get().collectibles
|
|
2350
2473
|
}
|
|
2351
2474
|
),
|
|
2352
|
-
/* @__PURE__ */ jsxs14(
|
|
2475
|
+
/* @__PURE__ */ jsxs14(Box15, { display: "flex", alignItems: "center", gap: "1", children: [
|
|
2353
2476
|
/* @__PURE__ */ jsx21(Text12, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "You bought" }),
|
|
2354
2477
|
/* @__PURE__ */ jsx21(Text12, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().collectibles.length }),
|
|
2355
2478
|
/* @__PURE__ */ jsx21(Text12, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "items for" }),
|
|
@@ -2372,7 +2495,7 @@ var SuccessfulPurchaseModal = observer9(() => {
|
|
|
2372
2495
|
] }) });
|
|
2373
2496
|
});
|
|
2374
2497
|
function SuccessfulPurchaseActions() {
|
|
2375
|
-
return /* @__PURE__ */ jsxs14(
|
|
2498
|
+
return /* @__PURE__ */ jsxs14(Box15, { display: "flex", flexDirection: "column", gap: "2", children: [
|
|
2376
2499
|
successfulPurchaseModal$.state.ctaOptions.get() && /* @__PURE__ */ jsx21(
|
|
2377
2500
|
Button3,
|
|
2378
2501
|
{
|
|
@@ -2401,10 +2524,10 @@ function SuccessfulPurchaseActions() {
|
|
|
2401
2524
|
function CollectiblesGrid({ collectibles }) {
|
|
2402
2525
|
const total = collectibles.length;
|
|
2403
2526
|
const shownCollectibles = total > 4 ? collectibles.slice(0, 4) : collectibles;
|
|
2404
|
-
return /* @__PURE__ */ jsx21(
|
|
2527
|
+
return /* @__PURE__ */ jsx21(Box15, { className: collectiblesGrid, display: "grid", gap: "2", children: shownCollectibles.map((collectible) => {
|
|
2405
2528
|
const showPlus = total > 4 && collectibles.indexOf(collectible) === 3;
|
|
2406
2529
|
return /* @__PURE__ */ jsxs14(
|
|
2407
|
-
|
|
2530
|
+
Box15,
|
|
2408
2531
|
{
|
|
2409
2532
|
className: collectiblesGridItem,
|
|
2410
2533
|
position: "relative",
|
|
@@ -2421,7 +2544,7 @@ function CollectiblesGrid({ collectibles }) {
|
|
|
2421
2544
|
}
|
|
2422
2545
|
),
|
|
2423
2546
|
showPlus && /* @__PURE__ */ jsx21(
|
|
2424
|
-
|
|
2547
|
+
Box15,
|
|
2425
2548
|
{
|
|
2426
2549
|
position: "absolute",
|
|
2427
2550
|
top: "0",
|
|
@@ -2506,7 +2629,7 @@ var initialState5 = {
|
|
|
2506
2629
|
var transferModal$ = observable6(initialState5);
|
|
2507
2630
|
|
|
2508
2631
|
// src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
|
|
2509
|
-
import { Box as
|
|
2632
|
+
import { Box as Box16, Button as Button4, Text as Text13, TextInput } from "@0xsequence/design-system";
|
|
2510
2633
|
import { observable as observable7 } from "@legendapp/state";
|
|
2511
2634
|
import { isAddress } from "viem";
|
|
2512
2635
|
import { useAccount as useAccount3 } from "wagmi";
|
|
@@ -2625,9 +2748,9 @@ var EnterWalletAddressView = () => {
|
|
|
2625
2748
|
transfer();
|
|
2626
2749
|
transferModal$.view.set("followWalletInstructions");
|
|
2627
2750
|
}
|
|
2628
|
-
return /* @__PURE__ */ jsxs15(
|
|
2751
|
+
return /* @__PURE__ */ jsxs15(Box16, { display: "grid", gap: "6", flexGrow: "1", children: [
|
|
2629
2752
|
/* @__PURE__ */ jsx22(Text13, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
|
|
2630
|
-
/* @__PURE__ */ jsxs15(
|
|
2753
|
+
/* @__PURE__ */ jsxs15(Box16, { display: "flex", flexDirection: "column", gap: "3", children: [
|
|
2631
2754
|
/* @__PURE__ */ jsx22(
|
|
2632
2755
|
AlertMessage,
|
|
2633
2756
|
{
|
|
@@ -2687,13 +2810,13 @@ var EnterWalletAddressView = () => {
|
|
|
2687
2810
|
var enterWalletAddress_default = EnterWalletAddressView;
|
|
2688
2811
|
|
|
2689
2812
|
// src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx
|
|
2690
|
-
import { Box as
|
|
2813
|
+
import { Box as Box17, Button as Button5, Text as Text14 } from "@0xsequence/design-system";
|
|
2691
2814
|
import { observer as observer10 } from "@legendapp/state/react";
|
|
2692
2815
|
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2693
2816
|
var FollowWalletInstructionsView = observer10(() => {
|
|
2694
|
-
return /* @__PURE__ */ jsxs16(
|
|
2817
|
+
return /* @__PURE__ */ jsxs16(Box17, { display: "grid", gap: "6", flexGrow: "1", children: [
|
|
2695
2818
|
/* @__PURE__ */ jsx23(Text14, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
|
|
2696
|
-
/* @__PURE__ */ jsx23(
|
|
2819
|
+
/* @__PURE__ */ jsx23(Box17, { display: "flex", flexDirection: "column", gap: "3", children: /* @__PURE__ */ jsx23(
|
|
2697
2820
|
AlertMessage,
|
|
2698
2821
|
{
|
|
2699
2822
|
message: getMessage("followWalletInstructions"),
|
|
@@ -2781,7 +2904,7 @@ var TransactionModalView = observer11(() => {
|
|
|
2781
2904
|
});
|
|
2782
2905
|
|
|
2783
2906
|
// src/react/ui/modals/CreateListingModal/Modal.tsx
|
|
2784
|
-
import { Box as
|
|
2907
|
+
import { Box as Box18 } from "@0xsequence/design-system";
|
|
2785
2908
|
import { Show as Show4, observer as observer12 } from "@legendapp/state/react";
|
|
2786
2909
|
import { parseUnits as parseUnits4 } from "viem";
|
|
2787
2910
|
import { useAccount as useAccount5 } from "wagmi";
|
|
@@ -2838,7 +2961,7 @@ var createListingModal$ = observable8({
|
|
|
2838
2961
|
});
|
|
2839
2962
|
|
|
2840
2963
|
// src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx
|
|
2841
|
-
import { useEffect as
|
|
2964
|
+
import { useEffect as useEffect8 } from "react";
|
|
2842
2965
|
|
|
2843
2966
|
// src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts
|
|
2844
2967
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
@@ -2987,9 +3110,27 @@ var useTransactionSteps3 = ({
|
|
|
2987
3110
|
orderId,
|
|
2988
3111
|
callbacks
|
|
2989
3112
|
});
|
|
2990
|
-
|
|
3113
|
+
if (hash) {
|
|
3114
|
+
await waitForReceipt(hash);
|
|
3115
|
+
steps$.transaction.isExecuting.set(false);
|
|
3116
|
+
steps$.transaction.exist.set(false);
|
|
3117
|
+
if (callbacks?.onSuccess && typeof callbacks.onSuccess === "function") {
|
|
3118
|
+
callbacks.onSuccess({ hash });
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
if (orderId) {
|
|
3122
|
+
steps$.transaction.isExecuting.set(false);
|
|
3123
|
+
steps$.transaction.exist.set(false);
|
|
3124
|
+
if (callbacks?.onSuccess && typeof callbacks.onSuccess === "function") {
|
|
3125
|
+
callbacks.onSuccess({ orderId });
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
2991
3128
|
} catch (error) {
|
|
2992
3129
|
steps$.transaction.isExecuting.set(false);
|
|
3130
|
+
steps$.transaction.exist.set(false);
|
|
3131
|
+
if (callbacks?.onError && typeof callbacks.onError === "function") {
|
|
3132
|
+
callbacks.onError(error);
|
|
3133
|
+
}
|
|
2993
3134
|
throw error;
|
|
2994
3135
|
}
|
|
2995
3136
|
};
|
|
@@ -3042,7 +3183,7 @@ var useCreateListing = ({
|
|
|
3042
3183
|
contractType: listingInput.contractType,
|
|
3043
3184
|
orderbook: orderbookKind
|
|
3044
3185
|
});
|
|
3045
|
-
|
|
3186
|
+
useEffect8(() => {
|
|
3046
3187
|
if (tokenApproval?.step && !tokenApprovalIsLoading) {
|
|
3047
3188
|
steps$.approval.exist.set(true);
|
|
3048
3189
|
}
|
|
@@ -3182,13 +3323,13 @@ var Modal5 = observer12(() => {
|
|
|
3182
3323
|
chainId
|
|
3183
3324
|
}
|
|
3184
3325
|
),
|
|
3185
|
-
/* @__PURE__ */ jsxs18(
|
|
3326
|
+
/* @__PURE__ */ jsxs18(Box18, { display: "flex", flexDirection: "column", width: "full", gap: "1", children: [
|
|
3186
3327
|
/* @__PURE__ */ jsx25(
|
|
3187
3328
|
priceInput_default,
|
|
3188
3329
|
{
|
|
3189
3330
|
chainId,
|
|
3190
3331
|
collectionAddress,
|
|
3191
|
-
$
|
|
3332
|
+
$price: createListingModal$.listingPrice
|
|
3192
3333
|
}
|
|
3193
3334
|
),
|
|
3194
3335
|
listingPrice.amountRaw !== "0" && /* @__PURE__ */ jsx25(
|
|
@@ -3227,7 +3368,7 @@ var Modal5 = observer12(() => {
|
|
|
3227
3368
|
});
|
|
3228
3369
|
|
|
3229
3370
|
// src/react/ui/modals/BuyModal/Modal.tsx
|
|
3230
|
-
import { use$ } from "@legendapp/state/react";
|
|
3371
|
+
import { use$ as use$2 } from "@legendapp/state/react";
|
|
3231
3372
|
|
|
3232
3373
|
// src/react/ui/modals/BuyModal/store.ts
|
|
3233
3374
|
import { observable as observable9 } from "@legendapp/state";
|
|
@@ -3261,10 +3402,10 @@ var initialState7 = {
|
|
|
3261
3402
|
var buyModal$ = observable9(initialState7);
|
|
3262
3403
|
|
|
3263
3404
|
// src/react/ui/modals/BuyModal/modals/CheckoutModal.tsx
|
|
3264
|
-
import { useEffect as
|
|
3405
|
+
import { useEffect as useEffect9 } from "react";
|
|
3265
3406
|
import { parseUnits as parseUnits5 } from "viem";
|
|
3266
3407
|
function CheckoutModal({ buy, collectable, order }) {
|
|
3267
|
-
|
|
3408
|
+
useEffect9(() => {
|
|
3268
3409
|
const executeBuy = () => {
|
|
3269
3410
|
buy({
|
|
3270
3411
|
orderId: order.orderId,
|
|
@@ -3279,7 +3420,7 @@ function CheckoutModal({ buy, collectable, order }) {
|
|
|
3279
3420
|
}
|
|
3280
3421
|
|
|
3281
3422
|
// src/react/ui/modals/BuyModal/modals/Modal1155.tsx
|
|
3282
|
-
import { Box as
|
|
3423
|
+
import { Box as Box19, Text as Text15, TokenImage as TokenImage2 } from "@0xsequence/design-system";
|
|
3283
3424
|
import { observer as observer13 } from "@legendapp/state/react";
|
|
3284
3425
|
import { formatUnits as formatUnits3, parseUnits as parseUnits6 } from "viem";
|
|
3285
3426
|
import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
@@ -3324,7 +3465,7 @@ var ERC1155QuantityModal = observer13(
|
|
|
3324
3465
|
}
|
|
3325
3466
|
}
|
|
3326
3467
|
],
|
|
3327
|
-
children: /* @__PURE__ */ jsxs19(
|
|
3468
|
+
children: /* @__PURE__ */ jsxs19(Box19, { display: "flex", flexDirection: "column", gap: "4", children: [
|
|
3328
3469
|
/* @__PURE__ */ jsx26(
|
|
3329
3470
|
QuantityInput,
|
|
3330
3471
|
{
|
|
@@ -3334,9 +3475,9 @@ var ERC1155QuantityModal = observer13(
|
|
|
3334
3475
|
maxQuantity: order.quantityRemaining
|
|
3335
3476
|
}
|
|
3336
3477
|
),
|
|
3337
|
-
/* @__PURE__ */ jsxs19(
|
|
3478
|
+
/* @__PURE__ */ jsxs19(Box19, { display: "flex", justifyContent: "space-between", children: [
|
|
3338
3479
|
/* @__PURE__ */ jsx26(Text15, { color: "text50", fontSize: "small", children: "Total Price" }),
|
|
3339
|
-
/* @__PURE__ */ jsxs19(
|
|
3480
|
+
/* @__PURE__ */ jsxs19(Box19, { display: "flex", alignItems: "center", gap: "2", children: [
|
|
3340
3481
|
/* @__PURE__ */ jsx26(TokenImage2, { src: currency?.imageUrl, size: "xs" }),
|
|
3341
3482
|
/* @__PURE__ */ jsx26(Text15, { color: "text100", fontSize: "small", fontWeight: "bold", children: formatUnits3(BigInt(totalPrice), currency?.decimals || 0) })
|
|
3342
3483
|
] })
|
|
@@ -3483,7 +3624,7 @@ var useBuyCollectable = ({
|
|
|
3483
3624
|
enableMainCurrencyPayment: true,
|
|
3484
3625
|
enableSwapPayments: !!input.checkoutOptions.swap,
|
|
3485
3626
|
creditCardProviders: input.checkoutOptions.nftCheckout || [],
|
|
3486
|
-
onSuccess: (hash) => callbacks?.onSuccess?.(hash),
|
|
3627
|
+
onSuccess: (hash) => callbacks?.onSuccess?.({ hash }),
|
|
3487
3628
|
onError: callbacks?.onError,
|
|
3488
3629
|
onClose: () => {
|
|
3489
3630
|
console.log("onClose");
|
|
@@ -3497,20 +3638,20 @@ var useBuyCollectable = ({
|
|
|
3497
3638
|
// src/react/ui/modals/BuyModal/Modal.tsx
|
|
3498
3639
|
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
3499
3640
|
var BuyModal = () => {
|
|
3500
|
-
const isOpen = use$(buyModal$.isOpen);
|
|
3641
|
+
const isOpen = use$2(buyModal$.isOpen);
|
|
3501
3642
|
if (!isOpen) return null;
|
|
3502
3643
|
return /* @__PURE__ */ jsx27(BuyModalContent, {});
|
|
3503
3644
|
};
|
|
3504
3645
|
var BuyModalContent = () => {
|
|
3505
|
-
const chainId = String(use$(buyModal$.state.order.chainId));
|
|
3506
|
-
const collectionAddress = use$(
|
|
3646
|
+
const chainId = String(use$2(buyModal$.state.order.chainId));
|
|
3647
|
+
const collectionAddress = use$2(
|
|
3507
3648
|
buyModal$.state.order.collectionContractAddress
|
|
3508
3649
|
);
|
|
3509
|
-
const collectibleId = use$(buyModal$.state.order.tokenId);
|
|
3510
|
-
const modalId = use$(buyModal$.state.modalId);
|
|
3511
|
-
const callbacks = use$(buyModal$.callbacks);
|
|
3512
|
-
const order = use$(buyModal$.state.order);
|
|
3513
|
-
const isOpen = use$(buyModal$.isOpen);
|
|
3650
|
+
const collectibleId = use$2(buyModal$.state.order.tokenId);
|
|
3651
|
+
const modalId = use$2(buyModal$.state.modalId);
|
|
3652
|
+
const callbacks = use$2(buyModal$.callbacks);
|
|
3653
|
+
const order = use$2(buyModal$.state.order);
|
|
3654
|
+
const isOpen = use$2(buyModal$.isOpen);
|
|
3514
3655
|
const { collection, collectable, checkoutOptions, isLoading, isError } = useLoadData({
|
|
3515
3656
|
chainId: Number(chainId),
|
|
3516
3657
|
collectionAddress,
|
|
@@ -3619,12 +3760,12 @@ var useBuyModal = (callbacks) => {
|
|
|
3619
3760
|
};
|
|
3620
3761
|
|
|
3621
3762
|
// src/react/ui/components/collectible-card/CollectibleCard.tsx
|
|
3622
|
-
import { useState as
|
|
3623
|
-
import { Box as
|
|
3763
|
+
import { useState as useState8 } from "react";
|
|
3764
|
+
import { Box as Box23, IconButton as IconButton6, Skeleton as Skeleton8 } from "@0xsequence/design-system";
|
|
3624
3765
|
import { useAccount as useAccount7 } from "wagmi";
|
|
3625
3766
|
|
|
3626
3767
|
// src/react/ui/icons/DiamondEye.tsx
|
|
3627
|
-
import { Box as
|
|
3768
|
+
import { Box as Box20 } from "@0xsequence/design-system";
|
|
3628
3769
|
import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3629
3770
|
var Svg = () => /* @__PURE__ */ jsxs21(
|
|
3630
3771
|
"svg",
|
|
@@ -3651,7 +3792,7 @@ var Svg = () => /* @__PURE__ */ jsxs21(
|
|
|
3651
3792
|
}
|
|
3652
3793
|
);
|
|
3653
3794
|
var SvgDiamondEyeIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx29(
|
|
3654
|
-
|
|
3795
|
+
Box20,
|
|
3655
3796
|
{
|
|
3656
3797
|
as: Svg,
|
|
3657
3798
|
className: iconVariants({
|
|
@@ -3776,12 +3917,12 @@ function ActionButtonBody({ label, onClick }) {
|
|
|
3776
3917
|
}
|
|
3777
3918
|
|
|
3778
3919
|
// src/react/ui/components/collectible-card/Footer.tsx
|
|
3779
|
-
import { Box as
|
|
3920
|
+
import { Box as Box22, IconButton as IconButton5, Image as Image6, Text as Text16 } from "@0xsequence/design-system";
|
|
3780
3921
|
import { formatUnits as formatUnits4 } from "viem";
|
|
3781
3922
|
import { useAccount as useAccount6 } from "wagmi";
|
|
3782
3923
|
|
|
3783
3924
|
// src/react/ui/icons/Bell.tsx
|
|
3784
|
-
import { Box as
|
|
3925
|
+
import { Box as Box21 } from "@0xsequence/design-system";
|
|
3785
3926
|
import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3786
3927
|
var Svg2 = () => /* @__PURE__ */ jsxs22(
|
|
3787
3928
|
"svg",
|
|
@@ -3808,7 +3949,7 @@ var Svg2 = () => /* @__PURE__ */ jsxs22(
|
|
|
3808
3949
|
}
|
|
3809
3950
|
);
|
|
3810
3951
|
var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx31(
|
|
3811
|
-
|
|
3952
|
+
Box21,
|
|
3812
3953
|
{
|
|
3813
3954
|
as: Svg2,
|
|
3814
3955
|
className: iconVariants({
|
|
@@ -3840,7 +3981,7 @@ var Footer = ({
|
|
|
3840
3981
|
name = `${name.substring(0, 17)}...`;
|
|
3841
3982
|
}
|
|
3842
3983
|
return /* @__PURE__ */ jsxs23(
|
|
3843
|
-
|
|
3984
|
+
Box22,
|
|
3844
3985
|
{
|
|
3845
3986
|
display: "flex",
|
|
3846
3987
|
flexDirection: "column",
|
|
@@ -3852,7 +3993,7 @@ var Footer = ({
|
|
|
3852
3993
|
className: !!address && isAnimated ? footer.animated : footer.static,
|
|
3853
3994
|
children: [
|
|
3854
3995
|
/* @__PURE__ */ jsxs23(
|
|
3855
|
-
|
|
3996
|
+
Box22,
|
|
3856
3997
|
{
|
|
3857
3998
|
display: "flex",
|
|
3858
3999
|
alignItems: "center",
|
|
@@ -3890,7 +4031,7 @@ var Footer = ({
|
|
|
3890
4031
|
]
|
|
3891
4032
|
}
|
|
3892
4033
|
),
|
|
3893
|
-
/* @__PURE__ */ jsxs23(
|
|
4034
|
+
/* @__PURE__ */ jsxs23(Box22, { display: "flex", alignItems: "center", gap: "1", children: [
|
|
3894
4035
|
listed && /* @__PURE__ */ jsx32(Image6, { src: lowestListingCurrency?.imageUrl, width: "3", height: "3" }),
|
|
3895
4036
|
/* @__PURE__ */ jsxs23(
|
|
3896
4037
|
Text16,
|
|
@@ -3940,7 +4081,7 @@ var TokenTypeBalancePill = ({
|
|
|
3940
4081
|
import { jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3941
4082
|
function CollectibleSkeleton() {
|
|
3942
4083
|
return /* @__PURE__ */ jsxs24(
|
|
3943
|
-
|
|
4084
|
+
Box23,
|
|
3944
4085
|
{
|
|
3945
4086
|
className: collectibleCard,
|
|
3946
4087
|
borderRadius: "md",
|
|
@@ -3955,7 +4096,7 @@ function CollectibleSkeleton() {
|
|
|
3955
4096
|
}
|
|
3956
4097
|
),
|
|
3957
4098
|
/* @__PURE__ */ jsxs24(
|
|
3958
|
-
|
|
4099
|
+
Box23,
|
|
3959
4100
|
{
|
|
3960
4101
|
display: "flex",
|
|
3961
4102
|
flexDirection: "column",
|
|
@@ -3987,7 +4128,7 @@ function CollectibleCard({
|
|
|
3987
4128
|
}) {
|
|
3988
4129
|
const { address: accountAddress } = useAccount7();
|
|
3989
4130
|
const collectibleMetadata = lowestListing?.metadata;
|
|
3990
|
-
const [imageLoadingError, setImageLoadingError] =
|
|
4131
|
+
const [imageLoadingError, setImageLoadingError] = useState8(false);
|
|
3991
4132
|
const { data: highestOffer, isLoading: highestOfferLoading } = useHighestOffer({
|
|
3992
4133
|
chainId: String(chainId),
|
|
3993
4134
|
collectionAddress,
|
|
@@ -4006,14 +4147,14 @@ function CollectibleCard({
|
|
|
4006
4147
|
const image = collectibleMetadata?.image;
|
|
4007
4148
|
const externalUrl = collectibleMetadata?.external_url;
|
|
4008
4149
|
return /* @__PURE__ */ jsx33(
|
|
4009
|
-
|
|
4150
|
+
Box23,
|
|
4010
4151
|
{
|
|
4011
4152
|
className: collectibleCard,
|
|
4012
4153
|
borderRadius: "md",
|
|
4013
4154
|
overflow: "hidden",
|
|
4014
4155
|
background: "backgroundPrimary",
|
|
4015
4156
|
children: /* @__PURE__ */ jsx33(
|
|
4016
|
-
|
|
4157
|
+
Box23,
|
|
4017
4158
|
{
|
|
4018
4159
|
display: "flex",
|
|
4019
4160
|
flexDirection: "column",
|
|
@@ -4069,7 +4210,7 @@ function CollectibleCard({
|
|
|
4069
4210
|
}
|
|
4070
4211
|
),
|
|
4071
4212
|
accountAddress && (highestOffer || lowestListing) && /* @__PURE__ */ jsx33(
|
|
4072
|
-
|
|
4213
|
+
Box23,
|
|
4073
4214
|
{
|
|
4074
4215
|
display: "flex",
|
|
4075
4216
|
alignItems: "center",
|
|
@@ -4108,4 +4249,4 @@ export {
|
|
|
4108
4249
|
useBuyModal,
|
|
4109
4250
|
CollectibleCard
|
|
4110
4251
|
};
|
|
4111
|
-
//# sourceMappingURL=chunk-
|
|
4252
|
+
//# sourceMappingURL=chunk-6XUCLBZC.js.map
|