@0xsequence/marketplace-sdk 0.1.0 → 0.2.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.
Files changed (122) hide show
  1. package/.ctirc +32 -0
  2. package/dist/{chunk-TZGLKJRF.js → chunk-4E34HVSA.js} +2 -2
  3. package/dist/chunk-5EOVZAKT.js +1325 -0
  4. package/dist/chunk-5EOVZAKT.js.map +1 -0
  5. package/dist/{chunk-RNUHUVLC.js → chunk-6JWGELXL.js} +1 -1
  6. package/dist/chunk-6JWGELXL.js.map +1 -0
  7. package/dist/{chunk-SNOEEUPZ.js → chunk-CSN7YD5Q.js} +2 -2
  8. package/dist/chunk-CSN7YD5Q.js.map +1 -0
  9. package/dist/{chunk-G3YU4NQ2.js → chunk-FCQCNLFZ.js} +1 -1
  10. package/dist/chunk-FCQCNLFZ.js.map +1 -0
  11. package/dist/{chunk-HGBEC3WX.js → chunk-GZIA25G4.js} +1 -1
  12. package/dist/chunk-GZIA25G4.js.map +1 -0
  13. package/dist/{chunk-GNB736ZE.js → chunk-MD4JHPMH.js} +318 -261
  14. package/dist/chunk-MD4JHPMH.js.map +1 -0
  15. package/dist/{chunk-EDTC7UES.js → chunk-NII6JJGH.js} +9 -4
  16. package/dist/chunk-NII6JJGH.js.map +1 -0
  17. package/dist/{chunk-BBB3XUB4.js → chunk-PE2LLUTJ.js} +1 -1
  18. package/dist/chunk-PE2LLUTJ.js.map +1 -0
  19. package/dist/{chunk-7CL54NCX.js → chunk-Q2BVDQ3G.js} +1 -1
  20. package/dist/chunk-Q2BVDQ3G.js.map +1 -0
  21. package/dist/{chunk-3TYUQEFM.js → chunk-VEX7FDL6.js} +2 -2
  22. package/dist/chunk-VEX7FDL6.js.map +1 -0
  23. package/dist/index.js +4 -4
  24. package/dist/react/_internal/api/index.d.ts +1 -1
  25. package/dist/react/_internal/api/index.js +1 -1
  26. package/dist/react/_internal/index.d.ts +2 -2
  27. package/dist/react/_internal/index.js +8 -8
  28. package/dist/react/_internal/wagmi/index.d.ts +2 -2
  29. package/dist/react/_internal/wagmi/index.js +1 -1
  30. package/dist/react/hooks/index.d.ts +336 -10
  31. package/dist/react/hooks/index.js +26 -20
  32. package/dist/react/index.d.ts +5 -5
  33. package/dist/react/index.js +34 -28
  34. package/dist/react/ssr/index.d.ts +24 -24
  35. package/dist/react/ssr/index.js +11 -4
  36. package/dist/react/ssr/index.js.map +1 -1
  37. package/dist/react/ui/icons/index.js +2 -2
  38. package/dist/react/ui/index.d.ts +43 -38
  39. package/dist/react/ui/index.js +9 -9
  40. package/dist/react/ui/modals/_internal/components/actionModal/index.js +4 -4
  41. package/dist/{services-BIwQ1C1c.d.ts → services-Dei25J6_.d.ts} +1 -1
  42. package/dist/styles/index.js +1 -1
  43. package/dist/types/index.js +3 -3
  44. package/dist/utils/abi/clients/index.js +1 -1
  45. package/dist/utils/index.d.ts +1 -1
  46. package/dist/utils/index.js +1 -1
  47. package/package.json +18 -25
  48. package/src/react/_internal/api/marketplace.gen.ts +4 -1
  49. package/src/react/_internal/types.ts +1 -1
  50. package/src/react/_internal/wagmi/create-config.ts +9 -3
  51. package/src/react/_internal/wagmi/embedded.ts +1 -1
  52. package/src/react/_internal/wagmi/universal.ts +1 -1
  53. package/src/react/hooks/index.ts +2 -0
  54. package/src/react/hooks/options/marketplaceConfigOptions.ts +2 -2
  55. package/src/react/hooks/useBalanceOfCollectible.tsx +10 -9
  56. package/src/react/hooks/useCheckoutOptions.tsx +63 -0
  57. package/src/react/hooks/useCollectible.tsx +4 -4
  58. package/src/react/hooks/useCollection.tsx +30 -30
  59. package/src/react/hooks/useCountOfCollectables.tsx +52 -52
  60. package/src/react/hooks/useCurrencies.tsx +60 -60
  61. package/src/react/hooks/useFilters.tsx +4 -4
  62. package/src/react/hooks/useFloorOrder.tsx +4 -4
  63. package/src/react/hooks/useGenerateListingTransaction.tsx +8 -7
  64. package/src/react/hooks/useGenerateOfferTransaction.tsx +5 -5
  65. package/src/react/hooks/useGenerateSellTransaction.tsx +4 -4
  66. package/src/react/hooks/useHighestOffer.tsx +4 -4
  67. package/src/react/hooks/useListBalances.tsx +4 -4
  68. package/src/react/hooks/useListCollectibles.tsx +4 -4
  69. package/src/react/hooks/useListOffersForCollectible.tsx +5 -4
  70. package/src/react/hooks/useLowestListing.tsx +4 -4
  71. package/src/react/hooks/useRoyaltyPercentage.tsx +6 -6
  72. package/src/react/hooks/useTransferTokens.tsx +1 -1
  73. package/src/react/provider.tsx +1 -1
  74. package/src/react/ssr/create-ssr-client.ts +1 -1
  75. package/src/react/ui/modals/CreateListingModal/_store.ts +37 -38
  76. package/src/react/ui/modals/CreateListingModal/index.tsx +152 -131
  77. package/src/react/ui/modals/MakeOfferModal/_store.ts +35 -37
  78. package/src/react/ui/modals/MakeOfferModal/index.tsx +25 -4
  79. package/src/react/ui/modals/SellModal/_store.ts +48 -51
  80. package/src/react/ui/modals/SellModal/index.tsx +27 -6
  81. package/src/react/ui/modals/SuccessfulPurchaseModal/_store.ts +1 -1
  82. package/src/react/ui/modals/SuccessfulPurchaseModal/index.tsx +14 -14
  83. package/src/react/ui/modals/TransferModal/_store.ts +11 -11
  84. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +92 -90
  85. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx +114 -0
  86. package/src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx +0 -96
  87. package/src/react/ui/modals/TransferModal/index.tsx +24 -3
  88. package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +1 -1
  89. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +2 -3
  90. package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +2 -2
  91. package/src/react/ui/modals/_internal/components/priceInput/index.tsx +4 -4
  92. package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +1 -1
  93. package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +4 -4
  94. package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +4 -4
  95. package/src/react/ui/modals/_internal/components/tokenPreview/index.tsx +1 -1
  96. package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +5 -3
  97. package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +3 -3
  98. package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +35 -2
  99. package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +10 -2
  100. package/src/types/api-types.ts +2 -2
  101. package/src/types/callbacks.ts +51 -0
  102. package/src/types/types.ts +1 -1
  103. package/src/utils/get-public-rpc-client.ts +1 -1
  104. package/tsconfig.json +24 -0
  105. package/tsconfig.tsbuildinfo +1 -0
  106. package/tsup.config.ts +35 -0
  107. package/README.md +0 -8
  108. package/dist/chunk-3TYUQEFM.js.map +0 -1
  109. package/dist/chunk-7CL54NCX.js.map +0 -1
  110. package/dist/chunk-BBB3XUB4.js.map +0 -1
  111. package/dist/chunk-EDTC7UES.js.map +0 -1
  112. package/dist/chunk-G3YU4NQ2.js.map +0 -1
  113. package/dist/chunk-GNB736ZE.js.map +0 -1
  114. package/dist/chunk-HGBEC3WX.js.map +0 -1
  115. package/dist/chunk-ITJEOCDV.js +0 -1006
  116. package/dist/chunk-ITJEOCDV.js.map +0 -1
  117. package/dist/chunk-M4MXVMAM.js +0 -271
  118. package/dist/chunk-M4MXVMAM.js.map +0 -1
  119. package/dist/chunk-RNUHUVLC.js.map +0 -1
  120. package/dist/chunk-SNOEEUPZ.js.map +0 -1
  121. package/dist/{chunk-TZGLKJRF.js.map → chunk-4E34HVSA.js.map} +0 -0
  122. package/dist/{create-config-Cto2ehcz.d.ts → create-config-CgtmCzvb.d.ts} +1 -1
