@0xsequence/marketplace-sdk 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-22NLQ3AS.js +3078 -0
- package/dist/chunk-22NLQ3AS.js.map +1 -0
- package/dist/chunk-3OHM45R3.js +1294 -0
- package/dist/chunk-3OHM45R3.js.map +1 -0
- package/dist/{chunk-MQR6SHXZ.js → chunk-4YU2UPYH.js} +58 -103
- package/dist/chunk-4YU2UPYH.js.map +1 -0
- package/dist/chunk-7NJETFMF.js +21 -0
- package/dist/chunk-7NJETFMF.js.map +1 -0
- package/dist/{chunk-UYRQ5MJQ.js → chunk-FUM4OGOQ.js} +4 -4
- package/dist/chunk-FUM4OGOQ.js.map +1 -0
- package/dist/{chunk-7OO74L2K.js → chunk-GJAKQ5Q3.js} +40 -1
- package/dist/chunk-GJAKQ5Q3.js.map +1 -0
- package/dist/chunk-MCI3KOSQ.js +2 -0
- package/dist/{chunk-BJE7AG6V.js → chunk-O7UQGT43.js} +698 -23
- package/dist/chunk-O7UQGT43.js.map +1 -0
- package/dist/{chunk-CSN7YD5Q.js → chunk-Q57TEA3Z.js} +20 -2
- package/dist/chunk-Q57TEA3Z.js.map +1 -0
- package/dist/{chunk-VEX7FDL6.js → chunk-SBVLWSRZ.js} +2 -2
- package/dist/{chunk-VEX7FDL6.js.map → chunk-SBVLWSRZ.js.map} +1 -1
- package/dist/{chunk-6S4FYXP6.js → chunk-SPW24Y7I.js} +40 -1
- package/dist/chunk-SPW24Y7I.js.map +1 -0
- package/dist/chunk-UISBTKFF.js +1 -0
- package/dist/{chunk-OUWB3FHZ.js → chunk-WA433WAJ.js} +9 -33
- package/dist/chunk-WA433WAJ.js.map +1 -0
- package/dist/{chunk-O5JXKTWP.js → chunk-WFE6OCYF.js} +4 -4
- package/dist/chunk-WFE6OCYF.js.map +1 -0
- package/dist/chunk-XX4EVWBF.js +1292 -0
- package/dist/chunk-XX4EVWBF.js.map +1 -0
- package/dist/chunk-Y7YO5TLE.js +53 -0
- package/dist/chunk-Y7YO5TLE.js.map +1 -0
- package/dist/index.css +1 -50
- package/dist/index.d.ts +3 -5
- package/dist/index.js +12 -14
- package/dist/index.js.map +1 -1
- package/dist/react/hooks/index.css +82 -0
- package/dist/react/hooks/index.css.map +1 -0
- package/dist/react/hooks/index.d.ts +401 -462
- package/dist/react/hooks/index.js +26 -6
- package/dist/react/index.css +56 -91
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +32 -13
- package/dist/react/ui/components/index.css +86 -121
- package/dist/react/ui/components/index.css.map +1 -1
- package/dist/react/ui/components/index.d.ts +10 -4
- package/dist/react/ui/components/index.js +12 -11
- package/dist/react/ui/icons/index.js +3 -2
- package/dist/react/ui/icons/index.js.map +1 -1
- package/dist/react/ui/index.css +56 -91
- package/dist/react/ui/index.css.map +1 -1
- package/dist/react/ui/index.d.ts +29 -31
- package/dist/react/ui/index.js +14 -11
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +5 -16
- package/dist/react/ui/modals/_internal/components/actionModal/index.js.map +1 -1
- package/dist/styles/index.css +1 -50
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/index.d.ts +2 -6
- package/dist/styles/index.js +9 -11
- package/dist/utils/abi/index.d.ts +2 -0
- package/dist/utils/abi/index.js +21 -0
- package/dist/utils/abi/marketplace/index.d.ts +805 -0
- package/dist/utils/abi/marketplace/index.js +12 -0
- package/dist/utils/abi/{abi/token → token}/index.js +1 -2
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/index.js +12 -14
- package/package.json +17 -15
- package/src/react/_internal/transaction-machine/execute-transaction.ts +592 -0
- package/src/react/_internal/transaction-machine/useTransactionMachine.ts +66 -0
- package/src/react/hooks/index.ts +4 -0
- package/src/react/hooks/useBuyCollectable.tsx +38 -0
- package/src/react/hooks/useCancelOrder.tsx +38 -0
- package/src/react/hooks/useCheckoutOptions.tsx +9 -6
- package/src/react/hooks/useCreateListing.tsx +65 -0
- package/src/react/hooks/useGenerateBuyTransaction.tsx +71 -0
- package/src/react/hooks/useListListingsForCollectible.tsx +1 -1
- package/src/react/hooks/useMakeOffer.tsx +62 -0
- package/src/react/hooks/useRoyaltyPercentage.tsx +1 -1
- package/src/react/hooks/useSell.tsx +62 -0
- package/src/react/ui/components/_internals/action-button/ActionButton.tsx +107 -115
- package/src/react/ui/components/_internals/custom-select/CustomSelect.tsx +63 -0
- package/src/react/ui/components/_internals/custom-select/styles.css.ts +64 -0
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +127 -130
- package/src/react/ui/components/collectible-card/Footer.tsx +65 -58
- package/src/react/ui/icons/Bell.tsx +2 -2
- package/src/react/ui/index.ts +1 -0
- package/src/react/ui/modals/BuyModal/_store.ts +53 -0
- package/src/react/ui/modals/BuyModal/index.tsx +119 -0
- package/src/react/ui/modals/CreateListingModal/_store.ts +35 -312
- package/src/react/ui/modals/CreateListingModal/index.tsx +185 -126
- package/src/react/ui/modals/MakeOfferModal/_store.ts +34 -276
- package/src/react/ui/modals/MakeOfferModal/index.tsx +195 -136
- package/src/react/ui/modals/SellModal/_store.ts +29 -262
- package/src/react/ui/modals/SellModal/index.tsx +156 -121
- package/src/react/ui/modals/SuccessfulPurchaseModal/_store.ts +17 -3
- package/src/react/ui/modals/SuccessfulPurchaseModal/index.tsx +3 -2
- package/src/react/ui/modals/TransferModal/index.tsx +9 -16
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +1 -0
- package/src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx +18 -0
- package/src/react/ui/modals/_internal/components/actionModal/LoadingModal.tsx +18 -0
- package/src/react/ui/modals/_internal/components/calendarPopover/index.tsx +1 -0
- package/src/react/ui/modals/_internal/components/calendarPopover/overrides.css +8 -0
- package/src/react/ui/modals/_internal/components/calendarPopover/styles.css.ts +10 -4
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +10 -13
- package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +23 -9
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +7 -18
- package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +17 -44
- package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +10 -8
- package/src/react/ui/modals/_internal/components/tokenPreview/index.tsx +14 -3
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +4 -2
- package/src/react/ui/modals/_internal/components/transactionHeader/index.tsx +4 -4
- package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +4 -2
- package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +13 -10
- package/src/react/ui/modals/_internal/types.ts +13 -0
- package/src/react/ui/modals/modal-provider.tsx +4 -2
- package/src/styles/index.ts +0 -2
- package/src/utils/abi/index.ts +2 -0
- package/src/utils/abi/marketplace/index.ts +3 -0
- package/src/utils/abi/marketplace/sequence-marketplace-v1.ts +463 -0
- package/src/utils/abi/marketplace/sequence-marketplace-v2.ts +802 -0
- package/src/utils/index.ts +2 -3
- package/src/utils/network.ts +4 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/chunk-6JWGELXL.js +0 -214
- package/dist/chunk-6JWGELXL.js.map +0 -1
- package/dist/chunk-6S4FYXP6.js.map +0 -1
- package/dist/chunk-7OO74L2K.js.map +0 -1
- package/dist/chunk-BCNFYVAL.js +0 -1
- package/dist/chunk-BJE7AG6V.js.map +0 -1
- package/dist/chunk-CSN7YD5Q.js.map +0 -1
- package/dist/chunk-D7QQP6MS.js +0 -2
- package/dist/chunk-DBFOPEV6.js +0 -23
- package/dist/chunk-DBFOPEV6.js.map +0 -1
- package/dist/chunk-MQR6SHXZ.js.map +0 -1
- package/dist/chunk-O5JXKTWP.js.map +0 -1
- package/dist/chunk-OUWB3FHZ.js.map +0 -1
- package/dist/chunk-PE2LLUTJ.js +0 -213
- package/dist/chunk-PE2LLUTJ.js.map +0 -1
- package/dist/chunk-QVFMD6S2.js +0 -21
- package/dist/chunk-QVFMD6S2.js.map +0 -1
- package/dist/chunk-QXLZPSSR.js +0 -3316
- package/dist/chunk-QXLZPSSR.js.map +0 -1
- package/dist/chunk-UYRQ5MJQ.js.map +0 -1
- package/dist/utils/abi/abi/standard/index.d.ts +0 -25
- package/dist/utils/abi/abi/standard/index.js +0 -8
- package/dist/utils/abi/clients/index.d.ts +0 -27
- package/dist/utils/abi/clients/index.js +0 -13
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/styles.css.ts +0 -33
- package/src/react/ui/modals/_internal/components/expirationDateSelect/styles.css.ts +0 -25
- package/src/utils/abi/abi/standard/index.ts +0 -1
- package/src/utils/abi/clients/ERC1155.ts +0 -82
- package/src/utils/abi/clients/ERC20.ts +0 -101
- package/src/utils/abi/clients/ERC721.ts +0 -97
- package/src/utils/abi/clients/index.ts +0 -3
- /package/dist/{chunk-BCNFYVAL.js.map → chunk-MCI3KOSQ.js.map} +0 -0
- /package/dist/{chunk-D7QQP6MS.js.map → chunk-UISBTKFF.js.map} +0 -0
- /package/dist/utils/abi/{abi/standard/index.js.map → index.js.map} +0 -0
- /package/dist/utils/abi/{abi/token → marketplace}/index.js.map +0 -0
- /package/dist/utils/abi/{abi/token → token}/index.d.ts +0 -0
- /package/dist/utils/abi/{clients → token}/index.js.map +0 -0
- /package/src/react/hooks/{useGenerateCancleTransaction.tsx → useGenerateCancelTransaction.tsx} +0 -0
- /package/src/utils/abi/{abi/standard → marketplace}/EIP2981.ts +0 -0
- /package/src/utils/abi/{abi/token → token}/ERC1155.ts +0 -0
- /package/src/utils/abi/{abi/token → token}/ERC20.ts +0 -0
- /package/src/utils/abi/{abi/token → token}/ERC721.ts +0 -0
- /package/src/utils/abi/{abi/token → token}/index.ts +0 -0
|
@@ -2,7 +2,7 @@ import { Box, NumericInput, TokenImage } from '@0xsequence/design-system';
|
|
|
2
2
|
import type { Observable } from '@legendapp/state';
|
|
3
3
|
import { observer } from '@legendapp/state/react';
|
|
4
4
|
import { useState } from 'react';
|
|
5
|
-
import { type Hex, erc20Abi,
|
|
5
|
+
import { type Hex, erc20Abi, parseUnits } from 'viem';
|
|
6
6
|
import { useAccount, useReadContract } from 'wagmi';
|
|
7
7
|
import type { Price } from '../../../../../../types';
|
|
8
8
|
import CurrencyOptionsSelect from '../currencyOptionsSelect';
|
|
@@ -35,9 +35,10 @@ const PriceInput = observer(function PriceInput({
|
|
|
35
35
|
enabled: checkBalance?.enabled,
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
|
-
const listingPriceAmountRaw = $listingPrice.amountRaw.get();
|
|
39
38
|
const currencyDecimals = $listingPrice.currency.decimals.get();
|
|
40
39
|
|
|
40
|
+
const [value, setValue] = useState('');
|
|
41
|
+
|
|
41
42
|
const checkInsufficientBalance = (priceAmountRaw: string) => {
|
|
42
43
|
const hasInsufficientBalance =
|
|
43
44
|
isBalanceSuccess &&
|
|
@@ -57,11 +58,8 @@ const PriceInput = observer(function PriceInput({
|
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
const changeListingPrice = (value: string) => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
Number($listingPrice.currency.decimals.get()),
|
|
63
|
-
);
|
|
64
|
-
|
|
61
|
+
setValue(value);
|
|
62
|
+
const parsedAmount = parseUnits(value, Number(currencyDecimals));
|
|
65
63
|
$listingPrice.amountRaw.set(parsedAmount.toString());
|
|
66
64
|
checkBalance && checkInsufficientBalance(parsedAmount.toString());
|
|
67
65
|
};
|
|
@@ -80,10 +78,9 @@ const PriceInput = observer(function PriceInput({
|
|
|
80
78
|
|
|
81
79
|
<NumericInput
|
|
82
80
|
name="listingPrice"
|
|
83
|
-
decimals={
|
|
81
|
+
decimals={currencyDecimals}
|
|
84
82
|
label="Enter price"
|
|
85
83
|
labelLocation="top"
|
|
86
|
-
placeholder="0.00"
|
|
87
84
|
controls={
|
|
88
85
|
<CurrencyOptionsSelect
|
|
89
86
|
$selectedCurrency={$listingPrice?.currency}
|
|
@@ -91,15 +88,7 @@ const PriceInput = observer(function PriceInput({
|
|
|
91
88
|
chainId={chainId}
|
|
92
89
|
/>
|
|
93
90
|
}
|
|
94
|
-
|
|
95
|
-
value={
|
|
96
|
-
listingPriceAmountRaw
|
|
97
|
-
? formatUnits(
|
|
98
|
-
BigInt(listingPriceAmountRaw),
|
|
99
|
-
Number(currencyDecimals),
|
|
100
|
-
)
|
|
101
|
-
: ''
|
|
102
|
-
}
|
|
91
|
+
value={value}
|
|
103
92
|
onChange={(event) => changeListingPrice(event.target.value)}
|
|
104
93
|
width="full"
|
|
105
94
|
/>
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import { Close, Content, Overlay, Portal, Root } from '@radix-ui/react-dialog';
|
|
2
|
-
import { switchChainModal$ } from './store';
|
|
3
|
-
import {
|
|
4
|
-
closeButton,
|
|
5
|
-
dialogOverlay,
|
|
6
|
-
switchChainCta,
|
|
7
|
-
switchChainModalContent,
|
|
8
|
-
} from './styles.css';
|
|
9
1
|
import {
|
|
10
2
|
Button,
|
|
11
3
|
CloseIcon,
|
|
@@ -13,20 +5,25 @@ import {
|
|
|
13
5
|
Spinner,
|
|
14
6
|
Text,
|
|
15
7
|
} from '@0xsequence/design-system';
|
|
16
|
-
import AlertMessage from '../alertMessage';
|
|
17
8
|
import { observer } from '@legendapp/state/react';
|
|
9
|
+
import { Close, Content, Overlay, Portal, Root } from '@radix-ui/react-dialog';
|
|
10
|
+
import type { SwitchChainErrorType } from 'viem';
|
|
18
11
|
import { useSwitchChain } from 'wagmi';
|
|
19
|
-
import { BaseError } from 'viem';
|
|
20
12
|
import { getPresentableChainName } from '../../../../../../utils/network';
|
|
21
|
-
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
24
|
-
import
|
|
13
|
+
import type { ChainId } from '../../../../../_internal';
|
|
14
|
+
import AlertMessage from '../alertMessage';
|
|
15
|
+
import { switchChainModal$ } from './store';
|
|
16
|
+
import {
|
|
17
|
+
closeButton,
|
|
18
|
+
dialogOverlay,
|
|
19
|
+
switchChainCta,
|
|
20
|
+
switchChainModalContent,
|
|
21
|
+
} from './styles.css';
|
|
25
22
|
|
|
26
23
|
export type ShowSwitchChainModalArgs = {
|
|
27
|
-
chainIdToSwitchTo:
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
chainIdToSwitchTo: ChainId;
|
|
25
|
+
onSuccess?: () => void;
|
|
26
|
+
onError?: (error: SwitchChainErrorType) => void;
|
|
30
27
|
};
|
|
31
28
|
|
|
32
29
|
export const useSwitchChainModal = () => {
|
|
@@ -42,42 +39,18 @@ const SwitchChainModal = observer(() => {
|
|
|
42
39
|
const isSwitching$ = switchChainModal$.state.isSwitching;
|
|
43
40
|
const chainName = getPresentableChainName(chainIdToSwitchTo!);
|
|
44
41
|
const { switchChainAsync } = useSwitchChain();
|
|
45
|
-
const {
|
|
46
|
-
onSwitchingNotSupported,
|
|
47
|
-
onUserRejectedRequest,
|
|
48
|
-
onUnknownError,
|
|
49
|
-
onSuccess,
|
|
50
|
-
}: Partial<SwitchChainCallbacks> =
|
|
51
|
-
switchChainModal$.state.callbacks.get() || {};
|
|
52
42
|
|
|
53
43
|
async function handleSwitchChain() {
|
|
54
44
|
isSwitching$.set(true);
|
|
55
45
|
|
|
56
46
|
try {
|
|
57
|
-
await switchChainAsync({ chainId: chainIdToSwitchTo! });
|
|
47
|
+
await switchChainAsync({ chainId: Number(chainIdToSwitchTo!) });
|
|
58
48
|
|
|
59
|
-
switchChainModal$.state.
|
|
60
|
-
onSuccess && onSuccess();
|
|
49
|
+
switchChainModal$.state.onSuccess?.();
|
|
61
50
|
|
|
62
51
|
switchChainModal$.close();
|
|
63
52
|
} catch (error) {
|
|
64
|
-
|
|
65
|
-
const name = error.name as BaseError['name'];
|
|
66
|
-
|
|
67
|
-
switch (name) {
|
|
68
|
-
case SwitchChainNotSupportedError.name:
|
|
69
|
-
onSwitchingNotSupported && onSwitchingNotSupported();
|
|
70
|
-
break;
|
|
71
|
-
case UserRejectedRequestError.name:
|
|
72
|
-
onUserRejectedRequest && onUserRejectedRequest();
|
|
73
|
-
break;
|
|
74
|
-
default:
|
|
75
|
-
onUnknownError && onUnknownError(error);
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
} else {
|
|
79
|
-
onUnknownError && onUnknownError(error);
|
|
80
|
-
}
|
|
53
|
+
switchChainModal$.state.onError?.(error as SwitchChainErrorType);
|
|
81
54
|
} finally {
|
|
82
55
|
isSwitching$.set(false);
|
|
83
56
|
}
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { observable } from '@legendapp/state';
|
|
2
|
+
import type { SwitchChainErrorType } from 'viem';
|
|
2
3
|
import type { ShowSwitchChainModalArgs } from '.';
|
|
3
|
-
import type {
|
|
4
|
+
import type { ChainId } from '../../../../../_internal';
|
|
4
5
|
|
|
5
6
|
export interface SwitchChainModalState {
|
|
6
7
|
isOpen: boolean;
|
|
7
8
|
open: (args: ShowSwitchChainModalArgs) => void;
|
|
8
9
|
close: () => void;
|
|
9
10
|
state: {
|
|
10
|
-
chainIdToSwitchTo
|
|
11
|
-
onSwitchChain?: () => void;
|
|
11
|
+
chainIdToSwitchTo: ChainId | undefined;
|
|
12
12
|
isSwitching: boolean;
|
|
13
|
-
|
|
13
|
+
onSuccess: (() => void) | undefined;
|
|
14
|
+
onError: undefined | ((error: SwitchChainErrorType) => void);
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export const initialState: SwitchChainModalState = {
|
|
18
19
|
isOpen: false,
|
|
19
|
-
open: ({ chainIdToSwitchTo,
|
|
20
|
+
open: ({ chainIdToSwitchTo, onError, onSuccess }) => {
|
|
20
21
|
switchChainModal$.state.set({
|
|
21
22
|
...switchChainModal$.state.get(),
|
|
22
23
|
chainIdToSwitchTo,
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
onError,
|
|
25
|
+
onSuccess,
|
|
25
26
|
});
|
|
26
27
|
switchChainModal$.isOpen.set(true);
|
|
27
28
|
},
|
|
@@ -33,7 +34,8 @@ export const initialState: SwitchChainModalState = {
|
|
|
33
34
|
},
|
|
34
35
|
state: {
|
|
35
36
|
chainIdToSwitchTo: undefined,
|
|
36
|
-
|
|
37
|
+
onError: undefined,
|
|
38
|
+
onSuccess: undefined,
|
|
37
39
|
isSwitching: false,
|
|
38
40
|
},
|
|
39
41
|
};
|
|
@@ -2,6 +2,7 @@ import { Box, Image, Skeleton, Text } from '@0xsequence/design-system';
|
|
|
2
2
|
import type { Hex } from 'viem';
|
|
3
3
|
import { useCollectible } from '../../../../../hooks';
|
|
4
4
|
import { tokenPreview } from './styles.css';
|
|
5
|
+
import ChessTileImage from '../../../../images/chess-tile.png';
|
|
5
6
|
|
|
6
7
|
type TokenPreviewProps = {
|
|
7
8
|
collectionName?: string;
|
|
@@ -38,7 +39,7 @@ export default function TokenPreview({
|
|
|
38
39
|
return (
|
|
39
40
|
<Box className={tokenPreview}>
|
|
40
41
|
<Image
|
|
41
|
-
src={collectable?.image}
|
|
42
|
+
src={collectable?.image || ChessTileImage}
|
|
42
43
|
alt={collectable?.name}
|
|
43
44
|
width={'9'}
|
|
44
45
|
height={'9'}
|
|
@@ -46,11 +47,21 @@ export default function TokenPreview({
|
|
|
46
47
|
/>
|
|
47
48
|
|
|
48
49
|
<Box display={'flex'} flexDirection={'column'} marginLeft={'3'}>
|
|
49
|
-
<Text
|
|
50
|
+
<Text
|
|
51
|
+
fontSize={'small'}
|
|
52
|
+
color={'text80'}
|
|
53
|
+
fontWeight={'medium'}
|
|
54
|
+
fontFamily="body"
|
|
55
|
+
>
|
|
50
56
|
{collectionName}
|
|
51
57
|
</Text>
|
|
52
58
|
|
|
53
|
-
<Text
|
|
59
|
+
<Text
|
|
60
|
+
fontSize={'small'}
|
|
61
|
+
fontWeight={'bold'}
|
|
62
|
+
color={'text100'}
|
|
63
|
+
fontFamily="body"
|
|
64
|
+
>
|
|
54
65
|
{collectable?.name}
|
|
55
66
|
</Text>
|
|
56
67
|
</Box>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box,
|
|
1
|
+
import { Box, Image, Skeleton, Text } from '@0xsequence/design-system';
|
|
2
2
|
import { type Hex, formatUnits } from 'viem';
|
|
3
3
|
import type { Price } from '../../../../../../types';
|
|
4
4
|
import {
|
|
@@ -11,6 +11,7 @@ type TransactionDetailsProps = {
|
|
|
11
11
|
collectionAddress: Hex;
|
|
12
12
|
chainId: string;
|
|
13
13
|
price?: Price;
|
|
14
|
+
currencyImageUrl?: string;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
//TODO: Move this
|
|
@@ -21,6 +22,7 @@ export default function TransactionDetails({
|
|
|
21
22
|
collectionAddress,
|
|
22
23
|
chainId,
|
|
23
24
|
price,
|
|
25
|
+
currencyImageUrl,
|
|
24
26
|
}: TransactionDetailsProps) {
|
|
25
27
|
const { data, isLoading: marketplaceConfigLoading } = useMarketplaceConfig();
|
|
26
28
|
|
|
@@ -67,7 +69,7 @@ export default function TransactionDetails({
|
|
|
67
69
|
</Text>
|
|
68
70
|
|
|
69
71
|
<Box display="flex" alignItems="center" gap="2">
|
|
70
|
-
<
|
|
72
|
+
<Image src={currencyImageUrl} width="3" height="3" />
|
|
71
73
|
|
|
72
74
|
{priceLoading ? (
|
|
73
75
|
<Skeleton width="16" height={'4'} />
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Box,
|
|
1
|
+
import { Box, Image, Skeleton, Text } from '@0xsequence/design-system';
|
|
2
2
|
import { formatDistanceToNow } from 'date-fns';
|
|
3
3
|
|
|
4
4
|
type TransactionHeaderProps = {
|
|
5
5
|
title: string;
|
|
6
|
-
|
|
6
|
+
currencyImageUrl?: string;
|
|
7
7
|
date?: Date;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export default function TransactionHeader({
|
|
11
11
|
title,
|
|
12
|
-
|
|
12
|
+
currencyImageUrl,
|
|
13
13
|
date,
|
|
14
14
|
}: TransactionHeaderProps) {
|
|
15
15
|
return (
|
|
@@ -18,7 +18,7 @@ export default function TransactionHeader({
|
|
|
18
18
|
{title}
|
|
19
19
|
</Text>
|
|
20
20
|
|
|
21
|
-
<
|
|
21
|
+
<Image src={currencyImageUrl} width="3" height="3" marginRight="1" />
|
|
22
22
|
|
|
23
23
|
{(date && (
|
|
24
24
|
<Text fontSize="small" color="text50" flexGrow="1" textAlign="right">
|
|
@@ -2,17 +2,18 @@ import { Box, Image, NetworkImage, Text } from '@0xsequence/design-system';
|
|
|
2
2
|
import { observer } from '@legendapp/state/react';
|
|
3
3
|
import { type Hex, formatUnits } from 'viem';
|
|
4
4
|
import type { Price } from '../../../../../../types';
|
|
5
|
-
import type { TokenMetadata } from '../../../../../_internal';
|
|
6
5
|
import { useCollection } from '../../../../../hooks';
|
|
7
6
|
import TimeAgo from '../timeAgo';
|
|
8
7
|
import { transactionStatusModal$ } from '../transactionStatusModal/store';
|
|
9
8
|
import { useTransactionPreviewTitle } from './useTransactionPreviewTitle';
|
|
9
|
+
import type { TokenMetadata } from '@0xsequence/metadata';
|
|
10
10
|
|
|
11
11
|
type TransactionPreviewProps = {
|
|
12
12
|
price?: Price;
|
|
13
13
|
collectionAddress: Hex;
|
|
14
14
|
chainId: string;
|
|
15
15
|
collectible: TokenMetadata;
|
|
16
|
+
currencyImageUrl?: string;
|
|
16
17
|
isConfirming: boolean;
|
|
17
18
|
isConfirmed: boolean;
|
|
18
19
|
isFailed: boolean;
|
|
@@ -24,6 +25,7 @@ const TransactionPreview = observer(
|
|
|
24
25
|
collectionAddress,
|
|
25
26
|
chainId,
|
|
26
27
|
collectible,
|
|
28
|
+
currencyImageUrl,
|
|
27
29
|
isConfirming,
|
|
28
30
|
isConfirmed,
|
|
29
31
|
isFailed,
|
|
@@ -95,7 +97,7 @@ const TransactionPreview = observer(
|
|
|
95
97
|
justifyContent="flex-end"
|
|
96
98
|
gap="1"
|
|
97
99
|
>
|
|
98
|
-
<
|
|
100
|
+
<Image src={currencyImageUrl} width="3" height="3" />
|
|
99
101
|
|
|
100
102
|
<Text color="text80" fontSize="small" fontWeight="medium">
|
|
101
103
|
{priceFormatted} {price!.currency.symbol}
|
|
@@ -10,7 +10,7 @@ import type { QueryKey } from '@tanstack/react-query';
|
|
|
10
10
|
import { useEffect } from 'react';
|
|
11
11
|
import type { Hex } from 'viem';
|
|
12
12
|
import { useTransactionReceipt } from 'wagmi';
|
|
13
|
-
import type { Price
|
|
13
|
+
import type { Price } from '../../../../../../types';
|
|
14
14
|
import type { BaseCallbacks } from '../../../../../../types/callbacks';
|
|
15
15
|
import { getQueryClient } from '../../../../../_internal';
|
|
16
16
|
import { useCollectible } from '../../../../../hooks';
|
|
@@ -121,15 +121,18 @@ const TransactionStatusModal = observer(() => {
|
|
|
121
121
|
<Skeleton width="20" height="4" />
|
|
122
122
|
)}
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
{collectible && (
|
|
125
|
+
<TransactionPreview
|
|
126
|
+
price={price}
|
|
127
|
+
collectionAddress={collectionAddress}
|
|
128
|
+
chainId={chainId}
|
|
129
|
+
collectible={collectible}
|
|
130
|
+
currencyImageUrl={price?.currency.imageUrl}
|
|
131
|
+
isConfirming={isConfirming}
|
|
132
|
+
isConfirmed={isConfirmed}
|
|
133
|
+
isFailed={isFailed}
|
|
134
|
+
/>
|
|
135
|
+
)}
|
|
133
136
|
|
|
134
137
|
<TransactionFooter
|
|
135
138
|
transactionHash={hash!}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Hash, Hex } from 'viem';
|
|
2
|
+
|
|
3
|
+
export type ModalCallbacks = {
|
|
4
|
+
onSuccess?: (hash: Hash) => void;
|
|
5
|
+
onError?: (error: Error) => void;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type BaseModalState = {
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
chainId: string;
|
|
11
|
+
collectionAddress: Hex;
|
|
12
|
+
callbacks?: ModalCallbacks;
|
|
13
|
+
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { observer } from '@legendapp/state/react';
|
|
2
|
+
import SwitchChainModal from './_internal/components/switchChainModal';
|
|
3
|
+
import TransactionStatusModal from './_internal/components/transactionStatusModal';
|
|
2
4
|
import { AccountModal } from './Account';
|
|
3
5
|
import { CreateListingModal } from './CreateListingModal';
|
|
4
6
|
import { MakeOfferModal } from './MakeOfferModal';
|
|
5
7
|
import { SellModal } from './SellModal';
|
|
6
8
|
import SuccessfulPurchaseModal from './SuccessfulPurchaseModal';
|
|
7
9
|
import { TransferModal } from './TransferModal';
|
|
8
|
-
import SwitchChainModal from './_internal/components/switchChainModal';
|
|
9
|
-
import TransactionStatusModal from './_internal/components/transactionStatusModal';
|
|
10
10
|
import { _accountModalOpen$ } from './_internal/stores/accountModal';
|
|
11
|
+
import { BuyModal } from './BuyModal';
|
|
11
12
|
|
|
12
13
|
export const ModalProvider = observer(() => {
|
|
13
14
|
return (
|
|
@@ -17,6 +18,7 @@ export const ModalProvider = observer(() => {
|
|
|
17
18
|
<MakeOfferModal />
|
|
18
19
|
<TransferModal />
|
|
19
20
|
<SellModal />
|
|
21
|
+
<BuyModal />
|
|
20
22
|
<SuccessfulPurchaseModal />
|
|
21
23
|
{/* Helper modals */}
|
|
22
24
|
<SwitchChainModal />
|
package/src/styles/index.ts
CHANGED
|
@@ -4,8 +4,6 @@ export * from '../react/ui/icons/styles.css';
|
|
|
4
4
|
/* modal components styles */
|
|
5
5
|
export * from '../react/ui/modals/_internal/components/actionModal/styles.css';
|
|
6
6
|
export * from '../react/ui/modals/_internal/components/calendarPopover/styles.css';
|
|
7
|
-
export * from '../react/ui/modals/_internal/components/currencyOptionsSelect/styles.css';
|
|
8
|
-
export * from '../react/ui/modals/_internal/components/expirationDateSelect/styles.css';
|
|
9
7
|
export * from '../react/ui/modals/_internal/components/priceInput/styles.css';
|
|
10
8
|
export * from '../react/ui/modals/_internal/components/quantityInput/styles.css';
|
|
11
9
|
export * from '../react/ui/modals/_internal/components/tokenPreview/styles.css';
|