@0xsequence/marketplace-sdk 0.7.0 → 0.8.1
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/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.changeset/seven-doors-taste.md +5 -0
- package/CHANGELOG.md +13 -0
- package/dist/{chunk-MPBN3E54.js → chunk-2VHHJNXY.js} +3 -3
- package/dist/{chunk-FBUMNJQ4.js → chunk-3II5GLHE.js} +2 -2
- package/dist/chunk-3JU7SQVE.js +182 -0
- package/dist/chunk-3JU7SQVE.js.map +1 -0
- package/dist/{chunk-XTGMMNV5.js → chunk-A5ACY5YV.js} +2 -2
- package/dist/chunk-ABSYNRT5.js +128 -0
- package/dist/chunk-ABSYNRT5.js.map +1 -0
- package/dist/{chunk-XNA64MZQ.js → chunk-BCO4CYE4.js} +2 -2
- package/dist/{chunk-HTFORA4Q.js → chunk-BN36GABQ.js} +1883 -1010
- package/dist/chunk-BN36GABQ.js.map +1 -0
- package/dist/{chunk-4XK7XNJ7.js → chunk-BNAUZXPV.js} +73 -2
- package/dist/chunk-BNAUZXPV.js.map +1 -0
- package/dist/{chunk-Q5URKSC4.js → chunk-FMEEJFAF.js} +1 -1
- package/dist/{chunk-BBASZVT3.js → chunk-GBQVYNCD.js} +5 -6
- package/dist/chunk-GBQVYNCD.js.map +1 -0
- package/dist/{chunk-3AKOPSON.js → chunk-IZ44XPBH.js} +2 -9
- package/dist/chunk-IZ44XPBH.js.map +1 -0
- package/dist/{chunk-EAJ5K7QV.js → chunk-Q5RKAMYF.js} +3 -4
- package/dist/chunk-Q5RKAMYF.js.map +1 -0
- package/dist/{chunk-RBEPPVLT.js → chunk-X3QNSQER.js} +145 -355
- package/dist/chunk-X3QNSQER.js.map +1 -0
- package/dist/{index-CzTANLaA.d.ts → index-CnaFSNE9.d.ts} +6 -7
- package/dist/index.css +113 -31
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.js +4 -4
- package/dist/listCollectibles-B0tbqnRd.d.ts +155 -0
- package/dist/react/_internal/api/index.d.ts +28 -2
- package/dist/react/_internal/api/index.js +3 -1
- package/dist/react/_internal/databeat/index.js +10 -9
- package/dist/react/_internal/index.d.ts +2 -3
- package/dist/react/_internal/index.js +4 -4
- package/dist/react/_internal/wagmi/index.js +2 -2
- package/dist/react/hooks/index.d.ts +259 -674
- package/dist/react/hooks/index.js +11 -20
- package/dist/react/hooks/options/index.d.ts +1 -2
- package/dist/react/hooks/options/index.js +4 -4
- package/dist/react/index.d.ts +7 -7
- package/dist/react/index.js +15 -24
- package/dist/react/queries/index.d.ts +25 -0
- package/dist/react/queries/index.js +48 -0
- package/dist/react/queries/index.js.map +1 -0
- package/dist/react/ssr/index.js +3 -3
- package/dist/react/ui/components/collectible-card/index.d.ts +1 -6
- package/dist/react/ui/components/collectible-card/index.js +13 -12
- package/dist/react/ui/components/marketplace-logos/index.js +1 -1
- package/dist/react/ui/icons/index.js +6 -6
- package/dist/react/ui/index.d.ts +18 -22
- package/dist/react/ui/index.js +13 -12
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +6 -11
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +10 -9
- package/dist/types/index.js +2 -2
- package/dist/{types-Ct1uCT3M.d.ts → types-o_pKUpQG.d.ts} +2 -5
- package/dist/utils/index.d.ts +1 -5
- package/dist/utils/index.js +4 -4
- package/package.json +22 -16
- package/src/react/_internal/api/__mocks__/indexer.msw.ts +3 -1
- package/src/react/_internal/api/__mocks__/marketplace.msw.ts +1 -1
- package/src/react/_internal/api/__mocks__/metadata.msw.ts +14 -12
- package/src/react/_internal/api/index.ts +1 -0
- package/src/react/_internal/api/laos-api.ts +103 -0
- package/src/react/_internal/api/zod-schema.ts +3 -3
- package/src/react/_internal/types.ts +1 -10
- package/src/react/_internal/wallet/__tests__/wallet.test.ts +43 -0
- package/src/react/_internal/wallet/useWallet.ts +6 -3
- package/src/react/hooks/__tests__/useAutoSelectFeeOption.test.tsx +1 -1
- package/src/react/hooks/__tests__/useCancelOrder.test.tsx +1 -1
- package/src/react/hooks/__tests__/useCancelTransactionSteps.test.tsx +1 -1
- package/src/react/hooks/__tests__/useCollectible.test.tsx +2 -2
- package/src/react/hooks/__tests__/useCollection.test.tsx +2 -2
- package/src/react/hooks/__tests__/useComparePrices.test.tsx +1 -1
- package/src/react/hooks/__tests__/useConvertPriceToUSD.test.tsx +1 -1
- package/src/react/hooks/__tests__/useCountListingsForCollectible.test.tsx +1 -1
- package/src/react/hooks/__tests__/useCountOfCollectables.test.tsx +2 -2
- package/src/react/hooks/__tests__/useCountOffersForCollectible.test.tsx +1 -1
- package/src/react/hooks/__tests__/useCurrencies.test.tsx +2 -2
- package/src/react/hooks/__tests__/useCurrency.test.tsx +2 -2
- package/src/react/hooks/__tests__/useFilters.test.tsx +2 -2
- package/src/react/hooks/__tests__/useFloorOrder.test.tsx +2 -2
- package/src/react/hooks/__tests__/useGenerateCancelTransaction.test.tsx +1 -1
- package/src/react/hooks/__tests__/useGenerateListingTransaction.test.tsx +1 -1
- package/src/react/hooks/__tests__/useGenerateOfferTransaction.test.tsx +1 -1
- package/src/react/hooks/__tests__/useGenerateSellTransaction.test.tsx +1 -1
- package/src/react/hooks/__tests__/useListCollectibleActivities.test.tsx +2 -2
- package/src/react/hooks/__tests__/useListCollectibles.test.tsx +3 -2
- package/src/react/hooks/__tests__/useListCollectiblesPaginated.test.tsx +1 -1
- package/src/react/hooks/__tests__/useListCollectionActivities.test.tsx +1 -1
- package/src/react/hooks/__tests__/useListListingsForCollectible.test.tsx +1 -1
- package/src/react/hooks/__tests__/useListOffersForCollectible.test.tsx +1 -1
- package/src/react/hooks/__tests__/useLowestListing.test.tsx +1 -1
- package/src/react/hooks/__tests__/useRoyalty.test.tsx +1 -2
- package/src/react/hooks/index.ts +0 -1
- package/src/react/hooks/options/collectionOptions.ts +2 -3
- package/src/react/hooks/useAutoSelectFeeOption.tsx +1 -1
- package/src/react/hooks/useCancelOrder.tsx +3 -3
- package/src/react/hooks/useCancelTransactionSteps.tsx +1 -1
- package/src/react/hooks/useCheckoutOptions.tsx +1 -2
- package/src/react/hooks/useCollectible.tsx +2 -3
- package/src/react/hooks/useCollectionBalanceDetails.tsx +1 -2
- package/src/react/hooks/useComparePrices.tsx +2 -9
- package/src/react/hooks/useConvertPriceToUSD.tsx +1 -4
- package/src/react/hooks/useCountListingsForCollectible.tsx +1 -2
- package/src/react/hooks/useCountOfCollectables.tsx +1 -2
- package/src/react/hooks/useCountOffersForCollectible.tsx +1 -2
- package/src/react/hooks/useCurrencies.tsx +1 -4
- package/src/react/hooks/useCurrency.tsx +3 -8
- package/src/react/hooks/useFilters.tsx +5 -4
- package/src/react/hooks/useFloorOrder.tsx +1 -2
- package/src/react/hooks/useGenerateCancelTransaction.tsx +3 -6
- package/src/react/hooks/useGenerateListingTransaction.tsx +2 -3
- package/src/react/hooks/useGenerateOfferTransaction.tsx +2 -3
- package/src/react/hooks/useGenerateSellTransaction.tsx +3 -6
- package/src/react/hooks/useHighestOffer.tsx +1 -1
- package/src/react/hooks/useListCollectibles.tsx +33 -61
- package/src/react/hooks/useListCollectiblesPaginated.tsx +2 -6
- package/src/react/hooks/useListListingsForCollectible.tsx +1 -2
- package/src/react/hooks/useListOffersForCollectible.tsx +1 -2
- package/src/react/hooks/useLowestListing.tsx +1 -2
- package/src/react/hooks/useRoyalty.tsx +3 -8
- package/src/react/hooks/useTransferTokens.tsx +2 -2
- package/src/react/queries/balanceOfCollectible.ts +9 -32
- package/src/react/queries/getTokenSupplies.ts +38 -0
- package/src/react/queries/index.ts +5 -0
- package/src/react/queries/listCollectibles.ts +96 -0
- package/src/react/ui/components/_internals/action-button/ActionButton.tsx +1 -1
- package/src/react/ui/components/_internals/action-button/__tests__/ActionButton.test.tsx +1 -1
- package/src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx +4 -3
- package/src/react/ui/components/_internals/action-button/components/OwnerActions.tsx +1 -1
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +2 -3
- package/src/react/ui/components/collectible-card/__tests__/CollectibleCard.test.tsx +1 -1
- package/src/react/ui/modals/BuyModal/ERC1155QuantityModal.tsx +127 -0
- package/src/react/ui/modals/BuyModal/Modal.tsx +70 -85
- package/src/react/ui/modals/BuyModal/__tests__/Modal.test.tsx +85 -226
- package/src/react/ui/modals/BuyModal/__tests__/Modal1155.test.tsx +140 -0
- package/src/react/ui/modals/BuyModal/__tests__/store.test.ts +67 -76
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useCheckoutOptions.test.tsx +1 -60
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useFees.test.tsx +1 -1
- package/src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts +29 -13
- package/src/react/ui/modals/BuyModal/hooks/useLoadData.ts +26 -21
- package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +200 -0
- package/src/react/ui/modals/BuyModal/index.tsx +4 -14
- package/src/react/ui/modals/BuyModal/store.ts +71 -76
- package/src/react/ui/modals/CreateListingModal/Modal.tsx +71 -7
- package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +2 -2
- package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +1 -1
- package/src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts +1 -1
- package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +9 -5
- package/src/react/ui/modals/CreateListingModal/store.ts +7 -2
- package/src/react/ui/modals/MakeOfferModal/Modal.tsx +103 -6
- package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +1 -1
- package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +1 -1
- package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +1 -1
- package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +8 -4
- package/src/react/ui/modals/MakeOfferModal/store.ts +5 -3
- package/src/react/ui/modals/SellModal/Modal.tsx +76 -4
- package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +1 -1
- package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +1 -1
- package/src/react/ui/modals/SellModal/hooks/useSell.tsx +1 -1
- package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +16 -8
- package/src/react/ui/modals/SellModal/store.ts +5 -3
- package/src/react/ui/modals/TransferModal/_store.ts +15 -3
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/TokenQuantityInput.tsx +58 -0
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/TransferButton.tsx +56 -0
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/WalletAddressInput.tsx +50 -0
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +94 -66
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx +22 -14
- package/src/react/ui/modals/TransferModal/index.tsx +72 -38
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +43 -42
- package/src/react/ui/modals/_internal/components/actionModal/store.ts +1 -2
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +2 -2
- package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +9 -1
- package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +27 -12
- package/src/react/ui/modals/_internal/components/priceInput/__tests__/index.test.tsx +1 -1
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +19 -3
- package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +3 -0
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/_components/ActionButtons.tsx +60 -0
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/_components/BalanceIndicator.tsx +30 -0
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/index.tsx +126 -0
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/store.ts +25 -0
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/useWaasFeeOptionManager.tsx +74 -0
- package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +1 -2
- package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +1 -2
- package/src/react/ui/modals/_internal/components/tokenPreview/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transaction-footer/index.tsx +4 -7
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/TransactionStatusModal.test.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/hooks/useTransactionStatus.ts +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +6 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +2 -2
- package/src/react/ui/modals/_internal/components/waasFeeOptionsSelect/WaasFeeOptionsSelect.tsx +10 -31
- package/src/react/ui/modals/_internal/hooks/useSelectWaasFeeOptions.ts +53 -0
- package/src/react/ui/modals/_internal/types.ts +2 -1
- package/src/types/waas-types.ts +38 -0
- package/src/utils/network.ts +2 -4
- package/test/const.ts +1 -1
- package/test/setup.ts +10 -0
- package/test/test-utils.tsx +31 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/chunk-3AKOPSON.js.map +0 -1
- package/dist/chunk-4XK7XNJ7.js.map +0 -1
- package/dist/chunk-BBASZVT3.js.map +0 -1
- package/dist/chunk-EAJ5K7QV.js.map +0 -1
- package/dist/chunk-HTFORA4Q.js.map +0 -1
- package/dist/chunk-OFY7OFTL.js +0 -458
- package/dist/chunk-OFY7OFTL.js.map +0 -1
- package/dist/chunk-RBEPPVLT.js.map +0 -1
- package/src/react/hooks/__tests__/useGenerateBuyTransaction.test.tsx +0 -172
- package/src/react/hooks/useGenerateBuyTransaction.tsx +0 -80
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useBuyCollectable.test.tsx +0 -349
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useLoadData.test.tsx +0 -185
- package/src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts +0 -170
- package/src/react/ui/modals/BuyModal/modals/CheckoutModal.tsx +0 -47
- package/src/react/ui/modals/BuyModal/modals/Modal1155.tsx +0 -140
- package/src/react/ui/modals/BuyModal/modals/__tests__/CheckoutModal.test.tsx +0 -162
- package/src/react/ui/modals/BuyModal/modals/__tests__/Modal1155.test.tsx +0 -327
- package/src/react/ui/modals/_internal/components/waasFeeOptionsBox/index.tsx +0 -124
- package/src/react/ui/modals/_internal/components/waasFeeOptionsBox/store.ts +0 -12
- /package/dist/{chunk-MPBN3E54.js.map → chunk-2VHHJNXY.js.map} +0 -0
- /package/dist/{chunk-FBUMNJQ4.js.map → chunk-3II5GLHE.js.map} +0 -0
- /package/dist/{chunk-XTGMMNV5.js.map → chunk-A5ACY5YV.js.map} +0 -0
- /package/dist/{chunk-XNA64MZQ.js.map → chunk-BCO4CYE4.js.map} +0 -0
- /package/dist/{chunk-Q5URKSC4.js.map → chunk-FMEEJFAF.js.map} +0 -0
|
@@ -3,19 +3,20 @@ import {
|
|
|
3
3
|
closeModal,
|
|
4
4
|
createActionModalStore,
|
|
5
5
|
openModal
|
|
6
|
-
} from "../../../../../../chunk-
|
|
7
|
-
import "../../../../../../chunk-
|
|
8
|
-
import "../../../../../../chunk-
|
|
9
|
-
import "../../../../../../chunk-
|
|
6
|
+
} from "../../../../../../chunk-ABSYNRT5.js";
|
|
7
|
+
import "../../../../../../chunk-X3QNSQER.js";
|
|
8
|
+
import "../../../../../../chunk-GBQVYNCD.js";
|
|
9
|
+
import "../../../../../../chunk-3II5GLHE.js";
|
|
10
|
+
import "../../../../../../chunk-BCO4CYE4.js";
|
|
10
11
|
import "../../../../../../chunk-Y63BOO6M.js";
|
|
11
|
-
import "../../../../../../chunk-
|
|
12
|
-
import "../../../../../../chunk-
|
|
12
|
+
import "../../../../../../chunk-Q5RKAMYF.js";
|
|
13
|
+
import "../../../../../../chunk-FMEEJFAF.js";
|
|
13
14
|
import "../../../../../../chunk-UISBTKFF.js";
|
|
14
15
|
import "../../../../../../chunk-XX4EVWBF.js";
|
|
15
16
|
import "../../../../../../chunk-FUM4OGOQ.js";
|
|
16
|
-
import "../../../../../../chunk-
|
|
17
|
-
import "../../../../../../chunk-
|
|
18
|
-
import "../../../../../../chunk-
|
|
17
|
+
import "../../../../../../chunk-3JU7SQVE.js";
|
|
18
|
+
import "../../../../../../chunk-IZ44XPBH.js";
|
|
19
|
+
import "../../../../../../chunk-BNAUZXPV.js";
|
|
19
20
|
export {
|
|
20
21
|
ActionModal,
|
|
21
22
|
closeModal,
|
package/dist/types/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
FilterCondition,
|
|
3
3
|
MarketplaceType,
|
|
4
4
|
MarketplaceWallet
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-IZ44XPBH.js";
|
|
6
6
|
import {
|
|
7
7
|
CollectibleStatus,
|
|
8
8
|
CollectionStatus,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
StepType,
|
|
20
20
|
TransactionCrypto,
|
|
21
21
|
WalletKind
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-BNAUZXPV.js";
|
|
23
23
|
export {
|
|
24
24
|
CollectibleStatus,
|
|
25
25
|
CollectionStatus,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ChainId as ChainId$1 } from '@0xsequence/network';
|
|
2
1
|
import { Chain } from 'viem';
|
|
3
2
|
import { z } from 'zod';
|
|
4
3
|
import { C as ContractType, O as OrderbookKind, M as MarketplaceKind, D as CreateReq } from './marketplace.gen-BTHxxhG2.js';
|
|
@@ -14,9 +13,7 @@ declare const QueryArgSchema: z.ZodOptional<z.ZodObject<{
|
|
|
14
13
|
}>>;
|
|
15
14
|
type QueryArg = z.infer<typeof QueryArgSchema>;
|
|
16
15
|
declare const CollectableIdSchema: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
17
|
-
declare const ChainIdSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodNativeEnum<typeof ChainId$1>]>;
|
|
18
16
|
declare const AddressSchema: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
19
|
-
type ChainId = z.infer<typeof ChainIdSchema>;
|
|
20
17
|
type CollectionType = ContractType.ERC1155 | ContractType.ERC721;
|
|
21
18
|
type TransactionStep = {
|
|
22
19
|
exist: boolean;
|
|
@@ -37,7 +34,7 @@ declare enum TransactionType {
|
|
|
37
34
|
}
|
|
38
35
|
interface TransactionConfig {
|
|
39
36
|
type: TransactionType;
|
|
40
|
-
chainId:
|
|
37
|
+
chainId: number;
|
|
41
38
|
chains: readonly Chain[];
|
|
42
39
|
collectionAddress: string;
|
|
43
40
|
sdkConfig: SdkConfig;
|
|
@@ -68,4 +65,4 @@ interface CancelInput {
|
|
|
68
65
|
marketplace: MarketplaceKind;
|
|
69
66
|
}
|
|
70
67
|
|
|
71
|
-
export { AddressSchema as A, type BuyInput as B, CollectableIdSchema as C, type ListingInput as L, type OfferInput as O, QueryArgSchema as Q, type SellInput as S, type TransactionSteps as T, type QueryArg as a,
|
|
68
|
+
export { AddressSchema as A, type BuyInput as B, CollectableIdSchema as C, type ListingInput as L, type OfferInput as O, QueryArgSchema as Q, type SellInput as S, type TransactionSteps as T, type QueryArg as a, type CollectionType as b, TransactionType as c, type TransactionConfig as d, type CancelInput as e };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
export { EIP2981_ABI, SequenceMarketplaceV1_ABI, SequenceMarketplaceV2_ABI } from './abi/marketplace/index.js';
|
|
2
2
|
export { ERC1155_ABI, ERC20_ABI, ERC721_ABI } from './abi/token/index.js';
|
|
3
|
-
import { c as ChainId } from '../types-Ct1uCT3M.js';
|
|
4
3
|
import { Image } from '@0xsequence/design-system';
|
|
5
4
|
import { ComponentType } from 'react';
|
|
6
5
|
import { M as MarketplaceKind } from '../marketplace.gen-BTHxxhG2.js';
|
|
7
6
|
import { NetworkConfig } from '@0xsequence/network';
|
|
8
7
|
import { Chain } from 'viem';
|
|
9
8
|
import { ClassValue } from 'clsx';
|
|
10
|
-
import 'zod';
|
|
11
|
-
import '../sdk-config-DIzJk_tI.js';
|
|
12
|
-
import '../builder-types-QlHwc9bI.js';
|
|
13
9
|
|
|
14
10
|
declare const truncateMiddle: (address: string, minPrefix?: number, minSuffix?: number) => string;
|
|
15
11
|
declare const truncateEnd: (text: string | undefined, truncateAt: number) => string;
|
|
16
12
|
declare const compareAddress: (a?: string, b?: string) => boolean;
|
|
17
13
|
|
|
18
|
-
declare const getPresentableChainName: (chainId:
|
|
14
|
+
declare const getPresentableChainName: (chainId: number) => string;
|
|
19
15
|
|
|
20
16
|
type CalculatePriceDifferencePercentageArgs = {
|
|
21
17
|
inputPriceRaw: bigint;
|
package/dist/utils/index.js
CHANGED
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
networkToWagmiChain,
|
|
9
9
|
truncateEnd,
|
|
10
10
|
truncateMiddle
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import "../chunk-
|
|
11
|
+
} from "../chunk-Q5RKAMYF.js";
|
|
12
|
+
import "../chunk-FMEEJFAF.js";
|
|
13
13
|
import "../chunk-UISBTKFF.js";
|
|
14
14
|
import {
|
|
15
15
|
EIP2981_ABI,
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
ERC20_ABI,
|
|
22
22
|
ERC721_ABI
|
|
23
23
|
} from "../chunk-FUM4OGOQ.js";
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
24
|
+
import "../chunk-IZ44XPBH.js";
|
|
25
|
+
import "../chunk-BNAUZXPV.js";
|
|
26
26
|
export {
|
|
27
27
|
EIP2981_ABI,
|
|
28
28
|
ERC1155_ABI,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/marketplace-sdk",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"**/*.css"
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"types": "./dist/react/hooks/index.d.ts",
|
|
20
20
|
"default": "./dist/react/hooks/index.js"
|
|
21
21
|
},
|
|
22
|
+
"./react/queries": {
|
|
23
|
+
"types": "./dist/react/queries/index.d.ts",
|
|
24
|
+
"default": "./dist/react/queries/index.js"
|
|
25
|
+
},
|
|
22
26
|
"./react/ssr": {
|
|
23
27
|
"types": "./dist/react/ssr/index.d.ts",
|
|
24
28
|
"default": "./dist/react/ssr/index.js"
|
|
@@ -38,31 +42,33 @@
|
|
|
38
42
|
"@databeat/tracker": "^0.9.3",
|
|
39
43
|
"@legendapp/state": "^3.0.0-beta.30",
|
|
40
44
|
"@tailwindcss/postcss": "^4.0.15",
|
|
45
|
+
"@xstate/store": "^3.4.2",
|
|
41
46
|
"class-variance-authority": "^0.7.1",
|
|
42
47
|
"clsx": "^2.1.1",
|
|
43
48
|
"date-fns": "^4.1.0",
|
|
44
49
|
"dnum": "^2.14.0",
|
|
45
|
-
"react-day-picker": "^9.6.
|
|
50
|
+
"react-day-picker": "^9.6.4",
|
|
46
51
|
"tailwind-merge": "^3.0.2",
|
|
47
52
|
"zod": "^3.24.2"
|
|
48
53
|
},
|
|
49
54
|
"peerDependencies": {
|
|
50
|
-
"0xsequence": "^2.
|
|
51
|
-
"@0xsequence/api": "^2.
|
|
52
|
-
"@0xsequence/checkout": "^5.0.
|
|
53
|
-
"@0xsequence/connect": "^5.0.
|
|
54
|
-
"@0xsequence/design-system": "^2.
|
|
55
|
-
"@0xsequence/indexer": "^2.
|
|
56
|
-
"@0xsequence/metadata": "^2.
|
|
57
|
-
"@0xsequence/network": "^2.
|
|
58
|
-
"@tanstack/react-query": "^5.
|
|
59
|
-
"react": "^19.
|
|
60
|
-
"react-dom": "^19.
|
|
61
|
-
"viem": "^2.
|
|
62
|
-
"wagmi": "^2.14.
|
|
55
|
+
"0xsequence": "^2.3.4",
|
|
56
|
+
"@0xsequence/api": "^2.3.4",
|
|
57
|
+
"@0xsequence/checkout": "^5.0.8",
|
|
58
|
+
"@0xsequence/connect": "^5.0.8",
|
|
59
|
+
"@0xsequence/design-system": "^2.1.5",
|
|
60
|
+
"@0xsequence/indexer": "^2.3.4",
|
|
61
|
+
"@0xsequence/metadata": "^2.3.4",
|
|
62
|
+
"@0xsequence/network": "^2.3.4",
|
|
63
|
+
"@tanstack/react-query": "^5.71.1",
|
|
64
|
+
"react": "^19.1.0",
|
|
65
|
+
"react-dom": "^19.1.0",
|
|
66
|
+
"viem": "^2.24.3",
|
|
67
|
+
"wagmi": "^2.14.16"
|
|
63
68
|
},
|
|
64
69
|
"devDependencies": {
|
|
65
70
|
"@biomejs/biome": "^1.9.4",
|
|
71
|
+
"@changesets/cli": "^2.28.1",
|
|
66
72
|
"@eslint/js": "^9.23.0",
|
|
67
73
|
"@testing-library/jest-dom": "6.4.7",
|
|
68
74
|
"@testing-library/react": "^16.2.0",
|
|
@@ -81,7 +87,7 @@
|
|
|
81
87
|
"msw": "^2.7.3",
|
|
82
88
|
"postcss": "^8.5.3",
|
|
83
89
|
"prool": "^0.0.23",
|
|
84
|
-
"tailwindcss": "^4.0.
|
|
90
|
+
"tailwindcss": "^4.0.17",
|
|
85
91
|
"tsup": "^8.4.0",
|
|
86
92
|
"typescript": "^5.8.2",
|
|
87
93
|
"typescript-eslint": "^8.27.0",
|
|
@@ -24,6 +24,7 @@ export const mockTokenMetadata: TokenMetadata = {
|
|
|
24
24
|
status: ResourceStatus.AVAILABLE,
|
|
25
25
|
description: 'A mock NFT for testing',
|
|
26
26
|
image: 'https://example.com/nft.png',
|
|
27
|
+
source: '',
|
|
27
28
|
properties: {
|
|
28
29
|
series: 'Mock Series',
|
|
29
30
|
edition: 1,
|
|
@@ -40,7 +41,6 @@ export const mockContractInfo: ContractInfo = {
|
|
|
40
41
|
name: 'Mock Contract',
|
|
41
42
|
type: ContractType.ERC721,
|
|
42
43
|
symbol: 'MOCK',
|
|
43
|
-
notFound: false,
|
|
44
44
|
status: ResourceStatus.AVAILABLE,
|
|
45
45
|
decimals: 18,
|
|
46
46
|
logoURI: 'https://example.com/logo.png',
|
|
@@ -58,8 +58,10 @@ export const mockContractInfo: ContractInfo = {
|
|
|
58
58
|
verified: true,
|
|
59
59
|
verifiedBy: '0x',
|
|
60
60
|
featured: true,
|
|
61
|
+
featureIndex: 0,
|
|
61
62
|
},
|
|
62
63
|
updatedAt: new Date().toISOString(),
|
|
64
|
+
source: '',
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
export const mockTokenBalance: TokenBalance = {
|
|
@@ -74,7 +74,7 @@ export const mockOrder: Order = {
|
|
|
74
74
|
chainId: 1,
|
|
75
75
|
originName: 'Sequence',
|
|
76
76
|
collectionContractAddress: '0x1234567890123456789012345678901234567890',
|
|
77
|
-
tokenId: '1',
|
|
77
|
+
// tokenId: '1', // TokenID is optional, so no part of the code should fail if it's not provided
|
|
78
78
|
createdBy: '0xabcdef0123456789abcdef0123456789abcdef01',
|
|
79
79
|
priceAmount: '1000000000000000000',
|
|
80
80
|
priceAmountFormatted: '1.0',
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type ContractInfo,
|
|
3
|
+
type Metadata,
|
|
4
|
+
type PropertyFilter,
|
|
3
5
|
PropertyType,
|
|
4
6
|
ResourceStatus,
|
|
7
|
+
type TokenMetadata,
|
|
5
8
|
} from '@0xsequence/metadata';
|
|
6
9
|
import { http, HttpResponse } from 'msw';
|
|
7
10
|
import { zeroAddress } from 'viem';
|
|
8
|
-
import type { PropertyFilter, TokenMetadata } from '../marketplace.gen';
|
|
9
11
|
|
|
10
12
|
// Debug configuration
|
|
11
13
|
export let isDebugEnabled = false;
|
|
@@ -33,7 +35,6 @@ export const mockContractInfo: ContractInfo = {
|
|
|
33
35
|
name: 'Mock Collection',
|
|
34
36
|
symbol: 'MOCK',
|
|
35
37
|
source: 'https://example.com/source',
|
|
36
|
-
notFound: false,
|
|
37
38
|
status: ResourceStatus.AVAILABLE,
|
|
38
39
|
type: 'ERC721',
|
|
39
40
|
deployed: true,
|
|
@@ -51,6 +52,7 @@ export const mockContractInfo: ContractInfo = {
|
|
|
51
52
|
blacklist: false,
|
|
52
53
|
verifiedBy: '0x',
|
|
53
54
|
featured: true,
|
|
55
|
+
featureIndex: 0,
|
|
54
56
|
},
|
|
55
57
|
logoURI: 'https://example.com/logo.png',
|
|
56
58
|
};
|
|
@@ -91,6 +93,8 @@ export const mockTokenMetadata: TokenMetadata = {
|
|
|
91
93
|
updatedAt: new Date().toISOString(),
|
|
92
94
|
},
|
|
93
95
|
],
|
|
96
|
+
source: '',
|
|
97
|
+
status: ResourceStatus.NOT_AVAILABLE,
|
|
94
98
|
};
|
|
95
99
|
|
|
96
100
|
export const mockPropertyFilters: PropertyFilter[] = [
|
|
@@ -120,19 +124,17 @@ export const mockFilters = [
|
|
|
120
124
|
},
|
|
121
125
|
];
|
|
122
126
|
|
|
123
|
-
type Endpoint =
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
| 'GetContractInfoBatch';
|
|
127
|
+
type Endpoint = Capitalize<keyof Metadata>;
|
|
128
|
+
type EndpointReturn<E extends Endpoint> = Awaited<
|
|
129
|
+
ReturnType<Metadata[Uncapitalize<E>]>
|
|
130
|
+
>;
|
|
128
131
|
|
|
129
132
|
export const mockMetadataEndpoint = (endpoint: Endpoint) =>
|
|
130
133
|
`*/rpc/Metadata/${endpoint}`;
|
|
131
134
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
response: T,
|
|
135
|
+
export const mockMetadataHandler = <E extends Endpoint>(
|
|
136
|
+
endpoint: E,
|
|
137
|
+
response: EndpointReturn<E>,
|
|
136
138
|
) => {
|
|
137
139
|
return http.post(mockMetadataEndpoint(endpoint), (request) => {
|
|
138
140
|
debugLog(endpoint, request, response);
|
|
@@ -150,7 +152,7 @@ export const handlers = [
|
|
|
150
152
|
tokenMetadata: [mockTokenMetadata],
|
|
151
153
|
}),
|
|
152
154
|
|
|
153
|
-
mockMetadataHandler('
|
|
155
|
+
mockMetadataHandler('GetTokenMetadataPropertyFilters', {
|
|
154
156
|
filters: mockPropertyFilters,
|
|
155
157
|
}),
|
|
156
158
|
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
GetTokenBalancesReturn,
|
|
3
|
+
GetTokenSuppliesReturn,
|
|
4
|
+
} from '@0xsequence/indexer';
|
|
5
|
+
|
|
6
|
+
export type SortOption = {
|
|
7
|
+
column: string;
|
|
8
|
+
order: 'ASC' | 'DESC';
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type PaginationOptions = {
|
|
12
|
+
sort: SortOption[];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type TokenSuppliesParams = {
|
|
16
|
+
chainId: string;
|
|
17
|
+
contractAddress: string;
|
|
18
|
+
includeMetadata?: boolean;
|
|
19
|
+
page?: PaginationOptions;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type TokenBalancesParams = {
|
|
23
|
+
chainId: string;
|
|
24
|
+
accountAddress: string;
|
|
25
|
+
includeMetadata?: boolean;
|
|
26
|
+
page?: PaginationOptions;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export class LaosAPI {
|
|
30
|
+
private baseUrl = 'https://extensions.api.laosnetwork.io';
|
|
31
|
+
|
|
32
|
+
constructor(baseUrl?: string) {
|
|
33
|
+
if (baseUrl) {
|
|
34
|
+
this.baseUrl = baseUrl;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async getTokenSupplies({
|
|
39
|
+
chainId,
|
|
40
|
+
contractAddress,
|
|
41
|
+
includeMetadata = true,
|
|
42
|
+
page = {
|
|
43
|
+
sort: [
|
|
44
|
+
{
|
|
45
|
+
column: 'CREATED_AT',
|
|
46
|
+
order: 'DESC',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
}: TokenSuppliesParams): Promise<GetTokenSuppliesReturn> {
|
|
51
|
+
const response = await fetch(`${this.baseUrl}/token/GetTokenSupplies`, {
|
|
52
|
+
method: 'POST',
|
|
53
|
+
headers: {
|
|
54
|
+
'Content-Type': 'application/json',
|
|
55
|
+
},
|
|
56
|
+
body: JSON.stringify({
|
|
57
|
+
chainId,
|
|
58
|
+
contractAddress,
|
|
59
|
+
includeMetadata,
|
|
60
|
+
page,
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (!response.ok) {
|
|
65
|
+
throw new Error(`Failed to get token supplies: ${response.statusText}`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return await response.json();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async getTokenBalances({
|
|
72
|
+
chainId,
|
|
73
|
+
accountAddress,
|
|
74
|
+
includeMetadata = true,
|
|
75
|
+
page = {
|
|
76
|
+
sort: [
|
|
77
|
+
{
|
|
78
|
+
column: 'CREATED_AT',
|
|
79
|
+
order: 'DESC',
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
}: TokenBalancesParams): Promise<GetTokenBalancesReturn> {
|
|
84
|
+
const response = await fetch(`${this.baseUrl}/token/GetTokenBalances`, {
|
|
85
|
+
method: 'POST',
|
|
86
|
+
headers: {
|
|
87
|
+
'Content-Type': 'application/json',
|
|
88
|
+
},
|
|
89
|
+
body: JSON.stringify({
|
|
90
|
+
chainId,
|
|
91
|
+
accountAddress,
|
|
92
|
+
includeMetadata,
|
|
93
|
+
page,
|
|
94
|
+
}),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
if (!response.ok) {
|
|
98
|
+
throw new Error(`Failed to get token balances: ${response.statusText}`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return await response.json();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
//
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import {
|
|
5
|
+
import { CollectableIdSchema } from '../types';
|
|
6
6
|
import { AddressSchema } from '../types';
|
|
7
7
|
import {
|
|
8
8
|
CollectibleStatus,
|
|
@@ -524,7 +524,7 @@ export const listOffersForCollectibleReturnSchema = z.object({
|
|
|
524
524
|
});
|
|
525
525
|
|
|
526
526
|
export const getListCollectibleActivitiesArgsSchema = z.object({
|
|
527
|
-
chainId:
|
|
527
|
+
chainId: z.number(),
|
|
528
528
|
collectionAddress: AddressSchema,
|
|
529
529
|
tokenId: CollectableIdSchema.pipe(z.coerce.string()),
|
|
530
530
|
query: pageSchema
|
|
@@ -540,7 +540,7 @@ export const getListCollectibleActivitiesReturnSchema = z.object({
|
|
|
540
540
|
});
|
|
541
541
|
|
|
542
542
|
export const getListCollectionActivitiesArgsSchema = z.object({
|
|
543
|
-
chainId:
|
|
543
|
+
chainId: z.number(),
|
|
544
544
|
collectionAddress: AddressSchema,
|
|
545
545
|
query: pageSchema
|
|
546
546
|
.extend({
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ChainId as NetworkChainId } from '@0xsequence/network';
|
|
2
1
|
import type { Address } from 'viem';
|
|
3
2
|
import type { Chain } from 'viem';
|
|
4
3
|
import { z } from 'zod';
|
|
@@ -16,12 +15,6 @@ export type QueryArg = z.infer<typeof QueryArgSchema>;
|
|
|
16
15
|
|
|
17
16
|
export const CollectableIdSchema = z.string().or(z.number());
|
|
18
17
|
|
|
19
|
-
export const ChainIdSchema = z.union([
|
|
20
|
-
z.string(),
|
|
21
|
-
z.number(),
|
|
22
|
-
z.nativeEnum(NetworkChainId),
|
|
23
|
-
]);
|
|
24
|
-
|
|
25
18
|
export const AddressSchema = z.string().transform((val, ctx) => {
|
|
26
19
|
const regex = /^0x[a-fA-F0-9]{40}$/;
|
|
27
20
|
|
|
@@ -35,8 +28,6 @@ export const AddressSchema = z.string().transform((val, ctx) => {
|
|
|
35
28
|
return val as Address;
|
|
36
29
|
});
|
|
37
30
|
|
|
38
|
-
export type ChainId = z.infer<typeof ChainIdSchema>;
|
|
39
|
-
|
|
40
31
|
export type CollectionType = ContractType.ERC1155 | ContractType.ERC721;
|
|
41
32
|
|
|
42
33
|
type TransactionStep = {
|
|
@@ -61,7 +52,7 @@ export enum TransactionType {
|
|
|
61
52
|
|
|
62
53
|
export interface TransactionConfig {
|
|
63
54
|
type: TransactionType;
|
|
64
|
-
chainId:
|
|
55
|
+
chainId: number;
|
|
65
56
|
chains: readonly Chain[];
|
|
66
57
|
collectionAddress: string;
|
|
67
58
|
sdkConfig: SdkConfig;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ResourceStatus } from '@0xsequence/metadata';
|
|
1
2
|
import { server } from '@test';
|
|
2
3
|
import {
|
|
3
4
|
type Account,
|
|
@@ -218,6 +219,27 @@ describe('wallet', () => {
|
|
|
218
219
|
chainId: mockEip712Step.signature.domain.chainId,
|
|
219
220
|
name: mockEip712Step.signature.domain.name,
|
|
220
221
|
type: 'ERC721',
|
|
222
|
+
source: '',
|
|
223
|
+
symbol: '',
|
|
224
|
+
logoURI: '',
|
|
225
|
+
deployed: false,
|
|
226
|
+
bytecodeHash: '',
|
|
227
|
+
extensions: {
|
|
228
|
+
link: '',
|
|
229
|
+
description: '',
|
|
230
|
+
categories: [],
|
|
231
|
+
ogImage: '',
|
|
232
|
+
ogName: '',
|
|
233
|
+
originChainId: 0,
|
|
234
|
+
originAddress: '',
|
|
235
|
+
blacklist: false,
|
|
236
|
+
verified: false,
|
|
237
|
+
verifiedBy: '',
|
|
238
|
+
featured: false,
|
|
239
|
+
featureIndex: 0,
|
|
240
|
+
},
|
|
241
|
+
updatedAt: '',
|
|
242
|
+
status: ResourceStatus.NOT_AVAILABLE,
|
|
221
243
|
},
|
|
222
244
|
}),
|
|
223
245
|
);
|
|
@@ -317,6 +339,27 @@ describe('wallet', () => {
|
|
|
317
339
|
chainId: 1,
|
|
318
340
|
name: 'Test Contract',
|
|
319
341
|
type: 'ERC721',
|
|
342
|
+
source: '',
|
|
343
|
+
symbol: '',
|
|
344
|
+
logoURI: '',
|
|
345
|
+
deployed: false,
|
|
346
|
+
bytecodeHash: '',
|
|
347
|
+
extensions: {
|
|
348
|
+
link: '',
|
|
349
|
+
description: '',
|
|
350
|
+
categories: [],
|
|
351
|
+
ogImage: '',
|
|
352
|
+
ogName: '',
|
|
353
|
+
originChainId: 0,
|
|
354
|
+
originAddress: '',
|
|
355
|
+
blacklist: false,
|
|
356
|
+
verified: false,
|
|
357
|
+
verifiedBy: '',
|
|
358
|
+
featured: false,
|
|
359
|
+
featureIndex: 0,
|
|
360
|
+
},
|
|
361
|
+
updatedAt: '',
|
|
362
|
+
status: ResourceStatus.AVAILABLE,
|
|
320
363
|
},
|
|
321
364
|
}),
|
|
322
365
|
);
|
|
@@ -17,8 +17,11 @@ type UseWalletReturn = {
|
|
|
17
17
|
|
|
18
18
|
export const useWallet = (): UseWalletReturn => {
|
|
19
19
|
const { chains } = useSwitchChain();
|
|
20
|
-
const {
|
|
21
|
-
|
|
20
|
+
const {
|
|
21
|
+
data: walletClient,
|
|
22
|
+
isLoading: wagmiWalletIsLoading,
|
|
23
|
+
isError: wagmiWalletIsError,
|
|
24
|
+
} = useWalletClient();
|
|
22
25
|
const { connector, isConnected, isConnecting } = useAccount();
|
|
23
26
|
const sdkConfig = useConfig();
|
|
24
27
|
const chainId = useChainId();
|
|
@@ -44,6 +47,6 @@ export const useWallet = (): UseWalletReturn => {
|
|
|
44
47
|
return {
|
|
45
48
|
wallet: data,
|
|
46
49
|
isLoading: isLoading || isConnecting || wagmiWalletIsLoading,
|
|
47
|
-
isError,
|
|
50
|
+
isError: isError || wagmiWalletIsError,
|
|
48
51
|
};
|
|
49
52
|
};
|
|
@@ -5,12 +5,12 @@ import { zeroAddress } from 'viem';
|
|
|
5
5
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
6
6
|
import { useAccount } from 'wagmi';
|
|
7
7
|
import { mainnet } from 'wagmi/chains';
|
|
8
|
+
import type { FeeOption } from '../../../types/waas-types';
|
|
8
9
|
import {
|
|
9
10
|
mockIndexerEndpoint,
|
|
10
11
|
mockIndexerHandler,
|
|
11
12
|
mockTokenBalance,
|
|
12
13
|
} from '../../_internal/api/__mocks__/indexer.msw';
|
|
13
|
-
import type { FeeOption } from '../../ui/modals/_internal/components/waasFeeOptionsSelect/WaasFeeOptionsSelect';
|
|
14
14
|
import { useAutoSelectFeeOption } from '../useAutoSelectFeeOption';
|
|
15
15
|
|
|
16
16
|
// Mock wagmi hooks
|
|
@@ -17,7 +17,7 @@ vi.mock('../../_internal/wallet/useWallet');
|
|
|
17
17
|
describe('useCancelOrder', () => {
|
|
18
18
|
const defaultProps = {
|
|
19
19
|
collectionAddress: '0x1234567890123456789012345678901234567890',
|
|
20
|
-
chainId:
|
|
20
|
+
chainId: 1,
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const mockOrderId = '0x9876543210987654321098765432109876543210';
|
|
@@ -11,7 +11,7 @@ import { useCollectible } from '../useCollectible';
|
|
|
11
11
|
|
|
12
12
|
describe('useCollectible', () => {
|
|
13
13
|
const defaultArgs: UseCollectibleArgs = {
|
|
14
|
-
chainId:
|
|
14
|
+
chainId: 1,
|
|
15
15
|
collectionAddress: zeroAddress,
|
|
16
16
|
collectibleId: '1',
|
|
17
17
|
query: {},
|
|
@@ -85,7 +85,7 @@ describe('useCollectible', () => {
|
|
|
85
85
|
|
|
86
86
|
it('should handle undefined query params', async () => {
|
|
87
87
|
const argsWithoutQuery: UseCollectibleArgs = {
|
|
88
|
-
chainId:
|
|
88
|
+
chainId: 1,
|
|
89
89
|
collectionAddress: zeroAddress,
|
|
90
90
|
collectibleId: '1',
|
|
91
91
|
query: {},
|
|
@@ -11,7 +11,7 @@ import { useCollection } from '../useCollection';
|
|
|
11
11
|
|
|
12
12
|
describe('useCollection', () => {
|
|
13
13
|
const defaultArgs: UseCollectionArgs = {
|
|
14
|
-
chainId:
|
|
14
|
+
chainId: 1,
|
|
15
15
|
collectionAddress: zeroAddress,
|
|
16
16
|
query: {},
|
|
17
17
|
};
|
|
@@ -83,7 +83,7 @@ describe('useCollection', () => {
|
|
|
83
83
|
|
|
84
84
|
it('should handle undefined query params', async () => {
|
|
85
85
|
const argsWithoutQuery: UseCollectionArgs = {
|
|
86
|
-
chainId:
|
|
86
|
+
chainId: 1,
|
|
87
87
|
collectionAddress: zeroAddress,
|
|
88
88
|
query: {},
|
|
89
89
|
};
|
|
@@ -10,7 +10,7 @@ import { useComparePrices } from '../useComparePrices';
|
|
|
10
10
|
|
|
11
11
|
describe('useComparePrices', () => {
|
|
12
12
|
const defaultArgs = {
|
|
13
|
-
chainId:
|
|
13
|
+
chainId: 1,
|
|
14
14
|
priceAmountRaw: '1000000000000000000', // 1 ETH
|
|
15
15
|
priceCurrencyAddress: zeroAddress,
|
|
16
16
|
compareToPriceAmountRaw: '1000000', // 1 USDC (6 decimals)
|
|
@@ -11,7 +11,7 @@ import { useConvertPriceToUSD } from '../useConvertPriceToUSD';
|
|
|
11
11
|
|
|
12
12
|
describe('useConvertPriceToUSD', () => {
|
|
13
13
|
const defaultArgs: UseConvertPriceToUSDArgs = {
|
|
14
|
-
chainId:
|
|
14
|
+
chainId: 1,
|
|
15
15
|
currencyAddress: zeroAddress,
|
|
16
16
|
amountRaw: '1000000000000000000', // 1 ETH
|
|
17
17
|
query: {},
|