@@ -2,104 +2,8 @@ import { observer } from '@legendapp/state/react';
2
2
  import AlertMessage from '../../../_internal/components/alertMessage';
3
3
  import getMessage from '../../messages';
4
4
  import { Box, Button, Text } from '@0xsequence/design-system';
5
- import { ContractType } from '@internal';
6
- import { transferModal$ } from '../../_store';
7
- import { useCollection } from '@react-hooks/useCollection';
8
- import { useTransferTokens } from '@react-hooks/useTransferTokens';
9
- import type { Hex } from 'viem';
10
- import { useTransactionStatusModal } from '../../../_internal/components/transactionStatusModal';
11
- import {
12
- getTransferTransactionMessage,
13
- getTransferTransactionTitle,
14
- } from '../../_utils/getTransferTransactionTitleMessage';
15
- import { useCollectible } from '@react-hooks/useCollectible';
16
- import { useEffect } from 'react';
17
5
 
18
6
  const FollowWalletInstructionsView = observer(() => {
19
- const {
20
- receiverAddress,
21
- collectionAddress,
22
- tokenId,
23
- quantity,
24
- chainId,
25
- messages,
26
- } = transferModal$.state.get();
27
- const { transferTokensAsync, hash } = useTransferTokens();
28
- const { show: showTransactionStatusModal } = useTransactionStatusModal();
29
- const { data: collection, isSuccess: collectionSuccess } = useCollection({
30
- collectionAddress,
31
- chainId,
32
- });
33
- const { data: collectible, isSuccess: collectibleSuccess } = useCollectible({
34
- collectionAddress,
35
- collectibleId: tokenId,
36
- chainId,
37
- });
38
-
39
- useEffect(() => {
40
- if (!hash && collectionSuccess) {
41
- transfer();
42
- }
43
- }, [collectionSuccess, collectibleSuccess, hash]);
44
-
45
- async function transfer() {
46
- if (collection!.type === ContractType.ERC721) {
47
- try {
48
- const hash = await transferTokensAsync({
49
- receiverAddress: receiverAddress as Hex,
50
- collectionAddress,
51
- tokenId,
52
- chainId,
53
- contractType: ContractType.ERC721,
54
- });
55
-
56
- transferModal$.close();
57
-
58
- showTransactionStatusModal({
59
- hash: hash,
60
- collectionAddress,
61
- chainId,
62
- tokenId,
63
- price: undefined,
64
- getTitle: getTransferTransactionTitle,
65
- getMessage: (params) =>
66
- getTransferTransactionMessage(params, collectible!.name),
67
- type: 'transfer',
68
- });
69
- } catch (error) {
70
- messages?.transferCollectibles?.onUnknownError &&
71
- messages.transferCollectibles.onUnknownError(error);
72
- }
73
- }
74
-
75
- try {
76
- const hash = await transferTokensAsync({
77
- receiverAddress: receiverAddress as Hex,
78
- collectionAddress,
79
- tokenId,
80
- chainId,
81
- contractType: ContractType.ERC1155,
82
- quantity: String(quantity),
83
- });
84
-
85
- transferModal$.close();
86
-
87
- showTransactionStatusModal({
88
- hash: hash,
89
- collectionAddress,
90
- chainId,
91
- tokenId,
92
- price: undefined,
93
- getTitle: getTransferTransactionTitle,
94
- getMessage: (params) =>
95
- getTransferTransactionMessage(params, collectible!.name),
96
- type: 'transfer',
97
- });
98
- } catch (error) {
99
- messages?.transferCollectibles?.onUnknownError &&
100
- messages.transferCollectibles.onUnknownError(error);
101
- }
102
- }
103
7
  return (
104
8
  <Box display="grid" gap="6" flexGrow="1">
105
9
  <Text color="white" fontSize="large" fontWeight="bold">
@@ -5,21 +5,24 @@ import { observer, Show } from '@legendapp/state/react';
5
5
  import { Close, Content, Overlay, Portal, Root } from '@radix-ui/react-dialog';
6
6
  import { useAccount } from 'wagmi';
7
7
  import { useSwitchChainModal } from '../_internal/components/switchChainModal';
8
- import type { Messages } from '../../../../types/messages';
9
8
  import type { Hex } from 'viem';
10
9
  import EnterWalletAddressView from './_views/enterWalletAddress';
11
10
  import FollowWalletInstructionsView from './_views/followWalletInstructions';
11
+ import {
12
+ TransferErrorCallbacks,
13
+ TransferSuccessCallbacks,
14
+ } from '../../../../types/callbacks';
12
15
 
13
16
  export type ShowTransferModalArgs = {
14
17
  collectionAddress: Hex;
15
18
  tokenId: string;
16
19
  chainId: string;
17
- messages?: Messages;
18
20
  };
19
21
 
20
22
  export const useTransferModal = () => {
21
23
  const { chainId: accountChainId } = useAccount();
22
24
  const { show: showSwitchNetworkModal } = useSwitchChainModal();
25
+ const { errorCallbacks, successCallbacks } = transferModal$.state.get();
23
26
 
24
27
  const openModal = (args: ShowTransferModalArgs) => {
25
28
  transferModal$.open(args);
@@ -32,7 +35,13 @@ export const useTransferModal = () => {
32
35
  showSwitchNetworkModal({
33
36
  chainIdToSwitchTo: Number(args.chainId),
34
37
  onSwitchChain: () => openModal(args),
35
- messages: args.messages?.switchChain,
38
+ callbacks: {
39
+ onSuccess: successCallbacks?.onSwitchChainSuccess,
40
+ onUnknownError: errorCallbacks?.onSwitchChainError,
41
+ onSwitchingNotSupported: errorCallbacks?.onSwitchingNotSupportedError,
42
+ onUserRejectedRequest:
43
+ errorCallbacks?.onUserRejectedSwitchingChainRequestError,
44
+ },
36
45
  });
37
46
  return;
38
47
  }
@@ -43,6 +52,18 @@ export const useTransferModal = () => {
43
52
  return {
44
53
  show: handleShowModal,
45
54
  close: () => transferModal$.close(),
55
+ onError: (callbacks: TransferErrorCallbacks) => {
56
+ transferModal$.state.set({
57
+ ...transferModal$.state.get(),
58
+ errorCallbacks: callbacks,
59
+ });
60
+ },
61
+ onSuccess: (callbacks: TransferSuccessCallbacks) => {
62
+ transferModal$.state.set({
63
+ ...transferModal$.state.get(),
64
+ successCallbacks: callbacks,
65
+ });
66
+ },
46
67
  };
47
68
  };
48
69
 
@@ -10,10 +10,10 @@ import {
10
10
  IconButton,
11
11
  Text,
12
12
  } from '@0xsequence/design-system';
13
- import { getProviderEl } from '@internal';
14
13
  import type { Observable } from '@legendapp/state';
15
14
  import { observer } from '@legendapp/state/react';
16
15
  import { Close, Content, Overlay, Portal, Root } from '@radix-ui/react-dialog';
16
+ import { getProviderEl } from '../../../../../_internal';
17
17
  import type { ActionModalState } from './store';
18
18
  import {
19
19
  closeButton,
@@ -1,11 +1,10 @@
1
1
  import { Box, Select, Skeleton } from '@0xsequence/design-system';
2
- import type { ChainId } from '@internal';
3
2
  import type { Observable } from '@legendapp/state';
4
3
  import { observer } from '@legendapp/state/react';
5
- import { useCurrencies } from '@react-hooks/useCurrencies';
6
- import type { Currency } from '@types';
7
4
  import { useEffect, useState } from 'react';
8
5
  import type { Hex } from 'viem';
6
+ import type { ChainId, Currency } from '../../../../../_internal';
7
+ import { useCurrencies } from '../../../../../hooks';
9
8
  import { currencySelect } from './styles.css';
10
9
 
11
10
  // TODO: this should be exported from design system
@@ -1,8 +1,8 @@
1
1
  import { Text } from '@0xsequence/design-system';
2
- import { useLowestListing } from '@react-hooks/useLowestListing';
3
- import type { Price } from '@types';
4
2
  import type { Hex } from 'viem';
3
+ import type { Price } from '../../../../../../types';
5
4
  import { calculatePriceDifferencePercentage } from '../../../../../../utils';
5
+ import { useLowestListing } from '../../../../../hooks';
6
6
 
7
7
  export default function FloorPriceText({
8
8
  chainId,
@@ -1,12 +1,12 @@
1
- import CurrencyOptionsSelect from '../currencyOptionsSelect';
2
- import { priceInputCurrencyImage, priceInputWrapper } from './styles.css';
3
1
  import { Box, NumericInput, TokenImage } from '@0xsequence/design-system';
4
2
  import type { Observable } from '@legendapp/state';
5
3
  import { observer } from '@legendapp/state/react';
6
- import type { Price } from '@types';
7
4
  import { useState } from 'react';
8
- import { erc20Abi, formatUnits, Hex, parseUnits } from 'viem';
5
+ import { type Hex, erc20Abi, formatUnits, parseUnits } from 'viem';
9
6
  import { useAccount, useReadContract } from 'wagmi';
7
+ import type { Price } from '../../../../../../types';
8
+ import CurrencyOptionsSelect from '../currencyOptionsSelect';
9
+ import { priceInputCurrencyImage, priceInputWrapper } from './styles.css';
10
10
 
11
11
  type PriceInputProps = {
12
12
  collectionAddress: Hex;
@@ -1,7 +1,7 @@
1
1
  import { Box, IconButton, NumericInput } from '@0xsequence/design-system';
2
2
  import type { Observable } from '@legendapp/state';
3
- import { useCollectible } from '@react-hooks/useCollectible';
4
3
  import type { Hex } from 'viem';
4
+ import { useCollectible } from '../../../../../hooks';
5
5
  import SvgMinusIcon from '../../../../icons/MinusIcon';
6
6
  import SvgPlusIcon from '../../../../icons/PlusIcon';
7
7
  import { quantityInputWrapper } from './styles.css';
@@ -21,12 +21,12 @@ import { getPresentableChainName } from '../../../../../../utils/network';
21
21
 
22
22
  import { UserRejectedRequestError } from 'viem';
23
23
  import { SwitchChainNotSupportedError } from 'wagmi';
24
- import type { SwitchChainMessageCallbacks } from '../../../../../../types/messages';
24
+ import type { SwitchChainCallbacks } from '../../../../../../types/callbacks';
25
25
 
26
26
  export type ShowSwitchChainModalArgs = {
27
27
  chainIdToSwitchTo: number;
28
28
  onSwitchChain: () => void;
29
- messages?: SwitchChainMessageCallbacks;
29
+ callbacks?: SwitchChainCallbacks;
30
30
  };
31
31
 
32
32
  export const useSwitchChainModal = () => {
@@ -47,8 +47,8 @@ const SwitchChainModal = observer(() => {
47
47
  onUserRejectedRequest,
48
48
  onUnknownError,
49
49
  onSuccess,
50
- }: Partial<SwitchChainMessageCallbacks> =
51
- switchChainModal$.state.messages.get() || {};
50
+ }: Partial<SwitchChainCallbacks> =
51
+ switchChainModal$.state.callbacks.get() || {};
52
52
 
53
53
  async function handleSwitchChain() {
54
54
  isSwitching$.set(true);
@@ -1,6 +1,6 @@
1
1
  import { observable } from '@legendapp/state';
2
2
  import type { ShowSwitchChainModalArgs } from '.';
3
- import type { SwitchChainMessageCallbacks } from '../../../../../../types/messages';
3
+ import type { SwitchChainCallbacks } from '../../../../../../types/callbacks';
4
4
 
5
5
  export interface SwitchChainModalState {
6
6
  isOpen: boolean;
@@ -10,18 +10,18 @@ export interface SwitchChainModalState {
10
10
  chainIdToSwitchTo?: number;
11
11
  onSwitchChain?: () => void;
12
12
  isSwitching: boolean;
13
- messages?: SwitchChainMessageCallbacks;
13
+ callbacks?: SwitchChainCallbacks;
14
14
  };
15
15
  }
16
16
 
17
17
  export const initialState: SwitchChainModalState = {
18
18
  isOpen: false,
19
- open: ({ chainIdToSwitchTo, onSwitchChain, messages }) => {
19
+ open: ({ chainIdToSwitchTo, onSwitchChain, callbacks }) => {
20
20
  switchChainModal$.state.set({
21
21
  ...switchChainModal$.state.get(),
22
22
  chainIdToSwitchTo,
23
23
  onSwitchChain,
24
- messages,
24
+ callbacks,
25
25
  });
26
26
  switchChainModal$.isOpen.set(true);
27
27
  },
@@ -1,6 +1,6 @@
1
1
  import { Box, Image, Skeleton, Text } from '@0xsequence/design-system';
2
- import { useCollectible } from '@react-hooks/useCollectible';
3
2
  import type { Hex } from 'viem';
3
+ import { useCollectible } from '../../../../../hooks';
4
4
  import { tokenPreview } from './styles.css';
5
5
 
6
6
  type TokenPreviewProps = {
@@ -1,8 +1,10 @@
1
1
  import { Box, NetworkImage, Skeleton, Text } from '@0xsequence/design-system';
2
- import { useMarketplaceConfig } from '@react-hooks/useMarketplaceConfig';
3
- import { useRoyaltyPercentage } from '@react-hooks/useRoyaltyPercentage';
4
- import type { Price } from '@types';
5
2
  import { type Hex, formatUnits } from 'viem';
3
+ import type { Price } from '../../../../../../types';
4
+ import {
5
+ useMarketplaceConfig,
6
+ useRoyaltyPercentage,
7
+ } from '../../../../../hooks';
6
8
 
7
9
  type TransactionDetailsProps = {
8
10
  collectibleId: string;
@@ -1,9 +1,9 @@
1
1
  import { Box, Image, NetworkImage, Text } from '@0xsequence/design-system';
2
- import type { TokenMetadata } from '@internal';
3
2
  import { observer } from '@legendapp/state/react';
4
- import { useCollection } from '@react-hooks/useCollection';
5
- import type { Price } from '@types';
6
3
  import { type Hex, formatUnits } from 'viem';
4
+ import type { Price } from '../../../../../../types';
5
+ import type { TokenMetadata } from '../../../../../_internal';
6
+ import { useCollection } from '../../../../../hooks';
7
7
  import TimeAgo from '../timeAgo';
8
8
  import { transactionStatusModal$ } from '../transactionStatusModal/store';
9
9
  import { useTransactionPreviewTitle } from './useTransactionPreviewTitle';
@@ -6,10 +6,14 @@ import {
6
6
  } from '@0xsequence/design-system';
7
7
  import { observer } from '@legendapp/state/react';
8
8
  import { Close, Content, Overlay, Portal, Root } from '@radix-ui/react-dialog';
9
- import { useCollectible } from '@react-hooks/useCollectible';
10
- import type { Price, TokenMetadata } from '@types';
9
+ import type { QueryKey } from '@tanstack/react-query';
10
+ import { useEffect } from 'react';
11
11
  import type { Hex } from 'viem';
12
12
  import { useTransactionReceipt } from 'wagmi';
13
+ import type { Price, TokenMetadata } from '../../../../../../types';
14
+ import type { BaseCallbacks } from '../../../../../../types/callbacks';
15
+ import { getQueryClient } from '../../../../../_internal';
16
+ import { useCollectible } from '../../../../../hooks';
13
17
  import TransactionFooter from '../transaction-footer';
14
18
  import TransactionPreview from '../transactionPreview';
15
19
  import {
@@ -32,6 +36,8 @@ export type ShowTransactionStatusModalArgs = {
32
36
  getTitle?: (props: ConfirmationStatus) => string;
33
37
  getMessage?: (props: ConfirmationStatus) => string;
34
38
  type: StatusOrderType;
39
+ callbacks?: BaseCallbacks;
40
+ queriesToInvalidate?: QueryKey[];
35
41
  };
36
42
 
37
43
  export const useTransactionStatusModal = () => {
@@ -51,6 +57,8 @@ const TransactionStatusModal = observer(() => {
51
57
  tokenId,
52
58
  getTitle,
53
59
  getMessage,
60
+ callbacks,
61
+ queriesToInvalidate,
54
62
  } = transactionStatusModal$.state.get();
55
63
  const { data: collectible } = useCollectible({
56
64
  collectionAddress,
@@ -61,10 +69,35 @@ const TransactionStatusModal = observer(() => {
61
69
  isLoading: isConfirming,
62
70
  isSuccess: isConfirmed,
63
71
  isError: isFailed,
72
+ error,
64
73
  } = useTransactionReceipt({ hash });
65
74
  const title = getTitle && getTitle({ isConfirmed, isConfirming, isFailed });
66
75
  const message =
67
76
  getMessage && getMessage({ isConfirmed, isConfirming, isFailed });
77
+ const { onUnknownError, onSuccess }: BaseCallbacks = callbacks || {};
78
+ const queryClient = getQueryClient();
79
+
80
+ useEffect(() => {
81
+ if (!transactionStatusModal$.isOpen.get()) return;
82
+
83
+ let isSubscribed = true;
84
+
85
+ if (isConfirmed && isSubscribed && onSuccess) {
86
+ onSuccess();
87
+ }
88
+
89
+ if (isFailed && isSubscribed && onUnknownError) {
90
+ onUnknownError(error);
91
+ }
92
+
93
+ if (isSubscribed && queriesToInvalidate) {
94
+ queryClient.invalidateQueries({ queryKey: [...queriesToInvalidate] });
95
+ }
96
+
97
+ return () => {
98
+ isSubscribed = false;
99
+ };
100
+ }, [isConfirmed, isFailed, onSuccess, onUnknownError, error]);
68
101
 
69
102
  return (
70
103
  <Root open={transactionStatusModal$.isOpen.get()}>
@@ -1,9 +1,11 @@
1
1
  import type { TransactionStatus } from '@0xsequence/indexer';
2
- import type { StepType } from '@internal';
3
2
  import { observable } from '@legendapp/state';
4
- import type { Price } from '@types';
3
+ import type { QueryKey } from '@tanstack/react-query';
5
4
  import type { Hex } from 'viem';
6
5
  import type { ShowTransactionStatusModalArgs } from '.';
6
+ import type { Price } from '../../../../../../types';
7
+ import type { BaseCallbacks } from '../../../../../../types/callbacks';
8
+ import type { StepType } from '../../../../../_internal';
7
9
 
8
10
  export type ConfirmationStatus = {
9
11
  isConfirming: boolean;
@@ -37,6 +39,8 @@ export interface TransactionStatusModalState {
37
39
  tokenId: string;
38
40
  getTitle?: (params: ConfirmationStatus) => string;
39
41
  getMessage?: (params: ConfirmationStatus) => string;
42
+ callbacks?: BaseCallbacks;
43
+ queriesToInvalidate?: QueryKey[];
40
44
  };
41
45
  }
42
46
 
@@ -51,6 +55,8 @@ export const initialState: TransactionStatusModalState = {
51
55
  getTitle,
52
56
  getMessage,
53
57
  type,
58
+ callbacks,
59
+ queriesToInvalidate,
54
60
  }) => {
55
61
  transactionStatusModal$.state.set({
56
62
  ...transactionStatusModal$.state.get(),
@@ -62,6 +68,8 @@ export const initialState: TransactionStatusModalState = {
62
68
  getTitle,
63
69
  getMessage,
64
70
  type,
71
+ callbacks,
72
+ queriesToInvalidate,
65
73
  });
66
74
  transactionStatusModal$.isOpen.set(true);
67
75
  },
@@ -14,7 +14,7 @@ export {
14
14
  StepType,
15
15
  TransactionCrypto,
16
16
  ExecuteType,
17
- } from '@internal';
17
+ } from '../react/_internal';
18
18
  export type {
19
19
  TokenMetadata,
20
20
  Asset,
@@ -45,4 +45,4 @@ export type {
45
45
  CheckoutOptionsMarketplaceOrder,
46
46
  CheckoutOptionsItem,
47
47
  CheckoutOptions,
48
- } from '@internal';
48
+ } from '../react/_internal';
@@ -0,0 +1,51 @@
1
+ export type BaseCallbacks = {
2
+ onSuccess?: () => void;
3
+ onUnknownError?: (error: Error | unknown) => void;
4
+ };
5
+
6
+ export type SwitchChainCallbacks = BaseCallbacks & {
7
+ onSwitchingNotSupported?: () => void;
8
+ onUserRejectedRequest?: () => void;
9
+ };
10
+
11
+ export type OnApproveTokenError = (error: Error | unknown) => void;
12
+
13
+ export type BaseErrorCallbacks = {
14
+ onApproveTokenError?: OnApproveTokenError;
15
+ onSwitchingNotSupportedError?: () => void;
16
+ onUserRejectedSwitchingChainRequestError?: () => void;
17
+ onSwitchChainError?: (error: Error | unknown) => void;
18
+ };
19
+
20
+ export type BaseSuccessCallbacks = {
21
+ onApproveTokenSuccess?: () => void;
22
+ onSwitchChainSuccess?: () => void;
23
+ };
24
+
25
+ export type CreateListingErrorCallbacks = BaseErrorCallbacks & {
26
+ onCreateListingError?: (error: Error | unknown) => void;
27
+ };
28
+ export type CreateListingSuccessCallbacks = BaseSuccessCallbacks & {
29
+ onCreateListingSuccess?: () => void;
30
+ };
31
+
32
+ export type MakeOfferErrorCallbacks = BaseErrorCallbacks & {
33
+ onMakeOfferError?: (error: Error | unknown) => void;
34
+ };
35
+ export type MakeOfferSuccessCallbacks = BaseSuccessCallbacks & {
36
+ onMakeOfferSuccess?: () => void;
37
+ };
38
+
39
+ export type SellErrorCallbacks = BaseErrorCallbacks & {
40
+ onSellError?: (error: Error | unknown) => void;
41
+ };
42
+ export type SellSuccessCallbacks = BaseSuccessCallbacks & {
43
+ onSellSuccess?: () => void;
44
+ };
45
+
46
+ export type TransferErrorCallbacks = BaseErrorCallbacks & {
47
+ onTransferError?: (error: Error | unknown) => void;
48
+ };
49
+ export type TransferSuccessCallbacks = BaseSuccessCallbacks & {
50
+ onTransferSuccess?: () => void;
51
+ };
@@ -1,4 +1,4 @@
1
- import type { Currency } from '@types';
1
+ import type { Currency } from './api-types';
2
2
 
3
3
  export type Price = {
4
4
  amountRaw: string;
@@ -1,6 +1,6 @@
1
1
  import { allNetworks, findNetworkConfig } from '@0xsequence/network';
2
- import type { ChainId } from '@internal';
3
2
  import { http, type PublicClient, createPublicClient } from 'viem';
3
+ import type { ChainId } from '../react/_internal';
4
4
 
5
5
  export const getPublicRpcClient = (chainId: ChainId): PublicClient => {
6
6
  const network = findNetworkConfig(allNetworks, chainId);
package/tsconfig.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["dom", "dom.iterable", "esnext"],
6
+
7
+ "module": "ESNext",
8
+ "skipLibCheck": true,
9
+
10
+ "moduleResolution": "bundler",
11
+ "resolvePackageJsonImports": true,
12
+ "allowImportingTsExtensions": true,
13
+ "isolatedModules": true,
14
+ "moduleDetection": "force",
15
+ "noEmit": true,
16
+ "jsx": "react-jsx",
17
+
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "noFallthroughCasesInSwitch": true
22
+ },
23
+ "include": ["src", "tsup.config.ts"]
24
+ }
@@ -0,0 +1 @@
1
+ {"root":["./src/consts.ts","./src/index.ts","./src/react/index.ts","./src/react/provider.tsx","./src/react/_internal/consts.ts","./src/react/_internal/get-provider.ts","./src/react/_internal/index.ts","./src/react/_internal/types.ts","./src/react/_internal/api/get-query-client.ts","./src/react/_internal/api/index.ts","./src/react/_internal/api/marketplace-api.ts","./src/react/_internal/api/marketplace.gen.ts","./src/react/_internal/api/query-keys.ts","./src/react/_internal/api/services.ts","./src/react/_internal/api/zod-schema.ts","./src/react/_internal/wagmi/create-config.ts","./src/react/_internal/wagmi/embedded.ts","./src/react/_internal/wagmi/index.ts","./src/react/_internal/wagmi/universal.ts","./src/react/hooks/index.ts","./src/react/hooks/usebalanceofcollectible.tsx","./src/react/hooks/usecheckoutoptions.tsx","./src/react/hooks/usecollectible.tsx","./src/react/hooks/usecollection.tsx","./src/react/hooks/useconfig.tsx","./src/react/hooks/usecountofcollectables.tsx","./src/react/hooks/usecurrencies.tsx","./src/react/hooks/usefilters.tsx","./src/react/hooks/usefloororder.tsx","./src/react/hooks/usegeneratelistingtransaction.tsx","./src/react/hooks/usegenerateoffertransaction.tsx","./src/react/hooks/usegenerateselltransaction.tsx","./src/react/hooks/usehighestoffer.tsx","./src/react/hooks/uselistbalances.tsx","./src/react/hooks/uselistcollectibles.tsx","./src/react/hooks/uselistoffersforcollectible.tsx","./src/react/hooks/uselowestlisting.tsx","./src/react/hooks/usemarketplaceconfig.tsx","./src/react/hooks/useroyaltypercentage.tsx","./src/react/hooks/usetransfertokens.tsx","./src/react/hooks/options/marketplaceconfigoptions.ts","./src/react/ssr/create-ssr-client.ts","./src/react/ssr/index.ts","./src/react/ui/index.ts","./src/react/ui/icons/arrowup.tsx","./src/react/ui/icons/calendaricon.tsx","./src/react/ui/icons/infoicon.tsx","./src/react/ui/icons/inventoryicon.tsx","./src/react/ui/icons/minusicon.tsx","./src/react/ui/icons/plusicon.tsx","./src/react/ui/icons/positivecircleicon.tsx","./src/react/ui/icons/index.ts","./src/react/ui/icons/styles.css.ts","./src/react/ui/modals/modal-provider.tsx","./src/react/ui/modals/account/index.tsx","./src/react/ui/modals/createlistingmodal/_store.ts","./src/react/ui/modals/createlistingmodal/index.tsx","./src/react/ui/modals/createlistingmodal/_utils/getcreatelistingtransactiontitlemessage.ts","./src/react/ui/modals/makeoffermodal/_store.ts","./src/react/ui/modals/makeoffermodal/index.tsx","./src/react/ui/modals/makeoffermodal/_utils/getmakeoffertransactiontitlemessage.ts","./src/react/ui/modals/sellmodal/_store.ts","./src/react/ui/modals/sellmodal/index.tsx","./src/react/ui/modals/sellmodal/utils.ts","./src/react/ui/modals/sellmodal/_utils/getselltransactiontitlemessage.ts","./src/react/ui/modals/successfulpurchasemodal/_store.ts","./src/react/ui/modals/successfulpurchasemodal/index.tsx","./src/react/ui/modals/successfulpurchasemodal/styles.css.ts","./src/react/ui/modals/transfermodal/_store.ts","./src/react/ui/modals/transfermodal/index.tsx","./src/react/ui/modals/transfermodal/messages.ts","./src/react/ui/modals/transfermodal/styles.css.ts","./src/react/ui/modals/transfermodal/_utils/gettransfertransactiontitlemessage.ts","./src/react/ui/modals/transfermodal/_views/enterwalletaddress/index.tsx","./src/react/ui/modals/transfermodal/_views/enterwalletaddress/usehandletransfer.tsx","./src/react/ui/modals/transfermodal/_views/followwalletinstructions/index.tsx","./src/react/ui/modals/_internal/components/actionmodal/actionmodal.tsx","./src/react/ui/modals/_internal/components/actionmodal/index.ts","./src/react/ui/modals/_internal/components/actionmodal/store.ts","./src/react/ui/modals/_internal/components/actionmodal/styles.css.ts","./src/react/ui/modals/_internal/components/alertmessage/index.tsx","./src/react/ui/modals/_internal/components/alertmessage/styles.css.ts","./src/react/ui/modals/_internal/components/calendar/index.tsx","./src/react/ui/modals/_internal/components/calendarpopover/index.tsx","./src/react/ui/modals/_internal/components/calendarpopover/styles.css.ts","./src/react/ui/modals/_internal/components/currencyoptionsselect/index.tsx","./src/react/ui/modals/_internal/components/currencyoptionsselect/styles.css.ts","./src/react/ui/modals/_internal/components/expirationdateselect/index.tsx","./src/react/ui/modals/_internal/components/expirationdateselect/styles.css.ts","./src/react/ui/modals/_internal/components/floorpricetext/index.tsx","./src/react/ui/modals/_internal/components/priceinput/index.tsx","./src/react/ui/modals/_internal/components/priceinput/styles.css.ts","./src/react/ui/modals/_internal/components/priceinput/types.ts","./src/react/ui/modals/_internal/components/quantityinput/index.tsx","./src/react/ui/modals/_internal/components/quantityinput/styles.css.ts","./src/react/ui/modals/_internal/components/switchchainmodal/index.tsx","./src/react/ui/modals/_internal/components/switchchainmodal/store.ts","./src/react/ui/modals/_internal/components/switchchainmodal/styles.css.ts","./src/react/ui/modals/_internal/components/timeago/index.tsx","./src/react/ui/modals/_internal/components/tokenpreview/index.tsx","./src/react/ui/modals/_internal/components/tokenpreview/styles.css.ts","./src/react/ui/modals/_internal/components/transaction-footer/index.tsx","./src/react/ui/modals/_internal/components/transactiondetails/index.tsx","./src/react/ui/modals/_internal/components/transactionheader/index.tsx","./src/react/ui/modals/_internal/components/transactionpreview/consts.ts","./src/react/ui/modals/_internal/components/transactionpreview/index.tsx","./src/react/ui/modals/_internal/components/transactionpreview/usetransactionpreviewtitle.tsx","./src/react/ui/modals/_internal/components/transactionstatusmodal/index.tsx","./src/react/ui/modals/_internal/components/transactionstatusmodal/store.ts","./src/react/ui/modals/_internal/components/transactionstatusmodal/styles.css.ts","./src/react/ui/modals/_internal/stores/accountmodal.ts","./src/react/ui/styles/index.ts","./src/react/ui/styles/modal.css.ts","./src/styles/index.ts","./src/types/api-types.ts","./src/types/callbacks.ts","./src/types/index.ts","./src/types/marketplace-config.ts","./src/types/messages.ts","./src/types/sdk-config.ts","./src/types/types.ts","./src/utils/address.ts","./src/utils/get-public-rpc-client.ts","./src/utils/index.ts","./src/utils/network.ts","./src/utils/price.ts","./src/utils/abi/abi/standard/eip2981.ts","./src/utils/abi/abi/standard/index.ts","./src/utils/abi/abi/token/erc1155.ts","./src/utils/abi/abi/token/erc20.ts","./src/utils/abi/abi/token/erc721.ts","./src/utils/abi/abi/token/index.ts","./src/utils/abi/clients/erc1155.ts","./src/utils/abi/clients/erc20.ts","./src/utils/abi/clients/erc721.ts","./src/utils/abi/clients/index.ts","./tsup.config.ts"],"version":"5.6.3"}
package/tsup.config.ts ADDED
@@ -0,0 +1,35 @@
1
+ import { vanillaExtractPlugin } from '@vanilla-extract/esbuild-plugin';
2
+ import { defineConfig } from 'tsup';
3
+
4
+ export default defineConfig([
5
+ {
6
+ entry: ['src/**/index.ts', '!src/react/**'],
7
+ dts: true,
8
+ sourcemap: true,
9
+ format: ['esm'],
10
+ },
11
+ {
12
+ entry: ['src/**/index.ts', '!src/react/ssr/index.ts'],
13
+ dts: true,
14
+ sourcemap: true,
15
+ format: ['esm'],
16
+ esbuildPlugins: [vanillaExtractPlugin()],
17
+ esbuildOptions(options) {
18
+ options.banner = {
19
+ js: '"use client"',
20
+ };
21
+ },
22
+ },
23
+ {
24
+ entry: { 'react/ssr/index': 'src/react/ssr/index.ts' },
25
+ dts: true,
26
+ sourcemap: true,
27
+ format: ['esm'],
28
+ },
29
+ {
30
+ entry: ['src/styles/index.ts'],
31
+ outDir: 'dist',
32
+ format: ['esm'],
33
+ esbuildPlugins: [vanillaExtractPlugin()],
34
+ },
35
+ ]);
package/README.md DELETED
@@ -1,8 +0,0 @@
1
- # Marketplace SDK
2
- `@0xsequence/marketplace-sdk` provides core functionality for integrators who wish to develop their own web3 Marketplaces using [Sequence's Aggregated Marketplace](https://sequence.xyz/marketplaces) technology.
3
-
4
- You can install with:
5
-
6
- `pnpm install @0xsequence/marketplace-sdk`
7
-
8
- For an example Marketplace implementation that leverages this SDK, see [Sequence Marketplace Boilerplate](https://github.com/0xsequence/marketplace-boilerplate).
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../node_modules/.pnpm/@vanilla-extract+recipes@0.5.5_@vanilla-extract+css@1.16.0/node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js","../src/react/ui/icons/styles.css.ts"],"sourcesContent":["function toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\n\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : String(i);\n}\n\nfunction _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\n\nfunction ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n}\nfunction _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n _defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n}\n\nfunction mapValues(input, fn) {\n var result = {};\n for (var _key in input) {\n result[_key] = fn(input[_key], _key);\n }\n return result;\n}\n\nvar shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {\n for (var key of Object.keys(compoundCheck)) {\n var _selections$key;\n if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {\n return false;\n }\n }\n return true;\n};\nvar createRuntimeFn = config => {\n var runtimeFn = options => {\n var className = config.defaultClassName;\n var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);\n for (var variantName in selections) {\n var _selections$variantNa;\n var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];\n if (variantSelection != null) {\n var selection = variantSelection;\n if (typeof selection === 'boolean') {\n // @ts-expect-error\n selection = selection === true ? 'true' : 'false';\n }\n var selectionClassName =\n // @ts-expect-error\n config.variantClassNames[variantName][selection];\n if (selectionClassName) {\n className += ' ' + selectionClassName;\n }\n }\n }\n for (var [compoundCheck, compoundClassName] of config.compoundVariants) {\n if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {\n className += ' ' + compoundClassName;\n }\n }\n return className;\n };\n runtimeFn.variants = () => Object.keys(config.variantClassNames);\n runtimeFn.classNames = {\n get base() {\n return config.defaultClassName.split(' ')[0];\n },\n get variants() {\n return mapValues(config.variantClassNames, classNames => mapValues(classNames, className => className.split(' ')[0]));\n }\n };\n return runtimeFn;\n};\n\nexport { createRuntimeFn as c, mapValues as m };\n","import 'src/react/ui/icons/styles.css.ts.vanilla.css?source=LnN0eWxlc19pY29uVmFyaWFudHNfXzF4MTJ0YmUwIHsKICBmbGV4LXNocmluazogMDsKfQouc3R5bGVzX2ljb25WYXJpYW50c19zaXplX3hzX18xeDEydGJlMSB7CiAgaGVpZ2h0OiB2YXIoLS1zZXEtbGluZS1oZWlnaHRzLTQpOwogIHdpZHRoOiB2YXIoLS1zZXEtbGluZS1oZWlnaHRzLTQpOwp9Ci5zdHlsZXNfaWNvblZhcmlhbnRzX3NpemVfc21fXzF4MTJ0YmUyIHsKICBoZWlnaHQ6IHZhcigtLXNlcS1saW5lLWhlaWdodHMtNSk7CiAgd2lkdGg6IHZhcigtLXNlcS1saW5lLWhlaWdodHMtNSk7Cn0KLnN0eWxlc19pY29uVmFyaWFudHNfc2l6ZV9tZF9fMXgxMnRiZTMgewogIGhlaWdodDogdmFyKC0tc2VxLWxpbmUtaGVpZ2h0cy02KTsKICB3aWR0aDogdmFyKC0tc2VxLWxpbmUtaGVpZ2h0cy02KTsKfQouc3R5bGVzX2ljb25WYXJpYW50c19zaXplX2xnX18xeDEydGJlNCB7CiAgaGVpZ2h0OiB2YXIoLS1zZXEtbGluZS1oZWlnaHRzLTcpOwogIHdpZHRoOiB2YXIoLS1zZXEtbGluZS1oZWlnaHRzLTcpOwp9Ci5zdHlsZXNfaWNvblZhcmlhbnRzX3NpemVfeGxfXzF4MTJ0YmU1IHsKICBoZWlnaHQ6IHZhcigtLXNlcS1saW5lLWhlaWdodHMtOSk7CiAgd2lkdGg6IHZhcigtLXNlcS1saW5lLWhlaWdodHMtOSk7Cn0=';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var iconVariants = _7a468({defaultClassName:'styles_iconVariants__1x12tbe0',variantClassNames:{size:{xs:'styles_iconVariants_size_xs__1x12tbe1',sm:'styles_iconVariants_size_sm__1x12tbe2',md:'styles_iconVariants_size_md__1x12tbe3',lg:'styles_iconVariants_size_lg__1x12tbe4',xl:'styles_iconVariants_size_xl__1x12tbe5'}},defaultVariants:{},compoundVariants:[]});"],"mappings":"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","names":["r"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/react/_internal/get-provider.ts","../src/react/_internal/types.ts"],"sourcesContent":["export const PROVIDER_ID = 'sdk-provider';\n\nexport function getProviderEl() {\n\tif (!globalThis.document) return null;\n\treturn document.getElementById(PROVIDER_ID);\n}\n","import { ChainId as NetworkChainId } from '@0xsequence/network';\nimport type { ContractType } from '@types';\nimport type { Address } from 'viem';\nimport { z } from 'zod';\n\nexport const QueryArgSchema = z\n\t.object({\n\t\tenabled: z.boolean().optional(),\n\t})\n\t.optional();\n\nexport type QueryArg = z.infer<typeof QueryArgSchema>;\n\nexport const CollectableIdSchema = z.string().or(z.number());\n\nexport const ChainIdSchema = z.union([\n\tz.string(),\n\tz.number(),\n\tz.nativeEnum(NetworkChainId),\n]);\n\nexport const AddressSchema = z.string().transform((val, ctx) => {\n\tconst regex = /^0x[a-fA-F0-9]{40}$/;\n\n\tif (!regex.test(val)) {\n\t\tctx.addIssue({\n\t\t\tcode: z.ZodIssueCode.custom,\n\t\t\tmessage: `Invalid Address ${val}`,\n\t\t});\n\t}\n\n\treturn val as Address;\n});\n\nexport type ChainId = z.infer<typeof ChainIdSchema>;\n\nexport type CollectionType = ContractType.ERC1155 | ContractType.ERC721;\n"],"mappings":";;;AAAO,IAAM,cAAc;AAEpB,SAAS,gBAAgB;AAC/B,MAAI,CAAC,WAAW,SAAU,QAAO;AACjC,SAAO,SAAS,eAAe,WAAW;AAC3C;;;ACLA,SAAS,WAAW,sBAAsB;AAG1C,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAC5B,OAAO;AAAA,EACP,SAAS,EAAE,QAAQ,EAAE,SAAS;AAC/B,CAAC,EACA,SAAS;AAIJ,IAAM,sBAAsB,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC;AAEpD,IAAM,gBAAgB,EAAE,MAAM;AAAA,EACpC,EAAE,OAAO;AAAA,EACT,EAAE,OAAO;AAAA,EACT,EAAE,WAAW,cAAc;AAC5B,CAAC;AAEM,IAAM,gBAAgB,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,QAAQ;AAC/D,QAAM,QAAQ;AAEd,MAAI,CAAC,MAAM,KAAK,GAAG,GAAG;AACrB,QAAI,SAAS;AAAA,MACZ,MAAM,EAAE,aAAa;AAAA,MACrB,SAAS,mBAAmB,GAAG;AAAA,IAChC,CAAC;AAAA,EACF;AAEA,SAAO;AACR,CAAC;","names":[]}