@0xsequence/marketplace-sdk 0.3.6 → 0.3.7

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.
@@ -14,6 +14,12 @@ import {
14
14
  getPresentableChainName,
15
15
  getPublicRpcClient
16
16
  } from "./chunk-OUZ42I6B.js";
17
+ import {
18
+ ERC1155_ABI
19
+ } from "./chunk-WFE6OCYF.js";
20
+ import {
21
+ EIP2981_ABI
22
+ } from "./chunk-3OHM45R3.js";
17
23
  import {
18
24
  AddressSchema,
19
25
  ChainIdSchema,
@@ -79,12 +85,6 @@ import {
79
85
  UnexpectedStepsError,
80
86
  UnknownTransactionTypeError
81
87
  } from "./chunk-T2AMWIKD.js";
82
- import {
83
- EIP2981_ABI
84
- } from "./chunk-3OHM45R3.js";
85
- import {
86
- ERC1155_ABI
87
- } from "./chunk-WFE6OCYF.js";
88
88
 
89
89
  // src/react/hooks/useBalanceOfCollectible.tsx
90
90
  import { queryOptions, skipToken, useQuery } from "@tanstack/react-query";
@@ -2395,4 +2395,4 @@ export {
2395
2395
  useCancelOrder,
2396
2396
  useBuyCollectable
2397
2397
  };
2398
- //# sourceMappingURL=chunk-Z3VR2KMP.js.map
2398
+ //# sourceMappingURL=chunk-QGELCUYG.js.map
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use client"
2
+ import "./chunk-MJ4YU7RW.js";
2
3
  import {
3
4
  calculatePriceDifferencePercentage,
4
5
  compareAddress,
@@ -7,7 +8,17 @@ import {
7
8
  truncateEnd,
8
9
  truncateMiddle
9
10
  } from "./chunk-OUZ42I6B.js";
10
- import "./chunk-MJ4YU7RW.js";
11
+ import "./chunk-MCI3KOSQ.js";
12
+ import {
13
+ ERC1155_ABI,
14
+ ERC20_ABI,
15
+ ERC721_ABI
16
+ } from "./chunk-WFE6OCYF.js";
17
+ import {
18
+ EIP2981_ABI,
19
+ SequenceMarketplaceV1_ABI,
20
+ SequenceMarketplaceV2_ABI
21
+ } from "./chunk-3OHM45R3.js";
11
22
  import "./chunk-Q2BVDQ3G.js";
12
23
  import {
13
24
  CollectibleStatus,
@@ -28,17 +39,6 @@ import {
28
39
  } from "./chunk-D3HRXVYJ.js";
29
40
  import "./chunk-3CXEYH2I.js";
30
41
  import "./chunk-T2AMWIKD.js";
31
- import "./chunk-MCI3KOSQ.js";
32
- import {
33
- EIP2981_ABI,
34
- SequenceMarketplaceV1_ABI,
35
- SequenceMarketplaceV2_ABI
36
- } from "./chunk-3OHM45R3.js";
37
- import {
38
- ERC1155_ABI,
39
- ERC20_ABI,
40
- ERC721_ABI
41
- } from "./chunk-WFE6OCYF.js";
42
42
 
43
43
  // src/consts.ts
44
44
  var SEQUENCE_MARKET_V1_ADDRESS = "0xB537a160472183f2150d42EB1c3DD6684A55f74c";
@@ -58,20 +58,20 @@ import {
58
58
  useMarketplaceConfig,
59
59
  useRoyaltyPercentage,
60
60
  useTransferTokens
61
- } from "../../chunk-Z3VR2KMP.js";
61
+ } from "../../chunk-QGELCUYG.js";
62
62
  import "../../chunk-Y7YO5TLE.js";
63
63
  import "../../chunk-7NJETFMF.js";
64
64
  import "../../chunk-SBVLWSRZ.js";
65
65
  import "../../chunk-NJ2GXOPW.js";
66
- import "../../chunk-OUZ42I6B.js";
67
66
  import "../../chunk-MJ4YU7RW.js";
67
+ import "../../chunk-OUZ42I6B.js";
68
+ import "../../chunk-MCI3KOSQ.js";
69
+ import "../../chunk-WFE6OCYF.js";
70
+ import "../../chunk-3OHM45R3.js";
68
71
  import "../../chunk-Q2BVDQ3G.js";
69
72
  import "../../chunk-D3HRXVYJ.js";
70
73
  import "../../chunk-3CXEYH2I.js";
71
74
  import "../../chunk-T2AMWIKD.js";
72
- import "../../chunk-MCI3KOSQ.js";
73
- import "../../chunk-3OHM45R3.js";
74
- import "../../chunk-WFE6OCYF.js";
75
75
  export {
76
76
  UseGenerateBuyTransactionArgsSchema,
77
77
  balanceOfCollectibleOptions,
@@ -8,10 +8,10 @@ import {
8
8
  useSellModal,
9
9
  useSuccessfulPurchaseModal,
10
10
  useTransferModal
11
- } from "../chunk-F42XMKDS.js";
11
+ } from "../chunk-3LGNSRBR.js";
12
12
  import "../chunk-NMCGA2TB.js";
13
13
  import "../chunk-FFCNYF3S.js";
14
- import "../chunk-RZSZNVEH.js";
14
+ import "../chunk-L6GSYPCR.js";
15
15
  import "../chunk-O642NH7U.js";
16
16
  import {
17
17
  MarketplaceProvider,
@@ -74,13 +74,16 @@ import {
74
74
  useMarketplaceConfig,
75
75
  useRoyaltyPercentage,
76
76
  useTransferTokens
77
- } from "../chunk-Z3VR2KMP.js";
77
+ } from "../chunk-QGELCUYG.js";
78
78
  import "../chunk-Y7YO5TLE.js";
79
79
  import "../chunk-7NJETFMF.js";
80
80
  import "../chunk-SBVLWSRZ.js";
81
81
  import "../chunk-NJ2GXOPW.js";
82
- import "../chunk-OUZ42I6B.js";
83
82
  import "../chunk-MJ4YU7RW.js";
83
+ import "../chunk-OUZ42I6B.js";
84
+ import "../chunk-MCI3KOSQ.js";
85
+ import "../chunk-WFE6OCYF.js";
86
+ import "../chunk-3OHM45R3.js";
84
87
  import "../chunk-Q2BVDQ3G.js";
85
88
  import {
86
89
  getQueryClient
@@ -89,9 +92,6 @@ import {
89
92
  createWagmiConfig
90
93
  } from "../chunk-3CXEYH2I.js";
91
94
  import "../chunk-T2AMWIKD.js";
92
- import "../chunk-MCI3KOSQ.js";
93
- import "../chunk-3OHM45R3.js";
94
- import "../chunk-WFE6OCYF.js";
95
95
  export {
96
96
  CollectibleCard,
97
97
  MarketplaceProvider,
@@ -1,25 +1,25 @@
1
1
  "use client"
2
2
  import {
3
3
  CollectibleCard
4
- } from "../../../chunk-F42XMKDS.js";
4
+ } from "../../../chunk-3LGNSRBR.js";
5
5
  import "../../../chunk-NMCGA2TB.js";
6
6
  import "../../../chunk-FFCNYF3S.js";
7
- import "../../../chunk-RZSZNVEH.js";
7
+ import "../../../chunk-L6GSYPCR.js";
8
8
  import "../../../chunk-O642NH7U.js";
9
- import "../../../chunk-Z3VR2KMP.js";
9
+ import "../../../chunk-QGELCUYG.js";
10
10
  import "../../../chunk-Y7YO5TLE.js";
11
11
  import "../../../chunk-7NJETFMF.js";
12
12
  import "../../../chunk-SBVLWSRZ.js";
13
13
  import "../../../chunk-NJ2GXOPW.js";
14
- import "../../../chunk-OUZ42I6B.js";
15
14
  import "../../../chunk-MJ4YU7RW.js";
15
+ import "../../../chunk-OUZ42I6B.js";
16
+ import "../../../chunk-MCI3KOSQ.js";
17
+ import "../../../chunk-WFE6OCYF.js";
18
+ import "../../../chunk-3OHM45R3.js";
16
19
  import "../../../chunk-Q2BVDQ3G.js";
17
20
  import "../../../chunk-D3HRXVYJ.js";
18
21
  import "../../../chunk-3CXEYH2I.js";
19
22
  import "../../../chunk-T2AMWIKD.js";
20
- import "../../../chunk-MCI3KOSQ.js";
21
- import "../../../chunk-3OHM45R3.js";
22
- import "../../../chunk-WFE6OCYF.js";
23
23
  export {
24
24
  CollectibleCard
25
25
  };
@@ -8,25 +8,25 @@ import {
8
8
  useSellModal,
9
9
  useSuccessfulPurchaseModal,
10
10
  useTransferModal
11
- } from "../../chunk-F42XMKDS.js";
11
+ } from "../../chunk-3LGNSRBR.js";
12
12
  import "../../chunk-NMCGA2TB.js";
13
13
  import "../../chunk-FFCNYF3S.js";
14
- import "../../chunk-RZSZNVEH.js";
14
+ import "../../chunk-L6GSYPCR.js";
15
15
  import "../../chunk-O642NH7U.js";
16
- import "../../chunk-Z3VR2KMP.js";
16
+ import "../../chunk-QGELCUYG.js";
17
17
  import "../../chunk-Y7YO5TLE.js";
18
18
  import "../../chunk-7NJETFMF.js";
19
19
  import "../../chunk-SBVLWSRZ.js";
20
20
  import "../../chunk-NJ2GXOPW.js";
21
- import "../../chunk-OUZ42I6B.js";
22
21
  import "../../chunk-MJ4YU7RW.js";
22
+ import "../../chunk-OUZ42I6B.js";
23
+ import "../../chunk-MCI3KOSQ.js";
24
+ import "../../chunk-WFE6OCYF.js";
25
+ import "../../chunk-3OHM45R3.js";
23
26
  import "../../chunk-Q2BVDQ3G.js";
24
27
  import "../../chunk-D3HRXVYJ.js";
25
28
  import "../../chunk-3CXEYH2I.js";
26
29
  import "../../chunk-T2AMWIKD.js";
27
- import "../../chunk-MCI3KOSQ.js";
28
- import "../../chunk-3OHM45R3.js";
29
- import "../../chunk-WFE6OCYF.js";
30
30
  export {
31
31
  CollectibleCard,
32
32
  ModalProvider,
@@ -1,5 +1,5 @@
1
1
  declare const dialogOverlay: string;
2
- declare const dialogContent: Record<"narrow" | "wide", string>;
2
+ declare const dialogContent: Record<"wide" | "narrow", string>;
3
3
  declare const closeButton: string;
4
4
 
5
5
  export { closeButton, dialogContent, dialogOverlay };
@@ -43,7 +43,7 @@ declare const alertMessageBox: string;
43
43
  declare const alertMessageBoxVariants: Record<"info" | "warning", string>;
44
44
 
45
45
  declare const switchChainModalContent: string;
46
- declare const switchChainCta: Record<"default" | "pending", string>;
46
+ declare const switchChainCta: Record<"pending" | "default", string>;
47
47
 
48
48
  declare const collectiblesGrid: string;
49
49
  declare const collectiblesGridItem: string;
@@ -18,7 +18,7 @@ import {
18
18
  quantityInputWrapper,
19
19
  tokenPreview,
20
20
  transferModalContent
21
- } from "../chunk-RZSZNVEH.js";
21
+ } from "../chunk-L6GSYPCR.js";
22
22
  import {
23
23
  cta
24
24
  } from "../chunk-O642NH7U.js";
@@ -1,15 +1,15 @@
1
1
  "use client"
2
2
  import "../../chunk-MCI3KOSQ.js";
3
- import {
4
- EIP2981_ABI,
5
- SequenceMarketplaceV1_ABI,
6
- SequenceMarketplaceV2_ABI
7
- } from "../../chunk-3OHM45R3.js";
8
3
  import {
9
4
  ERC1155_ABI,
10
5
  ERC20_ABI,
11
6
  ERC721_ABI
12
7
  } from "../../chunk-WFE6OCYF.js";
8
+ import {
9
+ EIP2981_ABI,
10
+ SequenceMarketplaceV1_ABI,
11
+ SequenceMarketplaceV2_ABI
12
+ } from "../../chunk-3OHM45R3.js";
13
13
  export {
14
14
  EIP2981_ABI,
15
15
  ERC1155_ABI,
@@ -7,18 +7,18 @@ import {
7
7
  truncateEnd,
8
8
  truncateMiddle
9
9
  } from "../chunk-OUZ42I6B.js";
10
- import "../chunk-T2AMWIKD.js";
11
10
  import "../chunk-MCI3KOSQ.js";
12
- import {
13
- EIP2981_ABI,
14
- SequenceMarketplaceV1_ABI,
15
- SequenceMarketplaceV2_ABI
16
- } from "../chunk-3OHM45R3.js";
17
11
  import {
18
12
  ERC1155_ABI,
19
13
  ERC20_ABI,
20
14
  ERC721_ABI
21
15
  } from "../chunk-WFE6OCYF.js";
16
+ import {
17
+ EIP2981_ABI,
18
+ SequenceMarketplaceV1_ABI,
19
+ SequenceMarketplaceV2_ABI
20
+ } from "../chunk-3OHM45R3.js";
21
+ import "../chunk-T2AMWIKD.js";
22
22
  export {
23
23
  EIP2981_ABI,
24
24
  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.3.6",
4
+ "version": "0.3.7",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -9,7 +9,7 @@ interface CustomSelectProps {
9
9
  label: string;
10
10
  disabled?: boolean;
11
11
  }>;
12
- placeholder?: string;
12
+ value: string;
13
13
  onValueChange?: (value: string) => void;
14
14
  defaultValue?: string;
15
15
  }
@@ -30,14 +30,14 @@ const CustomSelectItem = React.forwardRef<
30
30
 
31
31
  export const CustomSelect: React.FC<CustomSelectProps> = ({
32
32
  items,
33
- placeholder = 'Select an item...',
33
+ value,
34
34
  onValueChange,
35
35
  defaultValue,
36
36
  }) => {
37
37
  return (
38
38
  <Select.Root onValueChange={onValueChange} defaultValue={defaultValue}>
39
- <Select.Trigger className={trigger}>
40
- <Select.Value placeholder={placeholder} />
39
+ <Select.Trigger className={trigger} value={value}>
40
+ <Select.Value />
41
41
  <Select.Icon>
42
42
  <ChevronDownIcon size="xs" />
43
43
  </Select.Icon>
@@ -172,13 +172,13 @@ const ERC1155QuantityModal = observer(
172
172
  decimals={order.quantityDecimals}
173
173
  maxQuantity={order.quantityRemaining}
174
174
  />
175
- <Box display="flex" flexDirection="column" gap="2">
175
+ <Box display="flex" justifyContent="space-between">
176
176
  <Text color="text50" fontSize="small">
177
177
  Total Price
178
178
  </Text>
179
179
  <Box display="flex" alignItems="center" gap="2">
180
180
  <TokenImage src={currency?.imageUrl} size="xs" />
181
- <Text color="text" fontSize="large" fontWeight="bold">
181
+ <Text color="text100" fontSize="small" fontWeight="bold">
182
182
  {formatUnits(BigInt(totalPrice), currency?.decimals || 0)}
183
183
  </Text>
184
184
  </Box>
@@ -16,30 +16,32 @@ type SelectOption = {
16
16
  type CurrencyOptionsSelectProps = {
17
17
  collectionAddress: Hex;
18
18
  chainId: ChainId;
19
- $selectedCurrency: Observable<Currency | null | undefined>;
19
+ selectedCurrency$: Observable<Currency | null | undefined>;
20
20
  };
21
21
 
22
22
  const CurrencyOptionsSelect = observer(function CurrencyOptionsSelect({
23
23
  chainId,
24
24
  collectionAddress,
25
- $selectedCurrency,
25
+ selectedCurrency$,
26
26
  }: CurrencyOptionsSelectProps) {
27
+ const currency = selectedCurrency$.get() as Currency;
27
28
  const { data: currencies, isLoading: currenciesLoading } = useCurrencies({
28
29
  collectionAddress,
29
30
  chainId,
30
31
  });
31
32
 
33
+ // set default currency
32
34
  useEffect(() => {
33
35
  if (
34
36
  currencies &&
35
37
  currencies.length > 0 &&
36
- !$selectedCurrency.contractAddress.get()
38
+ !selectedCurrency$.contractAddress.get()
37
39
  ) {
38
- $selectedCurrency.set(currencies[0]);
40
+ selectedCurrency$.set(currencies[0]);
39
41
  }
40
42
  }, [currencies]);
41
43
 
42
- if (!currencies || currenciesLoading) {
44
+ if (!currencies || currenciesLoading || !currency.symbol) {
43
45
  return <Skeleton borderRadius="lg" width="20" height="7" marginRight="3" />;
44
46
  }
45
47
 
@@ -57,11 +59,17 @@ const CurrencyOptionsSelect = observer(function CurrencyOptionsSelect({
57
59
  (currency) => currency.contractAddress === value,
58
60
  )!;
59
61
 
60
- $selectedCurrency.set(c);
62
+ selectedCurrency$.set(c);
61
63
  };
62
64
 
65
+ console.log('currency', currency);
66
+
63
67
  return (
64
- <CustomSelect items={options} onValueChange={onChange} placeholder="" />
68
+ <CustomSelect
69
+ items={options}
70
+ value={currency.symbol}
71
+ onValueChange={onChange}
72
+ />
65
73
  );
66
74
  });
67
75
 
@@ -1,6 +1,6 @@
1
1
  import { useState } from 'react';
2
2
 
3
- import { Box, Text } from '@0xsequence/design-system';
3
+ import { Box, Skeleton, Text } from '@0xsequence/design-system';
4
4
  import type { Observable } from '@legendapp/state';
5
5
  import { observer } from '@legendapp/state/react';
6
6
  import { addDays, isSameDay } from 'date-fns';
@@ -47,7 +47,8 @@ const ExpirationDateSelect = observer(function ExpirationDateSelect({
47
47
  className,
48
48
  $date,
49
49
  }: ExpirationDateSelectProps) {
50
- const [_, setRange] = useState<rangeType>('1_week');
50
+ const defaultRange = '1_week';
51
+ const [range, setRange] = useState<rangeType>(defaultRange);
51
52
  function handleSelectPresetRange(range: rangeType) {
52
53
  setRange(range);
53
54
 
@@ -76,6 +77,10 @@ const ExpirationDateSelect = observer(function ExpirationDateSelect({
76
77
  $date.set(date);
77
78
  }
78
79
 
80
+ if (!$date.get()) {
81
+ return <Skeleton borderRadius="lg" width="20" height="7" marginRight="3" />;
82
+ }
83
+
79
84
  return (
80
85
  <Box width="full" position="relative">
81
86
  <Text
@@ -108,25 +113,11 @@ const ExpirationDateSelect = observer(function ExpirationDateSelect({
108
113
  label: preset.label,
109
114
  value: preset.value,
110
115
  }))}
111
- placeholder={
112
- Object.values(PRESET_RANGES).find((preset) =>
113
- isSameDay(
114
- new Date($date.get()),
115
- addDays(new Date(), preset.offset),
116
- ),
117
- )?.label
118
- }
116
+ value={range}
117
+ defaultValue={defaultRange}
119
118
  onValueChange={(value) =>
120
119
  handleSelectPresetRange(value as rangeType)
121
120
  }
122
- defaultValue={
123
- Object.values(PRESET_RANGES).find((preset) =>
124
- isSameDay(
125
- new Date($date.get()),
126
- addDays(new Date(), preset.offset),
127
- ),
128
- )?.value
129
- }
130
121
  />
131
122
  </Box>
132
123
 
@@ -83,7 +83,7 @@ const PriceInput = observer(function PriceInput({
83
83
  labelLocation="top"
84
84
  controls={
85
85
  <CurrencyOptionsSelect
86
- $selectedCurrency={$listingPrice?.currency}
86
+ selectedCurrency$={$listingPrice?.currency}
87
87
  collectionAddress={collectionAddress}
88
88
  chainId={chainId}
89
89
  />