@0xsequence/marketplace-sdk 0.8.3 → 0.8.5
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/CHANGELOG.md +16 -1
- package/dist/{chunk-25CAMYCG.js → chunk-BB2PTJHI.js} +22 -20
- package/dist/chunk-BB2PTJHI.js.map +1 -0
- package/dist/{chunk-5ATGT5S4.js → chunk-EZFCQZHU.js} +14 -6
- package/dist/chunk-EZFCQZHU.js.map +1 -0
- package/dist/{chunk-DFI52A2E.js → chunk-KCLMSSPS.js} +364 -242
- package/dist/chunk-KCLMSSPS.js.map +1 -0
- package/dist/{chunk-XUNDLCEH.js → chunk-LDZZUYG7.js} +2 -2
- package/dist/{chunk-QTV77W42.js → chunk-SFSFIGHM.js} +45 -35
- package/dist/chunk-SFSFIGHM.js.map +1 -0
- package/dist/{chunk-FSJKN4YN.js → chunk-ZSCZLHKX.js} +194 -2
- package/dist/chunk-ZSCZLHKX.js.map +1 -0
- package/dist/{chunk-FH4TZRDV.js → chunk-ZVTG6US2.js} +2 -2
- package/dist/index.css +4 -4
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{lowestListing-DUZ_nYml.d.ts → lowestListing-W7P4EkC3.d.ts} +34 -11
- package/dist/react/_internal/databeat/index.js +5 -5
- package/dist/react/_internal/index.d.ts +1 -1
- package/dist/react/_internal/index.js +3 -1
- package/dist/react/_internal/wagmi/index.d.ts +3 -2
- package/dist/react/_internal/wagmi/index.js +3 -1
- package/dist/react/hooks/index.d.ts +8 -5
- package/dist/react/hooks/index.js +6 -4
- package/dist/react/hooks/options/index.js +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +9 -7
- package/dist/react/queries/index.d.ts +1 -1
- package/dist/react/queries/index.js +6 -2
- package/dist/react/ssr/index.js +1 -1
- package/dist/react/ui/components/collectible-card/index.d.ts +3 -2
- package/dist/react/ui/components/collectible-card/index.js +7 -7
- package/dist/react/ui/icons/index.js +1 -1
- package/dist/react/ui/index.js +7 -7
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +5 -5
- package/dist/types/index.js +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +19 -19
- package/src/react/_internal/api/__mocks__/marketplace.msw.ts +35 -21
- package/src/react/_internal/wagmi/__tests__/create-config.test.ts +1 -11
- package/src/react/_internal/wagmi/get-connectors.ts +27 -24
- package/src/react/hooks/__tests__/useCancelTransactionSteps.test.tsx +4 -9
- package/src/react/hooks/__tests__/useGenerateCancelTransaction.test.tsx +5 -4
- package/src/react/hooks/__tests__/useGenerateListingTransaction.test.tsx +14 -10
- package/src/react/hooks/__tests__/useGenerateOfferTransaction.test.tsx +115 -65
- package/src/react/hooks/__tests__/useGenerateSellTransaction.test.tsx +10 -7
- package/src/react/hooks/__tests__/useInventory.test.tsx +294 -0
- package/src/react/hooks/index.ts +1 -0
- package/src/react/hooks/useAutoSelectFeeOption.tsx +10 -3
- package/src/react/hooks/useCancelOrder.tsx +1 -0
- package/src/react/hooks/useCancelTransactionSteps.tsx +18 -4
- package/src/react/hooks/useGenerateOfferTransaction.tsx +11 -1
- package/src/react/hooks/useInventory.tsx +15 -0
- package/src/react/hooks/util/optimisticCancelUpdates.ts +115 -0
- package/src/react/queries/index.ts +1 -0
- package/src/react/queries/inventory.ts +303 -0
- package/src/react/queries/listBalances.ts +1 -8
- package/src/react/queries/listCollectibles.ts +12 -3
- package/src/react/ui/components/_internals/action-button/__tests__/ActionButtonBody.test.tsx +27 -94
- package/src/react/ui/components/_internals/action-button/__tests__/NonOwnerActions.test.tsx +59 -0
- package/src/react/ui/components/_internals/action-button/__tests__/OwnerActions.test.tsx +73 -0
- package/src/react/ui/components/_internals/action-button/__tests__/useActionButtonLogic.test.tsx +77 -0
- package/src/react/ui/components/_internals/action-button/components/ActionButtonBody.tsx +3 -2
- package/src/react/ui/components/_internals/action-button/hooks/useActionButtonLogic.ts +4 -3
- package/src/react/ui/components/collectible-card/CollectibleAsset.tsx +1 -0
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +18 -12
- package/src/react/ui/components/collectible-card/__tests__/CollectibleAsset.test.tsx +200 -0
- package/src/react/ui/components/collectible-card/__tests__/CollectibleCard.test.tsx +92 -123
- package/src/react/ui/components/collectible-card/__tests__/Footer.test.tsx +136 -0
- package/src/react/ui/modals/BuyModal/__tests__/Modal.test.tsx +2 -8
- package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +74 -104
- package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +108 -78
- package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +72 -135
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.test.tsx +286 -0
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +16 -4
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/__tests__/index.test.tsx +35 -132
- package/src/react/ui/modals/_internal/components/floorPriceText/__tests__/FloorPriceText.test.tsx +199 -0
- package/src/react/ui/modals/_internal/components/priceInput/__tests__/PriceInput.test.tsx +55 -0
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/__tests__/ActionButtons.test.tsx +72 -0
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/__tests__/BalanceIndicator.test.tsx +50 -0
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/__tests__/SelectWaasFeeOptions.test.tsx +193 -0
- package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +2 -2
- package/test/const.ts +24 -0
- package/test/test-utils.tsx +85 -47
- package/.changeset/flat-parks-clean.md +0 -8
- package/.changeset/red-buckets-deny.md +0 -6
- package/.changeset/seven-doors-taste.md +0 -5
- package/dist/chunk-25CAMYCG.js.map +0 -1
- package/dist/chunk-5ATGT5S4.js.map +0 -1
- package/dist/chunk-DFI52A2E.js.map +0 -1
- package/dist/chunk-FSJKN4YN.js.map +0 -1
- package/dist/chunk-QTV77W42.js.map +0 -1
- package/src/react/ui/components/_internals/action-button/__tests__/ActionButton.test.tsx +0 -107
- package/src/react/ui/modals/_internal/components/priceInput/__tests__/index.test.tsx +0 -164
- /package/dist/{chunk-XUNDLCEH.js.map → chunk-LDZZUYG7.js.map} +0 -0
- /package/dist/{chunk-FH4TZRDV.js.map → chunk-ZVTG6US2.js.map} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
collectionOptions
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LDZZUYG7.js";
|
|
6
6
|
import {
|
|
7
7
|
InfoIcon_default
|
|
8
8
|
} from "./chunk-SJU6QZHM.js";
|
|
@@ -23,10 +23,11 @@ import {
|
|
|
23
23
|
import {
|
|
24
24
|
balanceOfCollectibleOptions,
|
|
25
25
|
highestOfferOptions,
|
|
26
|
+
inventoryOptions,
|
|
26
27
|
listBalancesOptions,
|
|
27
28
|
listCollectiblesOptions,
|
|
28
29
|
lowestListingOptions
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-ZSCZLHKX.js";
|
|
30
31
|
import {
|
|
31
32
|
marketplaceConfigOptions
|
|
32
33
|
} from "./chunk-HGKWWZWY.js";
|
|
@@ -35,7 +36,7 @@ import {
|
|
|
35
36
|
CollectableIdSchema,
|
|
36
37
|
PROVIDER_ID,
|
|
37
38
|
QueryArgSchema
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-BB2PTJHI.js";
|
|
39
40
|
import {
|
|
40
41
|
BaseError,
|
|
41
42
|
ChainSwitchError,
|
|
@@ -76,7 +77,7 @@ import {
|
|
|
76
77
|
// src/react/hooks/useAutoSelectFeeOption.tsx
|
|
77
78
|
import { zeroAddress } from "viem";
|
|
78
79
|
import { useChain } from "@0xsequence/connect";
|
|
79
|
-
import { useCallback } from "react";
|
|
80
|
+
import { useCallback, useEffect } from "react";
|
|
80
81
|
import { useAccount } from "wagmi";
|
|
81
82
|
|
|
82
83
|
// src/react/hooks/useCollectionBalanceDetails.tsx
|
|
@@ -194,7 +195,8 @@ var useCollectionBalanceDetails = (args) => {
|
|
|
194
195
|
|
|
195
196
|
// src/react/hooks/useAutoSelectFeeOption.tsx
|
|
196
197
|
function useAutoSelectFeeOption({
|
|
197
|
-
pendingFeeOptionConfirmation
|
|
198
|
+
pendingFeeOptionConfirmation,
|
|
199
|
+
enabled
|
|
198
200
|
}) {
|
|
199
201
|
const { address: userAddress } = useAccount();
|
|
200
202
|
const contractWhitelist = pendingFeeOptionConfirmation.options?.map(
|
|
@@ -212,7 +214,7 @@ function useAutoSelectFeeOption({
|
|
|
212
214
|
omitNativeBalances: false
|
|
213
215
|
},
|
|
214
216
|
query: {
|
|
215
|
-
enabled: !!pendingFeeOptionConfirmation.options && !!userAddress
|
|
217
|
+
enabled: !!pendingFeeOptionConfirmation.options && !!userAddress && enabled
|
|
216
218
|
}
|
|
217
219
|
});
|
|
218
220
|
const chain = useChain(pendingFeeOptionConfirmation.chainId);
|
|
@@ -230,7 +232,11 @@ function useAutoSelectFeeOption({
|
|
|
230
232
|
contractAddress: b.contractAddress
|
|
231
233
|
}))
|
|
232
234
|
];
|
|
233
|
-
|
|
235
|
+
useEffect(() => {
|
|
236
|
+
if (combinedBalances) {
|
|
237
|
+
console.debug("currency balances", combinedBalances);
|
|
238
|
+
}
|
|
239
|
+
}, [combinedBalances]);
|
|
234
240
|
const autoSelectedOption = useCallback(async () => {
|
|
235
241
|
if (!userAddress) {
|
|
236
242
|
return {
|
|
@@ -1233,8 +1239,19 @@ function useHighestOffer(args) {
|
|
|
1233
1239
|
return useQuery13(highestOfferOptions(args, config));
|
|
1234
1240
|
}
|
|
1235
1241
|
|
|
1236
|
-
// src/react/hooks/
|
|
1242
|
+
// src/react/hooks/useInventory.tsx
|
|
1237
1243
|
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
1244
|
+
function useInventory(args) {
|
|
1245
|
+
const config = useConfig();
|
|
1246
|
+
const marketplaceConfig = useMarketplaceConfig();
|
|
1247
|
+
const isLaos721 = marketplaceConfig.data?.collections.find(
|
|
1248
|
+
(c) => c.address === args.collectionAddress
|
|
1249
|
+
)?.isLAOSERC721 ?? false;
|
|
1250
|
+
return useInfiniteQuery(inventoryOptions({ ...args, isLaos721 }, config));
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
// src/react/hooks/useListBalances.tsx
|
|
1254
|
+
import { useInfiniteQuery as useInfiniteQuery2 } from "@tanstack/react-query";
|
|
1238
1255
|
function useListBalances(args) {
|
|
1239
1256
|
const config = useConfig();
|
|
1240
1257
|
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
@@ -1244,7 +1261,7 @@ function useListBalances(args) {
|
|
|
1244
1261
|
if (isLaos721) {
|
|
1245
1262
|
args.isLaos721 = true;
|
|
1246
1263
|
}
|
|
1247
|
-
return
|
|
1264
|
+
return useInfiniteQuery2(listBalancesOptions(args, config));
|
|
1248
1265
|
}
|
|
1249
1266
|
|
|
1250
1267
|
// src/react/hooks/useListCollectibleActivities.tsx
|
|
@@ -1277,7 +1294,7 @@ var useListCollectibleActivities = (args) => {
|
|
|
1277
1294
|
};
|
|
1278
1295
|
|
|
1279
1296
|
// src/react/hooks/useListCollectibles.tsx
|
|
1280
|
-
import { useInfiniteQuery as
|
|
1297
|
+
import { useInfiniteQuery as useInfiniteQuery3 } from "@tanstack/react-query";
|
|
1281
1298
|
function useListCollectibles(args) {
|
|
1282
1299
|
const config = useConfig();
|
|
1283
1300
|
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
@@ -1287,7 +1304,7 @@ function useListCollectibles(args) {
|
|
|
1287
1304
|
if (isLaos721) {
|
|
1288
1305
|
args.isLaos721 = true;
|
|
1289
1306
|
}
|
|
1290
|
-
return
|
|
1307
|
+
return useInfiniteQuery3(listCollectiblesOptions(args, config));
|
|
1291
1308
|
}
|
|
1292
1309
|
|
|
1293
1310
|
// src/react/hooks/useListCollectiblesPaginated.tsx
|
|
@@ -1554,229 +1571,11 @@ var useGenerateListingTransaction = (params) => {
|
|
|
1554
1571
|
|
|
1555
1572
|
// src/react/hooks/useGenerateOfferTransaction.tsx
|
|
1556
1573
|
import { useMutation as useMutation2 } from "@tanstack/react-query";
|
|
1557
|
-
var generateOfferTransaction = async (params, config, chainId) => {
|
|
1558
|
-
const args = {
|
|
1559
|
-
...params,
|
|
1560
|
-
offer: { ...params.offer, expiry: dateToUnixTime(params.offer.expiry) }
|
|
1561
|
-
};
|
|
1562
|
-
const marketplaceClient = getMarketplaceClient(chainId, config);
|
|
1563
|
-
return (await marketplaceClient.generateOfferTransaction(args)).steps;
|
|
1564
|
-
};
|
|
1565
|
-
var useGenerateOfferTransaction = (params) => {
|
|
1566
|
-
const config = useConfig();
|
|
1567
|
-
const { mutate, mutateAsync, ...result } = useMutation2({
|
|
1568
|
-
onSuccess: params.onSuccess,
|
|
1569
|
-
mutationFn: (args) => generateOfferTransaction(args, config, params.chainId)
|
|
1570
|
-
});
|
|
1571
|
-
return {
|
|
1572
|
-
...result,
|
|
1573
|
-
generateOfferTransaction: mutate,
|
|
1574
|
-
generateOfferTransactionAsync: mutateAsync
|
|
1575
|
-
};
|
|
1576
|
-
};
|
|
1577
|
-
|
|
1578
|
-
// src/react/hooks/useGenerateSellTransaction.tsx
|
|
1579
|
-
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
1580
|
-
import { z as z17 } from "zod";
|
|
1581
|
-
var UserGeneratSellTransactionArgsSchema = z17.object({
|
|
1582
|
-
chainId: z17.number(),
|
|
1583
|
-
onSuccess: z17.function().args(stepSchema.array().optional()).optional()
|
|
1584
|
-
});
|
|
1585
|
-
var generateSellTransaction = async (args, config, chainId) => {
|
|
1586
|
-
const marketplaceClient = getMarketplaceClient(chainId, config);
|
|
1587
|
-
return marketplaceClient.generateSellTransaction(args).then((data) => data.steps);
|
|
1588
|
-
};
|
|
1589
|
-
var useGenerateSellTransaction = (params) => {
|
|
1590
|
-
const config = useConfig();
|
|
1591
|
-
const { mutate, mutateAsync, ...result } = useMutation3({
|
|
1592
|
-
onSuccess: params.onSuccess,
|
|
1593
|
-
mutationFn: (args) => generateSellTransaction(args, config, params.chainId)
|
|
1594
|
-
});
|
|
1595
|
-
return {
|
|
1596
|
-
...result,
|
|
1597
|
-
generateSellTransaction: mutate,
|
|
1598
|
-
generateSellTransactionAsync: mutateAsync
|
|
1599
|
-
};
|
|
1600
|
-
};
|
|
1601
|
-
|
|
1602
|
-
// src/react/hooks/useGenerateCancelTransaction.tsx
|
|
1603
|
-
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
1604
|
-
import { z as z18 } from "zod";
|
|
1605
|
-
var UserGenerateCancelTransactionArgsSchema = z18.object({
|
|
1606
|
-
chainId: z18.number(),
|
|
1607
|
-
onSuccess: z18.function().args(stepSchema.array().optional()).optional()
|
|
1608
|
-
});
|
|
1609
|
-
var generateCancelTransaction = async (args, config, chainId) => {
|
|
1610
|
-
const marketplaceClient = getMarketplaceClient(chainId, config);
|
|
1611
|
-
return marketplaceClient.generateCancelTransaction(args).then((data) => data.steps);
|
|
1612
|
-
};
|
|
1613
|
-
var useGenerateCancelTransaction = (params) => {
|
|
1614
|
-
const config = useConfig();
|
|
1615
|
-
const { mutate, mutateAsync, ...result } = useMutation4({
|
|
1616
|
-
onSuccess: params.onSuccess,
|
|
1617
|
-
mutationFn: (args) => generateCancelTransaction(args, config, params.chainId)
|
|
1618
|
-
});
|
|
1619
|
-
return {
|
|
1620
|
-
...result,
|
|
1621
|
-
generateCancelTransaction: mutate,
|
|
1622
|
-
generateCancelTransactionAsync: mutateAsync
|
|
1623
|
-
};
|
|
1624
|
-
};
|
|
1625
|
-
|
|
1626
|
-
// src/react/hooks/useTransferTokens.tsx
|
|
1627
|
-
import { erc721Abi } from "viem";
|
|
1628
|
-
import { useAccount as useAccount2, useWriteContract } from "wagmi";
|
|
1629
|
-
var prepareTransferConfig = (params, accountAddress) => {
|
|
1630
|
-
if (params.contractType === "ERC721") {
|
|
1631
|
-
return {
|
|
1632
|
-
abi: erc721Abi,
|
|
1633
|
-
address: params.collectionAddress,
|
|
1634
|
-
functionName: "safeTransferFrom",
|
|
1635
|
-
args: [
|
|
1636
|
-
accountAddress,
|
|
1637
|
-
params.receiverAddress,
|
|
1638
|
-
BigInt(params.tokenId)
|
|
1639
|
-
]
|
|
1640
|
-
};
|
|
1641
|
-
}
|
|
1642
|
-
return {
|
|
1643
|
-
abi: ERC1155_ABI,
|
|
1644
|
-
address: params.collectionAddress,
|
|
1645
|
-
functionName: "safeTransferFrom",
|
|
1646
|
-
args: [
|
|
1647
|
-
accountAddress,
|
|
1648
|
-
params.receiverAddress,
|
|
1649
|
-
BigInt(params.tokenId),
|
|
1650
|
-
params.quantity,
|
|
1651
|
-
"0x"
|
|
1652
|
-
// data
|
|
1653
|
-
]
|
|
1654
|
-
};
|
|
1655
|
-
};
|
|
1656
|
-
var useTransferTokens = () => {
|
|
1657
|
-
const { address: accountAddress } = useAccount2();
|
|
1658
|
-
const {
|
|
1659
|
-
writeContractAsync,
|
|
1660
|
-
data: hash,
|
|
1661
|
-
isPending,
|
|
1662
|
-
isError,
|
|
1663
|
-
isSuccess
|
|
1664
|
-
} = useWriteContract();
|
|
1665
|
-
const transferTokensAsync = async (params) => {
|
|
1666
|
-
if (!accountAddress) {
|
|
1667
|
-
throw new NoWalletConnectedError();
|
|
1668
|
-
}
|
|
1669
|
-
const config = prepareTransferConfig(params, accountAddress);
|
|
1670
|
-
return await writeContractAsync(config);
|
|
1671
|
-
};
|
|
1672
|
-
return {
|
|
1673
|
-
transferTokensAsync,
|
|
1674
|
-
hash,
|
|
1675
|
-
transferring: isPending,
|
|
1676
|
-
transferFailed: isError,
|
|
1677
|
-
transferSuccess: isSuccess
|
|
1678
|
-
};
|
|
1679
|
-
};
|
|
1680
|
-
|
|
1681
|
-
// src/react/hooks/useCheckoutOptions.tsx
|
|
1682
|
-
import { queryOptions as queryOptions17, useQuery as useQuery22 } from "@tanstack/react-query";
|
|
1683
|
-
import { useAccount as useAccount3 } from "wagmi";
|
|
1684
|
-
import { z as z19 } from "zod";
|
|
1685
|
-
var UseCheckoutOptionsSchema = z19.object({
|
|
1686
|
-
chainId: z19.number(),
|
|
1687
|
-
orders: z19.array(
|
|
1688
|
-
z19.object({
|
|
1689
|
-
collectionAddress: AddressSchema,
|
|
1690
|
-
orderId: z19.string(),
|
|
1691
|
-
marketplace: z19.nativeEnum(MarketplaceKind)
|
|
1692
|
-
})
|
|
1693
|
-
),
|
|
1694
|
-
query: QueryArgSchema
|
|
1695
|
-
});
|
|
1696
|
-
var fetchCheckoutOptions = async (args, config) => {
|
|
1697
|
-
const marketplaceClient = getMarketplaceClient(args.chainId, config);
|
|
1698
|
-
return marketplaceClient.checkoutOptionsMarketplace({
|
|
1699
|
-
wallet: args.walletAddress,
|
|
1700
|
-
orders: args.orders.map((order) => ({
|
|
1701
|
-
contractAddress: order.collectionAddress,
|
|
1702
|
-
orderId: order.orderId,
|
|
1703
|
-
marketplace: order.marketplace
|
|
1704
|
-
})),
|
|
1705
|
-
additionalFee: 0
|
|
1706
|
-
//TODO: add additional fee
|
|
1707
|
-
});
|
|
1708
|
-
};
|
|
1709
|
-
var checkoutOptionsOptions = (args, config) => {
|
|
1710
|
-
return queryOptions17({
|
|
1711
|
-
queryKey: ["checkoutOptions", args],
|
|
1712
|
-
queryFn: () => fetchCheckoutOptions(args, config)
|
|
1713
|
-
});
|
|
1714
|
-
};
|
|
1715
|
-
var useCheckoutOptions = (args) => {
|
|
1716
|
-
const { address } = useAccount3();
|
|
1717
|
-
const config = useConfig();
|
|
1718
|
-
return useQuery22(
|
|
1719
|
-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
1720
|
-
checkoutOptionsOptions({ walletAddress: address, ...args }, config)
|
|
1721
|
-
);
|
|
1722
|
-
};
|
|
1723
|
-
|
|
1724
|
-
// src/react/hooks/useListCollections.tsx
|
|
1725
|
-
import { queryOptions as queryOptions18, useQuery as useQuery23 } from "@tanstack/react-query";
|
|
1726
|
-
import { z as z20 } from "zod";
|
|
1727
|
-
var UseListCollectionsSchema = z20.object({
|
|
1728
|
-
query: QueryArgSchema.optional().default({})
|
|
1729
|
-
});
|
|
1730
|
-
var fetchListCollections = async ({ marketplaceConfig }, config) => {
|
|
1731
|
-
const metadataClient = getMetadataClient(config);
|
|
1732
|
-
if (!marketplaceConfig?.collections?.length) {
|
|
1733
|
-
return [];
|
|
1734
|
-
}
|
|
1735
|
-
const collectionsByChain = marketplaceConfig.collections.reduce((acc, curr) => {
|
|
1736
|
-
const { chainId, address } = curr;
|
|
1737
|
-
if (!acc[chainId]) {
|
|
1738
|
-
acc[chainId] = [];
|
|
1739
|
-
}
|
|
1740
|
-
acc[chainId].push(address);
|
|
1741
|
-
return acc;
|
|
1742
|
-
}, {});
|
|
1743
|
-
const promises = Object.entries(collectionsByChain).map(
|
|
1744
|
-
([chainId, addresses]) => metadataClient.getContractInfoBatch({
|
|
1745
|
-
chainID: chainId,
|
|
1746
|
-
contractAddresses: addresses
|
|
1747
|
-
}).then((resp) => Object.values(resp.contractInfoMap))
|
|
1748
|
-
);
|
|
1749
|
-
const results = await Promise.all(promises);
|
|
1750
|
-
return results.flat();
|
|
1751
|
-
};
|
|
1752
|
-
var listCollectionsOptions = (args, config) => {
|
|
1753
|
-
return queryOptions18({
|
|
1754
|
-
...args.query,
|
|
1755
|
-
queryKey: [...collectionKeys.list],
|
|
1756
|
-
queryFn: () => fetchListCollections(args, config)
|
|
1757
|
-
});
|
|
1758
|
-
};
|
|
1759
|
-
var useListCollections = (args = {}) => {
|
|
1760
|
-
const config = useConfig();
|
|
1761
|
-
const { data: marketplaceConfig, isLoading: isLoadingConfig } = useMarketplaceConfig();
|
|
1762
|
-
return useQuery23({
|
|
1763
|
-
...listCollectionsOptions(
|
|
1764
|
-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
1765
|
-
{ marketplaceConfig, query: args.query },
|
|
1766
|
-
config
|
|
1767
|
-
),
|
|
1768
|
-
enabled: !isLoadingConfig && !!marketplaceConfig
|
|
1769
|
-
});
|
|
1770
|
-
};
|
|
1771
|
-
|
|
1772
|
-
// src/react/hooks/useCancelOrder.tsx
|
|
1773
|
-
import { useWaasFeeOptions } from "@0xsequence/connect";
|
|
1774
|
-
import { useEffect, useState } from "react";
|
|
1775
1574
|
|
|
1776
1575
|
// src/react/_internal/wallet/useWallet.ts
|
|
1777
|
-
import { skipToken as skipToken2, useQuery as
|
|
1576
|
+
import { skipToken as skipToken2, useQuery as useQuery22 } from "@tanstack/react-query";
|
|
1778
1577
|
import {
|
|
1779
|
-
useAccount as
|
|
1578
|
+
useAccount as useAccount2,
|
|
1780
1579
|
useChainId,
|
|
1781
1580
|
usePublicClient,
|
|
1782
1581
|
useSwitchChain,
|
|
@@ -1789,7 +1588,7 @@ import {
|
|
|
1789
1588
|
WaitForTransactionReceiptTimeoutError,
|
|
1790
1589
|
custom,
|
|
1791
1590
|
erc20Abi,
|
|
1792
|
-
erc721Abi
|
|
1591
|
+
erc721Abi,
|
|
1793
1592
|
hexToBigInt,
|
|
1794
1593
|
isHex
|
|
1795
1594
|
} from "viem";
|
|
@@ -1982,7 +1781,7 @@ var wallet = ({
|
|
|
1982
1781
|
case "ERC721":
|
|
1983
1782
|
return await publicClient.readContract({
|
|
1984
1783
|
address: contractAddress,
|
|
1985
|
-
abi:
|
|
1784
|
+
abi: erc721Abi,
|
|
1986
1785
|
functionName: "isApprovedForAll",
|
|
1987
1786
|
args: [walletAddress, spenderAddress]
|
|
1988
1787
|
});
|
|
@@ -2043,11 +1842,11 @@ var useWallet = () => {
|
|
|
2043
1842
|
isLoading: wagmiWalletIsLoading,
|
|
2044
1843
|
isError: wagmiWalletIsError
|
|
2045
1844
|
} = useWalletClient();
|
|
2046
|
-
const { connector, isConnected, isConnecting } =
|
|
1845
|
+
const { connector, isConnected, isConnecting } = useAccount2();
|
|
2047
1846
|
const sdkConfig = useConfig();
|
|
2048
1847
|
const chainId = useChainId();
|
|
2049
1848
|
const publicClient = usePublicClient();
|
|
2050
|
-
const { data, isLoading, isError } =
|
|
1849
|
+
const { data, isLoading, isError } = useQuery22({
|
|
2051
1850
|
queryKey: ["wallet", chainId, connector?.uid],
|
|
2052
1851
|
queryFn: walletClient && connector && isConnected && publicClient ? () => {
|
|
2053
1852
|
return wallet({
|
|
@@ -2067,6 +1866,233 @@ var useWallet = () => {
|
|
|
2067
1866
|
};
|
|
2068
1867
|
};
|
|
2069
1868
|
|
|
1869
|
+
// src/react/hooks/useGenerateOfferTransaction.tsx
|
|
1870
|
+
var generateOfferTransaction = async (params, config, chainId, walletKind) => {
|
|
1871
|
+
const args = {
|
|
1872
|
+
...params,
|
|
1873
|
+
offer: { ...params.offer, expiry: dateToUnixTime(params.offer.expiry) },
|
|
1874
|
+
walletType: walletKind
|
|
1875
|
+
};
|
|
1876
|
+
const marketplaceClient = getMarketplaceClient(chainId, config);
|
|
1877
|
+
return (await marketplaceClient.generateOfferTransaction(args)).steps;
|
|
1878
|
+
};
|
|
1879
|
+
var useGenerateOfferTransaction = (params) => {
|
|
1880
|
+
const config = useConfig();
|
|
1881
|
+
const { wallet: wallet2 } = useWallet();
|
|
1882
|
+
const { mutate, mutateAsync, ...result } = useMutation2({
|
|
1883
|
+
onSuccess: params.onSuccess,
|
|
1884
|
+
mutationFn: (args) => generateOfferTransaction(
|
|
1885
|
+
args,
|
|
1886
|
+
config,
|
|
1887
|
+
params.chainId,
|
|
1888
|
+
wallet2?.walletKind
|
|
1889
|
+
)
|
|
1890
|
+
});
|
|
1891
|
+
return {
|
|
1892
|
+
...result,
|
|
1893
|
+
generateOfferTransaction: mutate,
|
|
1894
|
+
generateOfferTransactionAsync: mutateAsync
|
|
1895
|
+
};
|
|
1896
|
+
};
|
|
1897
|
+
|
|
1898
|
+
// src/react/hooks/useGenerateSellTransaction.tsx
|
|
1899
|
+
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
1900
|
+
import { z as z17 } from "zod";
|
|
1901
|
+
var UserGeneratSellTransactionArgsSchema = z17.object({
|
|
1902
|
+
chainId: z17.number(),
|
|
1903
|
+
onSuccess: z17.function().args(stepSchema.array().optional()).optional()
|
|
1904
|
+
});
|
|
1905
|
+
var generateSellTransaction = async (args, config, chainId) => {
|
|
1906
|
+
const marketplaceClient = getMarketplaceClient(chainId, config);
|
|
1907
|
+
return marketplaceClient.generateSellTransaction(args).then((data) => data.steps);
|
|
1908
|
+
};
|
|
1909
|
+
var useGenerateSellTransaction = (params) => {
|
|
1910
|
+
const config = useConfig();
|
|
1911
|
+
const { mutate, mutateAsync, ...result } = useMutation3({
|
|
1912
|
+
onSuccess: params.onSuccess,
|
|
1913
|
+
mutationFn: (args) => generateSellTransaction(args, config, params.chainId)
|
|
1914
|
+
});
|
|
1915
|
+
return {
|
|
1916
|
+
...result,
|
|
1917
|
+
generateSellTransaction: mutate,
|
|
1918
|
+
generateSellTransactionAsync: mutateAsync
|
|
1919
|
+
};
|
|
1920
|
+
};
|
|
1921
|
+
|
|
1922
|
+
// src/react/hooks/useGenerateCancelTransaction.tsx
|
|
1923
|
+
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
1924
|
+
import { z as z18 } from "zod";
|
|
1925
|
+
var UserGenerateCancelTransactionArgsSchema = z18.object({
|
|
1926
|
+
chainId: z18.number(),
|
|
1927
|
+
onSuccess: z18.function().args(stepSchema.array().optional()).optional()
|
|
1928
|
+
});
|
|
1929
|
+
var generateCancelTransaction = async (args, config, chainId) => {
|
|
1930
|
+
const marketplaceClient = getMarketplaceClient(chainId, config);
|
|
1931
|
+
return marketplaceClient.generateCancelTransaction(args).then((data) => data.steps);
|
|
1932
|
+
};
|
|
1933
|
+
var useGenerateCancelTransaction = (params) => {
|
|
1934
|
+
const config = useConfig();
|
|
1935
|
+
const { mutate, mutateAsync, ...result } = useMutation4({
|
|
1936
|
+
onSuccess: params.onSuccess,
|
|
1937
|
+
mutationFn: (args) => generateCancelTransaction(args, config, params.chainId)
|
|
1938
|
+
});
|
|
1939
|
+
return {
|
|
1940
|
+
...result,
|
|
1941
|
+
generateCancelTransaction: mutate,
|
|
1942
|
+
generateCancelTransactionAsync: mutateAsync
|
|
1943
|
+
};
|
|
1944
|
+
};
|
|
1945
|
+
|
|
1946
|
+
// src/react/hooks/useTransferTokens.tsx
|
|
1947
|
+
import { erc721Abi as erc721Abi2 } from "viem";
|
|
1948
|
+
import { useAccount as useAccount3, useWriteContract } from "wagmi";
|
|
1949
|
+
var prepareTransferConfig = (params, accountAddress) => {
|
|
1950
|
+
if (params.contractType === "ERC721") {
|
|
1951
|
+
return {
|
|
1952
|
+
abi: erc721Abi2,
|
|
1953
|
+
address: params.collectionAddress,
|
|
1954
|
+
functionName: "safeTransferFrom",
|
|
1955
|
+
args: [
|
|
1956
|
+
accountAddress,
|
|
1957
|
+
params.receiverAddress,
|
|
1958
|
+
BigInt(params.tokenId)
|
|
1959
|
+
]
|
|
1960
|
+
};
|
|
1961
|
+
}
|
|
1962
|
+
return {
|
|
1963
|
+
abi: ERC1155_ABI,
|
|
1964
|
+
address: params.collectionAddress,
|
|
1965
|
+
functionName: "safeTransferFrom",
|
|
1966
|
+
args: [
|
|
1967
|
+
accountAddress,
|
|
1968
|
+
params.receiverAddress,
|
|
1969
|
+
BigInt(params.tokenId),
|
|
1970
|
+
params.quantity,
|
|
1971
|
+
"0x"
|
|
1972
|
+
// data
|
|
1973
|
+
]
|
|
1974
|
+
};
|
|
1975
|
+
};
|
|
1976
|
+
var useTransferTokens = () => {
|
|
1977
|
+
const { address: accountAddress } = useAccount3();
|
|
1978
|
+
const {
|
|
1979
|
+
writeContractAsync,
|
|
1980
|
+
data: hash,
|
|
1981
|
+
isPending,
|
|
1982
|
+
isError,
|
|
1983
|
+
isSuccess
|
|
1984
|
+
} = useWriteContract();
|
|
1985
|
+
const transferTokensAsync = async (params) => {
|
|
1986
|
+
if (!accountAddress) {
|
|
1987
|
+
throw new NoWalletConnectedError();
|
|
1988
|
+
}
|
|
1989
|
+
const config = prepareTransferConfig(params, accountAddress);
|
|
1990
|
+
return await writeContractAsync(config);
|
|
1991
|
+
};
|
|
1992
|
+
return {
|
|
1993
|
+
transferTokensAsync,
|
|
1994
|
+
hash,
|
|
1995
|
+
transferring: isPending,
|
|
1996
|
+
transferFailed: isError,
|
|
1997
|
+
transferSuccess: isSuccess
|
|
1998
|
+
};
|
|
1999
|
+
};
|
|
2000
|
+
|
|
2001
|
+
// src/react/hooks/useCheckoutOptions.tsx
|
|
2002
|
+
import { queryOptions as queryOptions17, useQuery as useQuery23 } from "@tanstack/react-query";
|
|
2003
|
+
import { useAccount as useAccount4 } from "wagmi";
|
|
2004
|
+
import { z as z19 } from "zod";
|
|
2005
|
+
var UseCheckoutOptionsSchema = z19.object({
|
|
2006
|
+
chainId: z19.number(),
|
|
2007
|
+
orders: z19.array(
|
|
2008
|
+
z19.object({
|
|
2009
|
+
collectionAddress: AddressSchema,
|
|
2010
|
+
orderId: z19.string(),
|
|
2011
|
+
marketplace: z19.nativeEnum(MarketplaceKind)
|
|
2012
|
+
})
|
|
2013
|
+
),
|
|
2014
|
+
query: QueryArgSchema
|
|
2015
|
+
});
|
|
2016
|
+
var fetchCheckoutOptions = async (args, config) => {
|
|
2017
|
+
const marketplaceClient = getMarketplaceClient(args.chainId, config);
|
|
2018
|
+
return marketplaceClient.checkoutOptionsMarketplace({
|
|
2019
|
+
wallet: args.walletAddress,
|
|
2020
|
+
orders: args.orders.map((order) => ({
|
|
2021
|
+
contractAddress: order.collectionAddress,
|
|
2022
|
+
orderId: order.orderId,
|
|
2023
|
+
marketplace: order.marketplace
|
|
2024
|
+
})),
|
|
2025
|
+
additionalFee: 0
|
|
2026
|
+
//TODO: add additional fee
|
|
2027
|
+
});
|
|
2028
|
+
};
|
|
2029
|
+
var checkoutOptionsOptions = (args, config) => {
|
|
2030
|
+
return queryOptions17({
|
|
2031
|
+
queryKey: ["checkoutOptions", args],
|
|
2032
|
+
queryFn: () => fetchCheckoutOptions(args, config)
|
|
2033
|
+
});
|
|
2034
|
+
};
|
|
2035
|
+
var useCheckoutOptions = (args) => {
|
|
2036
|
+
const { address } = useAccount4();
|
|
2037
|
+
const config = useConfig();
|
|
2038
|
+
return useQuery23(
|
|
2039
|
+
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
2040
|
+
checkoutOptionsOptions({ walletAddress: address, ...args }, config)
|
|
2041
|
+
);
|
|
2042
|
+
};
|
|
2043
|
+
|
|
2044
|
+
// src/react/hooks/useListCollections.tsx
|
|
2045
|
+
import { queryOptions as queryOptions18, useQuery as useQuery24 } from "@tanstack/react-query";
|
|
2046
|
+
import { z as z20 } from "zod";
|
|
2047
|
+
var UseListCollectionsSchema = z20.object({
|
|
2048
|
+
query: QueryArgSchema.optional().default({})
|
|
2049
|
+
});
|
|
2050
|
+
var fetchListCollections = async ({ marketplaceConfig }, config) => {
|
|
2051
|
+
const metadataClient = getMetadataClient(config);
|
|
2052
|
+
if (!marketplaceConfig?.collections?.length) {
|
|
2053
|
+
return [];
|
|
2054
|
+
}
|
|
2055
|
+
const collectionsByChain = marketplaceConfig.collections.reduce((acc, curr) => {
|
|
2056
|
+
const { chainId, address } = curr;
|
|
2057
|
+
if (!acc[chainId]) {
|
|
2058
|
+
acc[chainId] = [];
|
|
2059
|
+
}
|
|
2060
|
+
acc[chainId].push(address);
|
|
2061
|
+
return acc;
|
|
2062
|
+
}, {});
|
|
2063
|
+
const promises = Object.entries(collectionsByChain).map(
|
|
2064
|
+
([chainId, addresses]) => metadataClient.getContractInfoBatch({
|
|
2065
|
+
chainID: chainId,
|
|
2066
|
+
contractAddresses: addresses
|
|
2067
|
+
}).then((resp) => Object.values(resp.contractInfoMap))
|
|
2068
|
+
);
|
|
2069
|
+
const results = await Promise.all(promises);
|
|
2070
|
+
return results.flat();
|
|
2071
|
+
};
|
|
2072
|
+
var listCollectionsOptions = (args, config) => {
|
|
2073
|
+
return queryOptions18({
|
|
2074
|
+
...args.query,
|
|
2075
|
+
queryKey: [...collectionKeys.list],
|
|
2076
|
+
queryFn: () => fetchListCollections(args, config)
|
|
2077
|
+
});
|
|
2078
|
+
};
|
|
2079
|
+
var useListCollections = (args = {}) => {
|
|
2080
|
+
const config = useConfig();
|
|
2081
|
+
const { data: marketplaceConfig, isLoading: isLoadingConfig } = useMarketplaceConfig();
|
|
2082
|
+
return useQuery24({
|
|
2083
|
+
...listCollectionsOptions(
|
|
2084
|
+
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
2085
|
+
{ marketplaceConfig, query: args.query },
|
|
2086
|
+
config
|
|
2087
|
+
),
|
|
2088
|
+
enabled: !isLoadingConfig && !!marketplaceConfig
|
|
2089
|
+
});
|
|
2090
|
+
};
|
|
2091
|
+
|
|
2092
|
+
// src/react/hooks/useCancelOrder.tsx
|
|
2093
|
+
import { useWaasFeeOptions } from "@0xsequence/connect";
|
|
2094
|
+
import { useEffect as useEffect2, useState } from "react";
|
|
2095
|
+
|
|
2070
2096
|
// src/react/ui/modals/_internal/components/switchChainModal/index.tsx
|
|
2071
2097
|
import { Button, Modal, Spinner, Text as Text2 } from "@0xsequence/design-system";
|
|
2072
2098
|
import { observer } from "@legendapp/state/react";
|
|
@@ -2149,7 +2175,7 @@ var SwitchChainModal = observer(() => {
|
|
|
2149
2175
|
try {
|
|
2150
2176
|
if (!chainIdToSwitchTo) return;
|
|
2151
2177
|
await switchChainAsync({ chainId: Number(chainIdToSwitchTo) });
|
|
2152
|
-
if (switchChainModal$.state.onSuccess && typeof switchChainModal$.state.onSuccess === "function") {
|
|
2178
|
+
if (switchChainModal$.state.onSuccess.get() && typeof switchChainModal$.state.onSuccess.get() === "function") {
|
|
2153
2179
|
switchChainModal$.state.onSuccess();
|
|
2154
2180
|
}
|
|
2155
2181
|
switchChainModal$.delete();
|
|
@@ -2206,6 +2232,91 @@ var SwitchChainModal = observer(() => {
|
|
|
2206
2232
|
});
|
|
2207
2233
|
var switchChainModal_default = SwitchChainModal;
|
|
2208
2234
|
|
|
2235
|
+
// src/react/hooks/util/optimisticCancelUpdates.ts
|
|
2236
|
+
var SECOND = 1e3;
|
|
2237
|
+
var updateQueriesOnCancel = ({
|
|
2238
|
+
orderId,
|
|
2239
|
+
queryClient
|
|
2240
|
+
}) => {
|
|
2241
|
+
queryClient.setQueriesData(
|
|
2242
|
+
{ queryKey: collectableKeys.offersCount, exact: false },
|
|
2243
|
+
(oldData) => {
|
|
2244
|
+
if (!oldData) return { count: 0 };
|
|
2245
|
+
return { count: Math.max(0, oldData.count - 1) };
|
|
2246
|
+
}
|
|
2247
|
+
);
|
|
2248
|
+
console.log("query client ", queryClient, "orderId", orderId);
|
|
2249
|
+
queryClient.setQueriesData(
|
|
2250
|
+
{ queryKey: collectableKeys.offers, exact: false },
|
|
2251
|
+
(oldData) => {
|
|
2252
|
+
if (!oldData || !oldData.offers) return oldData;
|
|
2253
|
+
return {
|
|
2254
|
+
...oldData,
|
|
2255
|
+
offers: oldData.offers.filter((offer) => offer.orderId !== orderId)
|
|
2256
|
+
};
|
|
2257
|
+
}
|
|
2258
|
+
);
|
|
2259
|
+
setTimeout(() => {
|
|
2260
|
+
queryClient.invalidateQueries({
|
|
2261
|
+
queryKey: collectableKeys.highestOffers,
|
|
2262
|
+
exact: false
|
|
2263
|
+
});
|
|
2264
|
+
}, 2 * SECOND);
|
|
2265
|
+
queryClient.setQueriesData(
|
|
2266
|
+
{ queryKey: collectableKeys.listingsCount, exact: false },
|
|
2267
|
+
(oldData) => {
|
|
2268
|
+
if (!oldData) return { count: 0 };
|
|
2269
|
+
return { count: Math.max(0, oldData.count - 1) };
|
|
2270
|
+
}
|
|
2271
|
+
);
|
|
2272
|
+
queryClient.setQueriesData(
|
|
2273
|
+
{ queryKey: collectableKeys.listings, exact: false },
|
|
2274
|
+
(oldData) => {
|
|
2275
|
+
if (!oldData || !oldData.listings) return oldData;
|
|
2276
|
+
return {
|
|
2277
|
+
...oldData,
|
|
2278
|
+
listings: oldData.listings.filter(
|
|
2279
|
+
(listing) => listing.orderId !== orderId
|
|
2280
|
+
)
|
|
2281
|
+
};
|
|
2282
|
+
}
|
|
2283
|
+
);
|
|
2284
|
+
setTimeout(() => {
|
|
2285
|
+
queryClient.invalidateQueries({
|
|
2286
|
+
queryKey: collectableKeys.lowestListings,
|
|
2287
|
+
exact: false
|
|
2288
|
+
});
|
|
2289
|
+
}, 2 * SECOND);
|
|
2290
|
+
};
|
|
2291
|
+
var invalidateQueriesOnCancel = ({
|
|
2292
|
+
queryClient
|
|
2293
|
+
}) => {
|
|
2294
|
+
queryClient.invalidateQueries({
|
|
2295
|
+
queryKey: collectableKeys.offers,
|
|
2296
|
+
exact: false
|
|
2297
|
+
});
|
|
2298
|
+
queryClient.invalidateQueries({
|
|
2299
|
+
queryKey: collectableKeys.offersCount,
|
|
2300
|
+
exact: false
|
|
2301
|
+
});
|
|
2302
|
+
queryClient.invalidateQueries({
|
|
2303
|
+
queryKey: collectableKeys.listings,
|
|
2304
|
+
exact: false
|
|
2305
|
+
});
|
|
2306
|
+
queryClient.invalidateQueries({
|
|
2307
|
+
queryKey: collectableKeys.listingsCount,
|
|
2308
|
+
exact: false
|
|
2309
|
+
});
|
|
2310
|
+
queryClient.invalidateQueries({
|
|
2311
|
+
queryKey: collectableKeys.highestOffers,
|
|
2312
|
+
exact: false
|
|
2313
|
+
});
|
|
2314
|
+
queryClient.invalidateQueries({
|
|
2315
|
+
queryKey: collectableKeys.lowestListings,
|
|
2316
|
+
exact: false
|
|
2317
|
+
});
|
|
2318
|
+
};
|
|
2319
|
+
|
|
2209
2320
|
// src/react/hooks/useCancelTransactionSteps.tsx
|
|
2210
2321
|
var useCancelTransactionSteps = ({
|
|
2211
2322
|
collectionAddress,
|
|
@@ -2311,8 +2422,11 @@ var useCancelTransactionSteps = ({
|
|
|
2311
2422
|
await wallet2.handleConfirmTransactionStep(hash, Number(chainId));
|
|
2312
2423
|
if (onSuccess && typeof onSuccess === "function") {
|
|
2313
2424
|
onSuccess({ hash });
|
|
2425
|
+
updateQueriesOnCancel({
|
|
2426
|
+
orderId,
|
|
2427
|
+
queryClient
|
|
2428
|
+
});
|
|
2314
2429
|
}
|
|
2315
|
-
queryClient.invalidateQueries();
|
|
2316
2430
|
setSteps((prev) => ({
|
|
2317
2431
|
...prev,
|
|
2318
2432
|
isExecuting: false
|
|
@@ -2323,14 +2437,20 @@ var useCancelTransactionSteps = ({
|
|
|
2323
2437
|
reservoirOrderId = await executeSignature({ signatureStep });
|
|
2324
2438
|
if (onSuccess && typeof onSuccess === "function") {
|
|
2325
2439
|
onSuccess({ orderId: reservoirOrderId });
|
|
2440
|
+
updateQueriesOnCancel({
|
|
2441
|
+
orderId: reservoirOrderId,
|
|
2442
|
+
queryClient
|
|
2443
|
+
});
|
|
2326
2444
|
}
|
|
2327
|
-
queryClient.invalidateQueries();
|
|
2328
2445
|
setSteps((prev) => ({
|
|
2329
2446
|
...prev,
|
|
2330
2447
|
isExecuting: false
|
|
2331
2448
|
}));
|
|
2332
2449
|
}
|
|
2333
2450
|
} catch (error) {
|
|
2451
|
+
invalidateQueriesOnCancel({
|
|
2452
|
+
queryClient
|
|
2453
|
+
});
|
|
2334
2454
|
setSteps((prev) => ({
|
|
2335
2455
|
...prev,
|
|
2336
2456
|
isExecuting: false
|
|
@@ -2401,9 +2521,10 @@ var useCancelOrder = ({
|
|
|
2401
2521
|
id: "",
|
|
2402
2522
|
options: void 0,
|
|
2403
2523
|
chainId
|
|
2404
|
-
}
|
|
2524
|
+
},
|
|
2525
|
+
enabled: !!pendingFeeOptionConfirmation
|
|
2405
2526
|
});
|
|
2406
|
-
|
|
2527
|
+
useEffect2(() => {
|
|
2407
2528
|
autoSelectOptionPromise.then((res) => {
|
|
2408
2529
|
if (pendingFeeOptionConfirmation?.id && res.selectedOption) {
|
|
2409
2530
|
confirmPendingFeeOption(
|
|
@@ -2531,6 +2652,7 @@ export {
|
|
|
2531
2652
|
floorOrderOptions,
|
|
2532
2653
|
useFloorOrder,
|
|
2533
2654
|
useHighestOffer,
|
|
2655
|
+
useInventory,
|
|
2534
2656
|
useListBalances,
|
|
2535
2657
|
listCollectibleActivitiesOptions,
|
|
2536
2658
|
useListCollectibleActivities,
|
|
@@ -2552,6 +2674,7 @@ export {
|
|
|
2552
2674
|
dateToUnixTime,
|
|
2553
2675
|
generateListingTransaction,
|
|
2554
2676
|
useGenerateListingTransaction,
|
|
2677
|
+
useWallet,
|
|
2555
2678
|
generateOfferTransaction,
|
|
2556
2679
|
useGenerateOfferTransaction,
|
|
2557
2680
|
generateSellTransaction,
|
|
@@ -2563,7 +2686,6 @@ export {
|
|
|
2563
2686
|
useCheckoutOptions,
|
|
2564
2687
|
listCollectionsOptions,
|
|
2565
2688
|
useListCollections,
|
|
2566
|
-
useWallet,
|
|
2567
2689
|
AlertMessage,
|
|
2568
2690
|
MODAL_OVERLAY_PROPS,
|
|
2569
2691
|
MODAL_CONTENT_PROPS,
|
|
@@ -2575,4 +2697,4 @@ export {
|
|
|
2575
2697
|
collectionDetailsPollingOptions,
|
|
2576
2698
|
useCollectionDetailsPolling
|
|
2577
2699
|
};
|
|
2578
|
-
//# sourceMappingURL=chunk-
|
|
2700
|
+
//# sourceMappingURL=chunk-KCLMSSPS.js.map
|