@0xsequence/marketplace-sdk 0.5.7 → 0.6.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/chunk-2J7JIOW5.js +2 -0
- package/dist/{chunk-3OU7BADC.js → chunk-6MYDUGVO.js} +21 -4
- package/dist/chunk-6MYDUGVO.js.map +1 -0
- package/dist/chunk-6WMO5YM5.js +94 -0
- package/dist/chunk-6WMO5YM5.js.map +1 -0
- package/dist/{chunk-YA3DWLDC.js → chunk-A5ICXOCZ.js} +156 -227
- package/dist/chunk-A5ICXOCZ.js.map +1 -0
- package/dist/{chunk-G2T7HCWE.js → chunk-C42WHQRT.js} +3 -3
- package/dist/{chunk-G2T7HCWE.js.map → chunk-C42WHQRT.js.map} +1 -1
- package/dist/{chunk-ZBLU3Q22.js → chunk-DLB2EQRX.js} +2 -2
- package/dist/{chunk-ZBLU3Q22.js.map → chunk-DLB2EQRX.js.map} +1 -1
- package/dist/{chunk-YOKGP2EQ.js → chunk-FG2BBP3P.js} +1 -1
- package/dist/{chunk-YOKGP2EQ.js.map → chunk-FG2BBP3P.js.map} +1 -1
- package/dist/{chunk-Y56IIYDF.js → chunk-GMWUIMX4.js} +5 -5
- package/dist/{chunk-Y56IIYDF.js.map → chunk-GMWUIMX4.js.map} +1 -1
- package/dist/{chunk-OMCWTRBR.js → chunk-NKHM2AIS.js} +21 -4
- package/dist/chunk-NKHM2AIS.js.map +1 -0
- package/dist/{chunk-YYBU45PK.js → chunk-NXORBVUS.js} +2 -2
- package/dist/{chunk-L2K4DBH2.js → chunk-UZ3GJXBR.js} +3003 -3124
- package/dist/chunk-UZ3GJXBR.js.map +1 -0
- package/dist/{chunk-6YHHCGGY.js → chunk-VPJHNXZ2.js} +50 -74
- package/dist/chunk-VPJHNXZ2.js.map +1 -0
- package/dist/index-BwDj_3at.d.ts +72 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +175 -88
- package/dist/react/_internal/databeat/index.js +7 -6
- package/dist/react/_internal/index.d.ts +2 -2
- package/dist/react/_internal/index.js +1 -1
- package/dist/react/hooks/index.d.ts +3 -65
- package/dist/react/hooks/index.js +8 -8
- package/dist/react/hooks/options/index.d.ts +8 -0
- package/dist/react/hooks/options/index.js +17 -0
- package/dist/react/hooks/options/index.js.map +1 -0
- package/dist/react/index.css +40 -29
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.js +17 -13
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/collectible-card/index.css +40 -29
- package/dist/react/ui/components/collectible-card/index.css.map +1 -1
- package/dist/react/ui/components/collectible-card/index.d.ts +3 -2
- package/dist/react/ui/components/collectible-card/index.js +12 -11
- package/dist/react/ui/components/marketplace-logos/index.d.ts +1 -1
- package/dist/react/ui/components/marketplace-logos/index.js +1 -1
- package/dist/react/ui/icons/index.js +1 -1
- package/dist/react/ui/index.css +40 -29
- package/dist/react/ui/index.css.map +1 -1
- package/dist/react/ui/index.d.ts +1 -1
- package/dist/react/ui/index.js +12 -11
- package/dist/react/ui/modals/_internal/components/actionModal/index.css +48 -48
- package/dist/react/ui/modals/_internal/components/actionModal/index.css.map +1 -1
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +1 -1
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +7 -6
- package/dist/styles/index.js +2 -2
- package/dist/types/index.js +1 -1
- package/dist/utils/index.d.ts +9 -7
- package/dist/utils/index.js +5 -3
- package/package.json +9 -5
- package/src/react/__tests__/provider.test.tsx +4 -4
- package/src/react/_internal/api/__mocks__/indexer.msw.ts +5 -5
- package/src/react/_internal/api/__mocks__/metadata.msw.ts +2 -2
- package/src/react/_internal/api/zod-schema.ts +2 -2
- package/src/react/_internal/types.ts +2 -2
- package/src/react/_internal/wagmi/__tests__/create-config.test.ts +6 -6
- package/src/react/_internal/wallet/__tests__/wallet.test.ts +1 -1
- package/src/react/_internal/wallet/wallet.ts +6 -2
- package/src/react/hooks/__tests__/useAutoSelectFeeOption.test.tsx +8 -12
- package/src/react/hooks/__tests__/useBalanceOfCollectible.test.tsx +5 -4
- package/src/react/hooks/__tests__/useCancelOrder.test.tsx +13 -6
- package/src/react/hooks/__tests__/useCancelTransactionSteps.test.tsx +6 -7
- package/src/react/hooks/__tests__/useCollectible.test.tsx +6 -7
- package/src/react/hooks/__tests__/useCollection.test.tsx +5 -6
- package/src/react/hooks/__tests__/useCollectionBalanceDetails.test.tsx +5 -4
- package/src/react/hooks/__tests__/useCollectionDetails.test.tsx +7 -6
- package/src/react/hooks/__tests__/useCollectionDetailsPolling.test.tsx +5 -4
- package/src/react/hooks/__tests__/useComparePrices.test.tsx +1 -2
- package/src/react/hooks/__tests__/useConvertPriceToUSD.test.tsx +2 -3
- package/src/react/hooks/__tests__/useCountListingsForCollectible.test.tsx +4 -5
- package/src/react/hooks/__tests__/useCountOfCollectables.test.tsx +6 -7
- package/src/react/hooks/__tests__/useCountOffersForCollectible.test.tsx +4 -5
- package/src/react/hooks/__tests__/useCurrencies.test.tsx +3 -4
- package/src/react/hooks/__tests__/useCurrency.test.tsx +4 -6
- package/src/react/hooks/__tests__/useCurrencyBalance.test.tsx +12 -7
- package/src/react/hooks/__tests__/useFilters.test.tsx +5 -6
- package/src/react/hooks/__tests__/useFloorOrder.test.tsx +5 -6
- package/src/react/hooks/__tests__/useGenerateBuyTransaction.test.tsx +6 -7
- package/src/react/hooks/__tests__/useGenerateCancelTransaction.test.tsx +1 -2
- package/src/react/hooks/__tests__/useGenerateListingTransaction.test.tsx +2 -3
- package/src/react/hooks/__tests__/useGenerateOfferTransaction.test.tsx +1 -2
- package/src/react/hooks/__tests__/useGenerateSellTransaction.test.tsx +1 -2
- package/src/react/hooks/__tests__/useHighestOffer.test.tsx +6 -7
- package/src/react/hooks/__tests__/useListBalances.test.tsx +1 -1
- package/src/react/hooks/__tests__/useListCollectibleActivities.test.tsx +2 -3
- package/src/react/hooks/__tests__/useListCollectibles.test.tsx +6 -7
- package/src/react/hooks/__tests__/useListCollectiblesPaginated.test.tsx +2 -3
- package/src/react/hooks/__tests__/useListCollectionActivities.test.tsx +3 -4
- package/src/react/hooks/__tests__/useListCollections.test.tsx +1 -2
- package/src/react/hooks/__tests__/useListListingsForCollectible.test.tsx +6 -7
- package/src/react/hooks/__tests__/useListOffersForCollectible.test.tsx +6 -7
- package/src/react/hooks/__tests__/useLowestListing.test.tsx +6 -7
- package/src/react/hooks/__tests__/useMarketplaceConfig.test.tsx +1 -2
- package/src/react/hooks/__tests__/useRoyaltyPercentage.test.tsx +1 -1
- package/src/react/hooks/options/__tests__/marketplaceConfigOptions.test.tsx +3 -4
- package/src/react/hooks/options/collectionOptions.ts +42 -0
- package/src/react/hooks/options/index.ts +2 -0
- package/src/react/hooks/useCancelOrder.tsx +3 -3
- package/src/react/hooks/useCancelTransactionSteps.tsx +11 -11
- package/src/react/hooks/useCollection.tsx +6 -37
- package/src/react/hooks/useCollectionBalanceDetails.tsx +3 -3
- package/src/react/hooks/useCollectionDetailsPolling.tsx +1 -1
- package/src/react/hooks/useCurrencies.tsx +1 -1
- package/src/react/hooks/useGenerateListingTransaction.tsx +1 -1
- package/src/react/hooks/useGenerateOfferTransaction.tsx +1 -1
- package/src/react/hooks/useGetReceiptFromHash.tsx +1 -1
- package/src/react/hooks/useListCollectibleActivities.tsx +1 -1
- package/src/react/hooks/useListCollectionActivities.tsx +1 -1
- package/src/react/index.ts +1 -0
- package/src/react/provider.tsx +2 -2
- package/src/react/ssr/__tests__/create-ssr-client.test.ts +1 -22
- package/src/react/ssr/create-ssr-client.ts +1 -1
- package/src/react/ui/components/_internals/action-button/ActionButton.tsx +3 -3
- package/src/react/ui/components/_internals/action-button/components/ActionButtonBody.tsx +2 -2
- package/src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx +4 -4
- package/src/react/ui/components/_internals/action-button/components/OwnerActions.tsx +2 -2
- package/src/react/ui/components/_internals/action-button/hooks/useActionButtonLogic.ts +1 -1
- package/src/react/ui/components/_internals/custom-select/__tests__/CustomSelect.test.tsx +2 -7
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +9 -2
- package/src/react/ui/components/collectible-card/Footer.tsx +1 -1
- package/src/react/ui/components/marketplace-logos/marketplace-logos.tsx +1 -1
- package/src/react/ui/icons/index.ts +2 -5
- package/src/react/ui/{icons/DiamondEye.tsx → images/marketplaces/LooksRare.tsx} +1 -1
- package/src/react/ui/modals/BuyModal/__tests__/Modal.test.tsx +10 -11
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useBuyCollectable.test.tsx +343 -0
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useCheckoutOptions.test.tsx +2 -7
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useFees.test.tsx +4 -4
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useLoadData.test.tsx +1 -1
- package/src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts +3 -3
- package/src/react/ui/modals/BuyModal/hooks/useLoadData.ts +1 -1
- package/src/react/ui/modals/BuyModal/modals/Modal1155.tsx +23 -24
- package/src/react/ui/modals/BuyModal/modals/__tests__/CheckoutModal.test.tsx +2 -2
- package/src/react/ui/modals/BuyModal/modals/__tests__/Modal1155.test.tsx +209 -242
- package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +5 -11
- package/src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts +1 -1
- package/src/react/ui/modals/CreateListingModal/index.tsx +1 -1
- package/src/react/ui/modals/MakeOfferModal/Modal.tsx +1 -1
- package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +46 -49
- package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +9 -28
- package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +2 -2
- package/src/react/ui/modals/SuccessfulPurchaseModal/__tests__/Modal.test.tsx +3 -3
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +4 -4
- package/src/react/ui/modals/_internal/components/actionModal/store.ts +1 -1
- package/src/react/ui/modals/_internal/components/alertMessage/index.tsx +2 -3
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/__tests__/index.test.tsx +4 -4
- package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/priceInput/__tests__/index.test.tsx +1 -8
- package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +9 -5
- package/src/react/ui/modals/_internal/components/switchChainModal/__tests__/SwitchChainModal.test.tsx +4 -10
- package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +2 -2
- package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +1 -1
- package/src/react/ui/modals/_internal/components/transaction-footer/index.tsx +9 -3
- package/src/react/ui/modals/_internal/components/transaction-footer/transactionFooter.css.ts +11 -0
- package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/TransactionStatusModal.test.tsx +4 -9
- package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/utils.test.ts +3 -3
- package/src/react/ui/modals/_internal/components/transactionStatusModal/hooks/useTransactionStatus.ts +4 -4
- package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +1 -1
- package/src/react/ui/modals/modal-provider.tsx +2 -2
- package/src/utils/__tests__/address.test.ts +1 -1
- package/src/utils/__tests__/getMarketplaceDetails.test.ts +4 -4
- package/src/utils/getMarketplaceDetails.ts +7 -7
- package/src/utils/index.ts +1 -0
- package/src/utils/networkconfigToWagmiChain.ts +17 -0
- package/src/utils/price.ts +2 -5
- package/test/const.ts +35 -0
- package/test/globalSetup.ts +15 -0
- package/test/index.ts +1 -0
- package/{src/react/_internal/test → test}/mocks/wallet.ts +5 -5
- package/test/setup.ts +20 -0
- package/test/test-utils.tsx +157 -0
- package/tsconfig.json +7 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/vitest.config.js +5 -3
- package/dist/chunk-3OU7BADC.js.map +0 -1
- package/dist/chunk-6YHHCGGY.js.map +0 -1
- package/dist/chunk-GFADBQPX.js +0 -2
- package/dist/chunk-L2K4DBH2.js.map +0 -1
- package/dist/chunk-OMCWTRBR.js.map +0 -1
- package/dist/chunk-YA3DWLDC.js.map +0 -1
- package/src/react/_internal/test/setup.ts +0 -28
- package/src/react/_internal/test-utils.tsx +0 -97
- package/src/react/ui/icons/ArrowUp.tsx +0 -32
- package/src/react/ui/icons/InventoryIcon.tsx +0 -44
- package/src/react/ui/icons/MinusIcon.tsx +0 -34
- package/src/react/ui/icons/PlusIcon.tsx +0 -32
- package/src/react/ui/icons/PositiveCircleIcon.tsx +0 -38
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useBuyCollectable.test.tsx.bak +0 -379
- package/dist/{chunk-GFADBQPX.js.map → chunk-2J7JIOW5.js.map} +0 -0
- package/dist/{chunk-YYBU45PK.js.map → chunk-NXORBVUS.js.map} +0 -0
- package/dist/{types-BVD42zE_.d.ts → types-CPl0DH-A.d.ts} +1 -1
- /package/src/react/ui/icons/{Bell.tsx → BellIcon.tsx} +0 -0
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Box, type IconProps } from '@0xsequence/design-system';
|
|
2
|
-
import { iconVariants } from './styles.css';
|
|
3
|
-
|
|
4
|
-
const Svg = () => (
|
|
5
|
-
<svg
|
|
6
|
-
width="12"
|
|
7
|
-
height="12"
|
|
8
|
-
viewBox="0 0 12 12"
|
|
9
|
-
fill="none"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
role="img"
|
|
12
|
-
aria-label="Arrow up"
|
|
13
|
-
>
|
|
14
|
-
<title>Arrow up icon</title>
|
|
15
|
-
<path
|
|
16
|
-
d="M8.65039 6.03638L9.28679 5.39999L5.96859 2.08179L2.65039 5.39999L3.28679 6.03638L5.51859 3.80458V9.91822H6.41859V3.80458L8.65039 6.03638Z"
|
|
17
|
-
fill="#D1D1D1"
|
|
18
|
-
/>
|
|
19
|
-
</svg>
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const SvgArrowUpIcon = ({ size = 'sm', ...props }: IconProps) => (
|
|
23
|
-
<Box
|
|
24
|
-
as={Svg}
|
|
25
|
-
className={iconVariants({
|
|
26
|
-
size,
|
|
27
|
-
})}
|
|
28
|
-
{...props}
|
|
29
|
-
/>
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
export default SvgArrowUpIcon;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Box, type IconProps } from '@0xsequence/design-system';
|
|
2
|
-
import { iconVariants } from './styles.css';
|
|
3
|
-
|
|
4
|
-
const Svg = () => (
|
|
5
|
-
<svg
|
|
6
|
-
width="20"
|
|
7
|
-
height="20"
|
|
8
|
-
viewBox="0 0 20 20"
|
|
9
|
-
fill="none"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
role="img"
|
|
12
|
-
aria-label="Inventory"
|
|
13
|
-
>
|
|
14
|
-
<title>Inventory icon</title>
|
|
15
|
-
<path
|
|
16
|
-
d="M2 4C2 2.89543 2.85961 2 3.92 2H6.48C7.54039 2 8.4 2.89543 8.4 4V6.66667C8.4 7.77124 7.54039 8.66667 6.48 8.66667H3.92C2.85961 8.66667 2 7.77124 2 6.66667V4Z"
|
|
17
|
-
fill="white"
|
|
18
|
-
/>
|
|
19
|
-
<path
|
|
20
|
-
d="M11.6 4C11.6 2.89543 12.4596 2 13.52 2H16.08C17.1404 2 18 2.89543 18 4V6.66667C18 7.77124 17.1404 8.66667 16.08 8.66667H13.52C12.4596 8.66667 11.6 7.77124 11.6 6.66667V4Z"
|
|
21
|
-
fill="white"
|
|
22
|
-
/>
|
|
23
|
-
<path
|
|
24
|
-
d="M2 13.3333C2 12.2288 2.85961 11.3333 3.92 11.3333H6.48C7.54039 11.3333 8.4 12.2288 8.4 13.3333V16C8.4 17.1046 7.54039 18 6.48 18H3.92C2.85961 18 2 17.1046 2 16V13.3333Z"
|
|
25
|
-
fill="white"
|
|
26
|
-
/>
|
|
27
|
-
<path
|
|
28
|
-
d="M11.6 13.3333C11.6 12.2288 12.4596 11.3333 13.52 11.3333H16.08C17.1404 11.3333 18 12.2288 18 13.3333V16C18 17.1046 17.1404 18 16.08 18H13.52C12.4596 18 11.6 17.1046 11.6 16V13.3333Z"
|
|
29
|
-
fill="white"
|
|
30
|
-
/>
|
|
31
|
-
</svg>
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const SvgInventoryIcon = ({ size = 'sm', ...props }: IconProps) => (
|
|
35
|
-
<Box
|
|
36
|
-
as={Svg}
|
|
37
|
-
className={iconVariants({
|
|
38
|
-
size,
|
|
39
|
-
})}
|
|
40
|
-
{...props}
|
|
41
|
-
/>
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
export default SvgInventoryIcon;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Box, type IconProps } from '@0xsequence/design-system';
|
|
2
|
-
import { iconVariants } from './styles.css';
|
|
3
|
-
|
|
4
|
-
const Svg = () => (
|
|
5
|
-
<svg
|
|
6
|
-
width="16"
|
|
7
|
-
height="16"
|
|
8
|
-
viewBox="0 0 16 16"
|
|
9
|
-
fill="none"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
role="img"
|
|
12
|
-
aria-labelledby="minus-title"
|
|
13
|
-
>
|
|
14
|
-
<title id="minus-title">Minus Icon</title>
|
|
15
|
-
<path
|
|
16
|
-
fillRule="evenodd"
|
|
17
|
-
clipRule="evenodd"
|
|
18
|
-
d="M13.2303 8.60039L3.4375 8.60039L3.4375 7.40039L13.2303 7.40039V8.60039Z"
|
|
19
|
-
fill="white"
|
|
20
|
-
/>
|
|
21
|
-
</svg>
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
const SvgMinusIcon = ({ size = 'sm', ...props }: IconProps) => (
|
|
25
|
-
<Box
|
|
26
|
-
as={Svg}
|
|
27
|
-
className={iconVariants({
|
|
28
|
-
size,
|
|
29
|
-
})}
|
|
30
|
-
{...props}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
export default SvgMinusIcon;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Box, type IconProps } from '@0xsequence/design-system';
|
|
2
|
-
import { iconVariants } from './styles.css';
|
|
3
|
-
|
|
4
|
-
const Svg = () => (
|
|
5
|
-
<svg
|
|
6
|
-
width="16"
|
|
7
|
-
height="16"
|
|
8
|
-
viewBox="0 0 16 16"
|
|
9
|
-
fill="none"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
role="img"
|
|
12
|
-
aria-labelledby="plus-title"
|
|
13
|
-
>
|
|
14
|
-
<title id="plus-title">Plus Icon</title>
|
|
15
|
-
<path
|
|
16
|
-
d="M8.65529 7.45725V2.40039H7.45529V7.45724H2.39844V8.65725H7.45529V13.7141H8.65529V8.65725H13.7121V7.45725H8.65529Z"
|
|
17
|
-
fill="white"
|
|
18
|
-
/>
|
|
19
|
-
</svg>
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const SvgPlusIcon = ({ size = 'sm', ...props }: IconProps) => (
|
|
23
|
-
<Box
|
|
24
|
-
as={Svg}
|
|
25
|
-
className={iconVariants({
|
|
26
|
-
size,
|
|
27
|
-
})}
|
|
28
|
-
{...props}
|
|
29
|
-
/>
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
export default SvgPlusIcon;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Box, type IconProps } from '@0xsequence/design-system';
|
|
2
|
-
import { iconVariants } from './styles.css';
|
|
3
|
-
|
|
4
|
-
const Svg = () => (
|
|
5
|
-
<svg
|
|
6
|
-
width="24"
|
|
7
|
-
height="24"
|
|
8
|
-
viewBox="0 0 24 24"
|
|
9
|
-
fill="none"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
role="img"
|
|
12
|
-
aria-labelledby="positive-circle-title"
|
|
13
|
-
>
|
|
14
|
-
<title id="positive-circle-title">Positive Circle Icon</title>
|
|
15
|
-
<path
|
|
16
|
-
d="M21.6004 11.9999C21.6004 17.3018 17.3023 21.5999 12.0004 21.5999C6.69846 21.5999 2.40039 17.3018 2.40039 11.9999C2.40039 6.69797 6.69846 2.3999 12.0004 2.3999C17.3023 2.3999 21.6004 6.69797 21.6004 11.9999Z"
|
|
17
|
-
fill="#14A554"
|
|
18
|
-
/>
|
|
19
|
-
<path
|
|
20
|
-
fillRule="evenodd"
|
|
21
|
-
clipRule="evenodd"
|
|
22
|
-
d="M16.5798 7.79868L10.8701 16.7999L7.20039 12.6764L8.03544 11.9332L10.7199 14.9497L15.6359 7.1999L16.5798 7.79868Z"
|
|
23
|
-
fill="white"
|
|
24
|
-
/>
|
|
25
|
-
</svg>
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
const SvgPositiveCircleIcon = ({ size = 'sm', ...props }: IconProps) => (
|
|
29
|
-
<Box
|
|
30
|
-
as={Svg}
|
|
31
|
-
className={iconVariants({
|
|
32
|
-
size,
|
|
33
|
-
})}
|
|
34
|
-
{...props}
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
export default SvgPositiveCircleIcon;
|
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
import { renderHook } from '@testing-library/react';
|
|
2
|
-
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
3
|
-
import { useBuyCollectable } from '../useBuyCollectable';
|
|
4
|
-
import { useWallet } from '../../../../../_internal/wallet/useWallet';
|
|
5
|
-
import { useSelectPaymentModal } from '@0xsequence/kit-checkout';
|
|
6
|
-
import { useConfig } from '../../../../../hooks';
|
|
7
|
-
import { useFees } from '../useFees';
|
|
8
|
-
import {
|
|
9
|
-
MarketplaceKind,
|
|
10
|
-
TransactionCrypto,
|
|
11
|
-
WalletKind,
|
|
12
|
-
getMarketplaceClient,
|
|
13
|
-
} from '../../../../../_internal';
|
|
14
|
-
|
|
15
|
-
// Mock dependencies
|
|
16
|
-
vi.mock('@0xsequence/kit-checkout', () => ({
|
|
17
|
-
useSelectPaymentModal: vi.fn(),
|
|
18
|
-
}));
|
|
19
|
-
|
|
20
|
-
vi.mock('../../../../../_internal/wallet/useWallet', () => ({
|
|
21
|
-
useWallet: vi.fn(),
|
|
22
|
-
}));
|
|
23
|
-
|
|
24
|
-
vi.mock('../../../../../hooks', () => ({
|
|
25
|
-
useConfig: vi.fn(),
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
vi.mock('../useFees', () => ({
|
|
29
|
-
useFees: vi.fn(),
|
|
30
|
-
}));
|
|
31
|
-
|
|
32
|
-
// Mock the buyModal$ store
|
|
33
|
-
const mockClose = vi.fn();
|
|
34
|
-
vi.mock('../store', () => ({
|
|
35
|
-
buyModal$: {
|
|
36
|
-
close: mockClose,
|
|
37
|
-
},
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
|
-
vi.mock('../../../../../_internal', async () => {
|
|
41
|
-
const actual = (await vi.importActual('../../../../../_internal')) as Record<
|
|
42
|
-
string,
|
|
43
|
-
unknown
|
|
44
|
-
>;
|
|
45
|
-
return {
|
|
46
|
-
...actual,
|
|
47
|
-
getMarketplaceClient: vi.fn(() => ({
|
|
48
|
-
generateBuyTransaction: vi.fn().mockResolvedValue({
|
|
49
|
-
steps: [
|
|
50
|
-
{
|
|
51
|
-
type: 'transaction',
|
|
52
|
-
value: '1000000000000000000',
|
|
53
|
-
to: '0x123',
|
|
54
|
-
data: '0x456',
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
}),
|
|
58
|
-
})),
|
|
59
|
-
collectableKeys: {
|
|
60
|
-
listings: ['listings'],
|
|
61
|
-
listingsCount: ['listingsCount'],
|
|
62
|
-
lists: ['lists'],
|
|
63
|
-
userBalances: ['userBalances'],
|
|
64
|
-
},
|
|
65
|
-
balanceQueries: {
|
|
66
|
-
all: ['balances'],
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe('useBuyCollectable', () => {
|
|
72
|
-
const defaultProps = {
|
|
73
|
-
chainId: '1',
|
|
74
|
-
collectionAddress: '0x123',
|
|
75
|
-
tokenId: '1',
|
|
76
|
-
priceCurrencyAddress: '0x0',
|
|
77
|
-
setCheckoutModalIsLoading: vi.fn(),
|
|
78
|
-
setCheckoutModalLoaded: vi.fn(),
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
beforeEach(() => {
|
|
82
|
-
vi.clearAllMocks();
|
|
83
|
-
|
|
84
|
-
// Setup default mock implementations
|
|
85
|
-
(
|
|
86
|
-
useSelectPaymentModal as unknown as ReturnType<typeof vi.fn>
|
|
87
|
-
).mockReturnValue({
|
|
88
|
-
openSelectPaymentModal: vi.fn(),
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
(useConfig as unknown as ReturnType<typeof vi.fn>).mockReturnValue({
|
|
92
|
-
projectAccessKey: 'test-key',
|
|
93
|
-
projectId: 'test-id',
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
(useFees as unknown as ReturnType<typeof vi.fn>).mockReturnValue({
|
|
97
|
-
amount: '250',
|
|
98
|
-
receiver: '0x123',
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('should return loading state initially', () => {
|
|
103
|
-
// Mock useWallet to return loading state
|
|
104
|
-
(useWallet as unknown as ReturnType<typeof vi.fn>).mockReturnValue({
|
|
105
|
-
wallet: null,
|
|
106
|
-
isLoading: true,
|
|
107
|
-
isError: false,
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
const { result } = renderHook(() => useBuyCollectable(defaultProps));
|
|
111
|
-
|
|
112
|
-
expect(result.current).toEqual({
|
|
113
|
-
status: 'loading',
|
|
114
|
-
buy: null,
|
|
115
|
-
isLoading: true,
|
|
116
|
-
isError: false,
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it('should return error state when wallet is not available', () => {
|
|
121
|
-
// Mock useWallet to return error state
|
|
122
|
-
(useWallet as unknown as ReturnType<typeof vi.fn>).mockReturnValue({
|
|
123
|
-
wallet: null,
|
|
124
|
-
isLoading: false,
|
|
125
|
-
isError: true,
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
const { result } = renderHook(() => useBuyCollectable(defaultProps));
|
|
129
|
-
|
|
130
|
-
expect(result.current).toEqual({
|
|
131
|
-
status: 'error',
|
|
132
|
-
buy: null,
|
|
133
|
-
isLoading: false,
|
|
134
|
-
isError: true,
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
// Also test when wallet is undefined but no error
|
|
138
|
-
(useWallet as unknown as ReturnType<typeof vi.fn>).mockReturnValue({
|
|
139
|
-
wallet: undefined,
|
|
140
|
-
isLoading: false,
|
|
141
|
-
isError: false,
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
const { result: result2 } = renderHook(() =>
|
|
145
|
-
useBuyCollectable(defaultProps),
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
expect(result2.current).toEqual({
|
|
149
|
-
status: 'error',
|
|
150
|
-
buy: null,
|
|
151
|
-
isLoading: false,
|
|
152
|
-
isError: true,
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it('should call buy function with correct parameters', async () => {
|
|
157
|
-
// Mock useWallet to return a valid wallet
|
|
158
|
-
(useWallet as unknown as ReturnType<typeof vi.fn>).mockReturnValue({
|
|
159
|
-
wallet: {
|
|
160
|
-
kind: WalletKind.sequence,
|
|
161
|
-
address: async () => '0x123',
|
|
162
|
-
chainId: '1',
|
|
163
|
-
},
|
|
164
|
-
isLoading: false,
|
|
165
|
-
isError: false,
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
const openSelectPaymentModalMock = vi.fn();
|
|
169
|
-
(
|
|
170
|
-
useSelectPaymentModal as unknown as ReturnType<typeof vi.fn>
|
|
171
|
-
).mockReturnValue({
|
|
172
|
-
openSelectPaymentModal: openSelectPaymentModalMock,
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
const generateBuyTransactionMock = vi.fn().mockResolvedValue({
|
|
176
|
-
steps: [
|
|
177
|
-
{
|
|
178
|
-
type: 'transaction',
|
|
179
|
-
value: '1000000000000000000',
|
|
180
|
-
to: '0x123',
|
|
181
|
-
data: '0x456',
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
const marketplaceClientMock = {
|
|
187
|
-
generateBuyTransaction: generateBuyTransactionMock,
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
(
|
|
191
|
-
getMarketplaceClient as unknown as ReturnType<typeof vi.fn>
|
|
192
|
-
).mockReturnValue(marketplaceClientMock);
|
|
193
|
-
|
|
194
|
-
const { result } = renderHook(() => useBuyCollectable(defaultProps));
|
|
195
|
-
|
|
196
|
-
if (result.current.status === 'ready') {
|
|
197
|
-
await result.current.buy({
|
|
198
|
-
orderId: '1',
|
|
199
|
-
quantity: '1',
|
|
200
|
-
collectableDecimals: 18,
|
|
201
|
-
marketplace: MarketplaceKind.sequence_marketplace_v2,
|
|
202
|
-
checkoutOptions: {
|
|
203
|
-
swap: [],
|
|
204
|
-
nftCheckout: [],
|
|
205
|
-
onRamp: [],
|
|
206
|
-
crypto: TransactionCrypto.all,
|
|
207
|
-
},
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
expect(generateBuyTransactionMock).toHaveBeenCalledWith({
|
|
212
|
-
collectionAddress: defaultProps.collectionAddress,
|
|
213
|
-
buyer: '0x123',
|
|
214
|
-
marketplace: MarketplaceKind.sequence_marketplace_v2,
|
|
215
|
-
ordersData: [
|
|
216
|
-
{
|
|
217
|
-
orderId: '1',
|
|
218
|
-
quantity: '1',
|
|
219
|
-
},
|
|
220
|
-
],
|
|
221
|
-
additionalFees: [
|
|
222
|
-
{
|
|
223
|
-
amount: '250',
|
|
224
|
-
receiver: '0x123',
|
|
225
|
-
},
|
|
226
|
-
],
|
|
227
|
-
walletType: WalletKind.unknown,
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
expect(openSelectPaymentModalMock).toHaveBeenCalledWith({
|
|
231
|
-
chain: defaultProps.chainId,
|
|
232
|
-
collectibles: [
|
|
233
|
-
{
|
|
234
|
-
tokenId: defaultProps.tokenId,
|
|
235
|
-
quantity: '1',
|
|
236
|
-
decimals: 18,
|
|
237
|
-
},
|
|
238
|
-
],
|
|
239
|
-
currencyAddress: defaultProps.priceCurrencyAddress,
|
|
240
|
-
price: '1000000000000000000',
|
|
241
|
-
targetContractAddress: '0x123',
|
|
242
|
-
txData: '0x456',
|
|
243
|
-
collectionAddress: defaultProps.collectionAddress,
|
|
244
|
-
recipientAddress: '0x123',
|
|
245
|
-
enableMainCurrencyPayment: true,
|
|
246
|
-
enableSwapPayments: true,
|
|
247
|
-
creditCardProviders: [],
|
|
248
|
-
onSuccess: expect.any(Function),
|
|
249
|
-
onError: undefined,
|
|
250
|
-
onClose: expect.any(Function),
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
expect(defaultProps.setCheckoutModalIsLoading).toHaveBeenCalledWith(true);
|
|
254
|
-
expect(defaultProps.setCheckoutModalLoaded).toHaveBeenCalledWith(true);
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
it('should handle success callback', async () => {
|
|
258
|
-
(useWallet as unknown as ReturnType<typeof vi.fn>).mockReturnValue({
|
|
259
|
-
wallet: {
|
|
260
|
-
kind: WalletKind.sequence,
|
|
261
|
-
address: async () => '0x123',
|
|
262
|
-
chainId: '1',
|
|
263
|
-
},
|
|
264
|
-
isLoading: false,
|
|
265
|
-
isError: false,
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
const openSelectPaymentModalMock = vi.fn();
|
|
269
|
-
(
|
|
270
|
-
useSelectPaymentModal as unknown as ReturnType<typeof vi.fn>
|
|
271
|
-
).mockReturnValue({
|
|
272
|
-
openSelectPaymentModal: openSelectPaymentModalMock,
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
const generateBuyTransactionMock = vi.fn().mockResolvedValue({
|
|
276
|
-
steps: [
|
|
277
|
-
{
|
|
278
|
-
type: 'transaction',
|
|
279
|
-
value: '1000000000000000000',
|
|
280
|
-
to: '0x123',
|
|
281
|
-
data: '0x456',
|
|
282
|
-
},
|
|
283
|
-
],
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
const marketplaceClientMock = {
|
|
287
|
-
generateBuyTransaction: generateBuyTransactionMock,
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
(
|
|
291
|
-
getMarketplaceClient as unknown as ReturnType<typeof vi.fn>
|
|
292
|
-
).mockReturnValue(marketplaceClientMock);
|
|
293
|
-
|
|
294
|
-
const onSuccessMock = vi.fn();
|
|
295
|
-
const props = {
|
|
296
|
-
...defaultProps,
|
|
297
|
-
callbacks: {
|
|
298
|
-
onSuccess: onSuccessMock,
|
|
299
|
-
},
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
const { result } = renderHook(() => useBuyCollectable(props));
|
|
303
|
-
|
|
304
|
-
if (result.current.status === 'ready') {
|
|
305
|
-
await result.current.buy({
|
|
306
|
-
orderId: '1',
|
|
307
|
-
quantity: '1',
|
|
308
|
-
collectableDecimals: 18,
|
|
309
|
-
marketplace: MarketplaceKind.sequence_marketplace_v2,
|
|
310
|
-
checkoutOptions: {
|
|
311
|
-
swap: [],
|
|
312
|
-
nftCheckout: [],
|
|
313
|
-
onRamp: [],
|
|
314
|
-
crypto: TransactionCrypto.all,
|
|
315
|
-
},
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
const onSuccessCallback =
|
|
320
|
-
openSelectPaymentModalMock.mock.calls[0][0].onSuccess;
|
|
321
|
-
|
|
322
|
-
const txHash = '0x789';
|
|
323
|
-
await onSuccessCallback(txHash);
|
|
324
|
-
|
|
325
|
-
expect(onSuccessMock).toHaveBeenCalledWith({ hash: txHash });
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
it('should handle error callback', async () => {
|
|
329
|
-
// Mock useWallet to return a valid wallet
|
|
330
|
-
(useWallet as unknown as ReturnType<typeof vi.fn>).mockReturnValue({
|
|
331
|
-
wallet: {
|
|
332
|
-
kind: WalletKind.sequence,
|
|
333
|
-
address: async () => '0x123',
|
|
334
|
-
chainId: '1',
|
|
335
|
-
},
|
|
336
|
-
isLoading: false,
|
|
337
|
-
isError: false,
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
const openSelectPaymentModalMock = vi.fn();
|
|
341
|
-
(
|
|
342
|
-
useSelectPaymentModal as unknown as ReturnType<typeof vi.fn>
|
|
343
|
-
).mockReturnValue({
|
|
344
|
-
openSelectPaymentModal: openSelectPaymentModalMock,
|
|
345
|
-
});
|
|
346
|
-
|
|
347
|
-
const onErrorMock = vi.fn();
|
|
348
|
-
const props = {
|
|
349
|
-
...defaultProps,
|
|
350
|
-
callbacks: {
|
|
351
|
-
onError: onErrorMock,
|
|
352
|
-
},
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
const { result } = renderHook(() => useBuyCollectable(props));
|
|
356
|
-
|
|
357
|
-
if (result.current.status === 'ready') {
|
|
358
|
-
await result.current.buy({
|
|
359
|
-
orderId: '1',
|
|
360
|
-
quantity: '1',
|
|
361
|
-
collectableDecimals: 18,
|
|
362
|
-
marketplace: MarketplaceKind.sequence_marketplace_v2,
|
|
363
|
-
checkoutOptions: {
|
|
364
|
-
swap: [],
|
|
365
|
-
nftCheckout: [],
|
|
366
|
-
onRamp: [],
|
|
367
|
-
crypto: TransactionCrypto.all,
|
|
368
|
-
},
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
const onErrorCallback = openSelectPaymentModalMock.mock.calls[0][0].onError;
|
|
373
|
-
|
|
374
|
-
const error = new Error('Transaction failed');
|
|
375
|
-
onErrorCallback(error);
|
|
376
|
-
|
|
377
|
-
expect(onErrorMock).toHaveBeenCalledWith(error);
|
|
378
|
-
});
|
|
379
|
-
});
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChainId as ChainId$1 } from '@0xsequence/network';
|
|
2
|
-
import { z } from 'zod';
|
|
3
2
|
import { Chain } from 'viem';
|
|
3
|
+
import { z } from 'zod';
|
|
4
4
|
import { C as ContractType, O as OrderbookKind, M as MarketplaceKind, D as CreateReq } from './marketplace.gen-DLOcW6C4.js';
|
|
5
5
|
import { S as SdkConfig } from './sdk-config-Bs3H_le_.js';
|
|
6
6
|
import { g as MarketplaceConfig } from './builder-types-DgncJB3q.js';
|
|
File without changes
|