@0xsequence/marketplace-sdk 0.3.1 → 0.3.3
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-O7UQGT43.js → chunk-RJK7PUJE.js} +13 -5
- package/dist/{chunk-O7UQGT43.js.map → chunk-RJK7PUJE.js.map} +1 -1
- package/dist/{chunk-WA433WAJ.js → chunk-RZSZNVEH.js} +16 -2
- package/dist/chunk-RZSZNVEH.js.map +1 -0
- package/dist/{chunk-22NLQ3AS.js → chunk-ZZMM3IVS.js} +296 -197
- package/dist/chunk-ZZMM3IVS.js.map +1 -0
- package/dist/index.css +40 -0
- package/dist/index.js +71 -158
- package/dist/react/hooks/index.js +2 -2
- package/dist/react/index.js +4 -4
- package/dist/react/ui/components/index.d.ts +1 -1
- package/dist/react/ui/components/index.js +4 -4
- package/dist/react/ui/index.js +4 -4
- package/dist/styles/index.css +40 -0
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/index.d.ts +8 -1
- package/dist/styles/index.js +13 -1
- package/package.json +5 -2
- package/src/react/_internal/transaction-machine/execute-transaction.ts +14 -3
- package/src/react/ui/components/_internals/custom-select/CustomSelect.tsx +2 -2
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +2 -2
- package/src/react/ui/components/collectible-card/Footer.tsx +33 -29
- package/src/react/ui/modals/BuyModal/_store.ts +4 -1
- package/src/react/ui/modals/BuyModal/index.tsx +77 -49
- package/src/react/ui/modals/CreateListingModal/index.tsx +10 -6
- package/src/react/ui/modals/MakeOfferModal/index.tsx +11 -3
- package/src/react/ui/modals/SellModal/index.tsx +14 -6
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +2 -1
- package/src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/alertMessage/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +2 -7
- package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +1 -0
- package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +1 -0
- package/src/react/ui/modals/_internal/components/transaction-footer/index.tsx +30 -9
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +2 -2
- package/src/react/ui/modals/_internal/components/transactionHeader/index.tsx +14 -2
- package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +16 -4
- package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +12 -4
- package/src/styles/index.ts +3 -0
- package/tsup.config.ts +3 -0
- package/dist/chess-tile-6BS5MQT5.png +0 -0
- package/dist/chunk-22NLQ3AS.js.map +0 -1
- package/dist/chunk-WA433WAJ.js.map +0 -1
|
@@ -51,6 +51,7 @@ export const Footer = ({
|
|
|
51
51
|
alignItems="center"
|
|
52
52
|
justifyContent="space-between"
|
|
53
53
|
position="relative"
|
|
54
|
+
width="full"
|
|
54
55
|
>
|
|
55
56
|
<Text
|
|
56
57
|
color="text100"
|
|
@@ -64,8 +65,12 @@ export const Footer = ({
|
|
|
64
65
|
|
|
65
66
|
{highestOffer && onOfferClick && (
|
|
66
67
|
<IconButton
|
|
68
|
+
size="xs"
|
|
67
69
|
variant="primary"
|
|
68
70
|
className={offerBellButton}
|
|
71
|
+
position="absolute"
|
|
72
|
+
right="0"
|
|
73
|
+
top="0"
|
|
69
74
|
onClick={(e) => {
|
|
70
75
|
e.stopPropagation();
|
|
71
76
|
onOfferClick?.();
|
|
@@ -94,35 +99,34 @@ export const Footer = ({
|
|
|
94
99
|
</Box>
|
|
95
100
|
)}
|
|
96
101
|
|
|
97
|
-
{
|
|
98
|
-
<Text
|
|
99
|
-
background="backgroundSecondary"
|
|
100
|
-
color="text80"
|
|
101
|
-
fontSize="small"
|
|
102
|
-
textAlign="left"
|
|
103
|
-
fontFamily="body"
|
|
104
|
-
paddingX="2"
|
|
105
|
-
paddingY="1"
|
|
106
|
-
borderRadius="sm"
|
|
107
|
-
>
|
|
108
|
-
Owned: {balance}
|
|
109
|
-
</Text>
|
|
110
|
-
)}
|
|
111
|
-
|
|
112
|
-
{type === ContractType.ERC721 && (
|
|
113
|
-
<Text
|
|
114
|
-
background="backgroundSecondary"
|
|
115
|
-
color="text80"
|
|
116
|
-
fontSize="small"
|
|
117
|
-
textAlign="left"
|
|
118
|
-
fontFamily="body"
|
|
119
|
-
paddingX="2"
|
|
120
|
-
paddingY="1"
|
|
121
|
-
borderRadius="sm"
|
|
122
|
-
>
|
|
123
|
-
ERC-721
|
|
124
|
-
</Text>
|
|
125
|
-
)}
|
|
102
|
+
<TokenTypeBalancePill balance={balance} type={type as ContractType} />
|
|
126
103
|
</Box>
|
|
127
104
|
);
|
|
128
105
|
};
|
|
106
|
+
|
|
107
|
+
const TokenTypeBalancePill = ({
|
|
108
|
+
balance,
|
|
109
|
+
type,
|
|
110
|
+
}: { balance?: string; type: ContractType }) => {
|
|
111
|
+
const displayText =
|
|
112
|
+
type === ContractType.ERC1155
|
|
113
|
+
? !!balance
|
|
114
|
+
? `Owned: ${balance}`
|
|
115
|
+
: 'ERC-1155'
|
|
116
|
+
: 'ERC-721';
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<Text
|
|
120
|
+
background="backgroundSecondary"
|
|
121
|
+
color="text80"
|
|
122
|
+
fontSize="small"
|
|
123
|
+
textAlign="left"
|
|
124
|
+
fontFamily="body"
|
|
125
|
+
paddingX="2"
|
|
126
|
+
paddingY="1"
|
|
127
|
+
borderRadius="sm"
|
|
128
|
+
>
|
|
129
|
+
{displayText}
|
|
130
|
+
</Text>
|
|
131
|
+
);
|
|
132
|
+
};
|
|
@@ -15,6 +15,7 @@ export interface BuyModalState {
|
|
|
15
15
|
state: {
|
|
16
16
|
order: Order;
|
|
17
17
|
quantity: string;
|
|
18
|
+
modalId: number;
|
|
18
19
|
};
|
|
19
20
|
callbacks?: ModalCallbacks;
|
|
20
21
|
}
|
|
@@ -30,8 +31,9 @@ export const initialState: BuyModalState = {
|
|
|
30
31
|
defaultCallbacks?: ModalCallbacks;
|
|
31
32
|
}) => {
|
|
32
33
|
buyModal$.state.set({
|
|
33
|
-
|
|
34
|
+
quantity: args.order.quantityAvailableFormatted,
|
|
34
35
|
order: args.order,
|
|
36
|
+
modalId: buyModal$.state.modalId.get() + 1,
|
|
35
37
|
});
|
|
36
38
|
buyModal$.callbacks.set(callbacks || defaultCallbacks);
|
|
37
39
|
buyModal$.isOpen.set(true);
|
|
@@ -46,6 +48,7 @@ export const initialState: BuyModalState = {
|
|
|
46
48
|
state: {
|
|
47
49
|
order: undefined as unknown as Order,
|
|
48
50
|
quantity: '1',
|
|
51
|
+
modalId: 0
|
|
49
52
|
},
|
|
50
53
|
callbacks: undefined,
|
|
51
54
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { Hex } from 'viem';
|
|
2
2
|
import { buyModal$ } from './_store';
|
|
3
|
-
import { ContractType, type Order } from '../../../_internal';
|
|
4
|
-
import { observer, useSelector } from '@legendapp/state/react';
|
|
3
|
+
import { ContractType, MarketplaceKind, type Order } from '../../../_internal';
|
|
4
|
+
import { observer, Show, useSelector } from '@legendapp/state/react';
|
|
5
5
|
import { useCollectible, useCollection } from '../../../hooks';
|
|
6
6
|
import { ActionModal } from '../_internal/components/actionModal';
|
|
7
7
|
import { useEffect } from 'react';
|
|
8
8
|
import QuantityInput from '..//_internal/components/quantityInput';
|
|
9
9
|
import { useBuyCollectable } from '../../../hooks/useBuyCollectable';
|
|
10
10
|
import type { ModalCallbacks } from '../_internal/types';
|
|
11
|
+
import { TokenMetadata } from '@0xsequence/indexer';
|
|
11
12
|
|
|
12
13
|
export type ShowBuyModalArgs = {
|
|
13
14
|
chainId: string;
|
|
@@ -24,28 +25,22 @@ export const useBuyModal = (callbacks?: ModalCallbacks) => {
|
|
|
24
25
|
};
|
|
25
26
|
};
|
|
26
27
|
|
|
27
|
-
export const BuyModal = () =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
});
|
|
28
|
+
export const BuyModal = () => (
|
|
29
|
+
<Show if={buyModal$.isOpen}>
|
|
30
|
+
<BuyModalContent />
|
|
31
|
+
</Show>
|
|
32
|
+
);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<ERC1155QuantityModal />
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const CheckoutModal = observer(() => {
|
|
44
|
-
const order = buyModal$.state.order.get();
|
|
45
|
-
const chainId = String(order.chainId);
|
|
46
|
-
const collectionAddress = order.collectionContractAddress as Hex;
|
|
47
|
-
const collectibleId = order.tokenId;
|
|
34
|
+
export const BuyModalContent = () => {
|
|
35
|
+
const chainId = String(useSelector(buyModal$.state.order.chainId))
|
|
36
|
+
const collectionAddress = useSelector(buyModal$.state.order.collectionContractAddress) as Hex
|
|
37
|
+
const collectibleId = useSelector(buyModal$.state.order.tokenId)
|
|
38
|
+
const modalId = useSelector(buyModal$.state.modalId)
|
|
48
39
|
|
|
40
|
+
const { data: collection } = useCollection({
|
|
41
|
+
chainId,
|
|
42
|
+
collectionAddress,
|
|
43
|
+
});
|
|
49
44
|
const { buy } = useBuyCollectable({
|
|
50
45
|
chainId,
|
|
51
46
|
collectionAddress,
|
|
@@ -57,39 +52,72 @@ const CheckoutModal = observer(() => {
|
|
|
57
52
|
collectibleId,
|
|
58
53
|
});
|
|
59
54
|
|
|
60
|
-
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
if (!collectable) return;
|
|
63
|
-
buy({
|
|
64
|
-
orderId: order.orderId,
|
|
65
|
-
collectableDecimals: collectable.decimals || 0,
|
|
66
|
-
quantity: '1',
|
|
67
|
-
marketplace: order.marketplace,
|
|
68
|
-
});
|
|
69
|
-
}, [order, collectable]);
|
|
55
|
+
if (modalId == 0 || !collection || !collectable || !buy) return null;
|
|
70
56
|
|
|
71
|
-
return
|
|
72
|
-
|
|
57
|
+
return collection.type === ContractType.ERC721 ? (
|
|
58
|
+
<CheckoutModal
|
|
59
|
+
key={modalId}
|
|
60
|
+
buy={buy}
|
|
61
|
+
collectable={collectable}
|
|
62
|
+
order={buyModal$.state.order.get()}
|
|
63
|
+
/>
|
|
64
|
+
) : (
|
|
65
|
+
<ERC1155QuantityModal
|
|
66
|
+
buy={buy}
|
|
67
|
+
collectable={collectable}
|
|
68
|
+
order={buyModal$.state.order.get()}
|
|
69
|
+
chainId={chainId}
|
|
70
|
+
collectionAddress={collectionAddress}
|
|
71
|
+
collectibleId={collectibleId}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
73
75
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
interface CheckoutModalProps {
|
|
77
|
+
buy: (params: {
|
|
78
|
+
orderId: string;
|
|
79
|
+
collectableDecimals: number;
|
|
80
|
+
quantity: string;
|
|
81
|
+
marketplace: MarketplaceKind;
|
|
82
|
+
}) => void;
|
|
83
|
+
collectable: TokenMetadata;
|
|
84
|
+
order: Order;
|
|
85
|
+
}
|
|
79
86
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
function CheckoutModal({ buy, collectable, order }: CheckoutModalProps) {
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
const executeBuy = () => {
|
|
90
|
+
console.log('executeBuy');
|
|
91
|
+
if (!collectable) return;
|
|
92
|
+
buy({
|
|
93
|
+
orderId: order.orderId,
|
|
94
|
+
collectableDecimals: collectable.decimals || 0,
|
|
95
|
+
quantity: '1',
|
|
96
|
+
marketplace: order.marketplace,
|
|
97
|
+
});
|
|
98
|
+
buyModal$.close();
|
|
99
|
+
};
|
|
84
100
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
collectionAddress,
|
|
88
|
-
collectibleId,
|
|
89
|
-
});
|
|
101
|
+
executeBuy();
|
|
102
|
+
}, []);
|
|
90
103
|
|
|
91
|
-
|
|
104
|
+
return <></>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
interface ERC1155QuantityModalProps extends CheckoutModalProps {
|
|
108
|
+
chainId: string;
|
|
109
|
+
collectionAddress: Hex;
|
|
110
|
+
collectibleId: string;
|
|
111
|
+
}
|
|
92
112
|
|
|
113
|
+
const ERC1155QuantityModal = observer(({
|
|
114
|
+
buy,
|
|
115
|
+
collectable,
|
|
116
|
+
order,
|
|
117
|
+
chainId,
|
|
118
|
+
collectionAddress,
|
|
119
|
+
collectibleId
|
|
120
|
+
}: ERC1155QuantityModalProps) => {
|
|
93
121
|
return (
|
|
94
122
|
<ActionModal
|
|
95
123
|
store={buyModal$}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Box } from '@0xsequence/design-system';
|
|
2
2
|
import { Show, observer } from '@legendapp/state/react';
|
|
3
|
+
import type { QueryKey } from '@tanstack/react-query';
|
|
3
4
|
import type { Hash, Hex } from 'viem';
|
|
4
5
|
import {
|
|
5
|
-
collectableKeys,
|
|
6
6
|
type ContractType,
|
|
7
7
|
StepType,
|
|
8
|
+
collectableKeys,
|
|
8
9
|
} from '../../../_internal';
|
|
9
10
|
import { useCollectible, useCollection } from '../../../hooks';
|
|
10
11
|
import { useCreateListing } from '../../../hooks/useCreateListing';
|
|
@@ -12,6 +13,8 @@ import {
|
|
|
12
13
|
ActionModal,
|
|
13
14
|
type ActionModalProps,
|
|
14
15
|
} from '../_internal/components/actionModal/ActionModal';
|
|
16
|
+
import { ErrorModal } from '../_internal/components/actionModal/ErrorModal';
|
|
17
|
+
import { LoadingModal } from '../_internal/components/actionModal/LoadingModal';
|
|
15
18
|
import ExpirationDateSelect from '../_internal/components/expirationDateSelect';
|
|
16
19
|
import FloorPriceText from '../_internal/components/floorPriceText';
|
|
17
20
|
import PriceInput from '../_internal/components/priceInput';
|
|
@@ -19,15 +22,12 @@ import QuantityInput from '../_internal/components/quantityInput';
|
|
|
19
22
|
import TokenPreview from '../_internal/components/tokenPreview';
|
|
20
23
|
import TransactionDetails from '../_internal/components/transactionDetails';
|
|
21
24
|
import { useTransactionStatusModal } from '../_internal/components/transactionStatusModal';
|
|
25
|
+
import type { ModalCallbacks } from '../_internal/types';
|
|
22
26
|
import { createListingModal$ } from './_store';
|
|
23
27
|
import {
|
|
24
28
|
getCreateListingTransactionMessage,
|
|
25
29
|
getCreateListingTransactionTitle,
|
|
26
30
|
} from './_utils/getCreateListingTransactionTitleMessage';
|
|
27
|
-
import { LoadingModal } from '../_internal/components/actionModal/LoadingModal';
|
|
28
|
-
import { ErrorModal } from '../_internal/components/actionModal/ErrorModal';
|
|
29
|
-
import type { ModalCallbacks } from '../_internal/types';
|
|
30
|
-
import type { QueryKey } from '@tanstack/react-query';
|
|
31
31
|
|
|
32
32
|
export type ShowCreateListingModalArgs = {
|
|
33
33
|
collectionAddress: Hex;
|
|
@@ -104,7 +104,11 @@ export const Modal = observer(
|
|
|
104
104
|
createListingModal$.close();
|
|
105
105
|
},
|
|
106
106
|
onError: (error) => {
|
|
107
|
-
createListingModal$.onError
|
|
107
|
+
if (typeof createListingModal$.callbacks?.onError === 'function') {
|
|
108
|
+
createListingModal$.onError(error);
|
|
109
|
+
} else {
|
|
110
|
+
console.debug('onError callback not provided:', error);
|
|
111
|
+
}
|
|
108
112
|
},
|
|
109
113
|
});
|
|
110
114
|
|
|
@@ -100,11 +100,19 @@ const ModalContent = observer(
|
|
|
100
100
|
makeOfferModal$.close();
|
|
101
101
|
},
|
|
102
102
|
onSuccess: (hash) => {
|
|
103
|
-
makeOfferModal$.callbacks?.onSuccess
|
|
103
|
+
if (typeof makeOfferModal$.callbacks?.onSuccess === 'function') {
|
|
104
|
+
makeOfferModal$.callbacks.onSuccess(hash);
|
|
105
|
+
} else {
|
|
106
|
+
console.debug('onSuccess callback not provided:', hash);
|
|
107
|
+
}
|
|
104
108
|
},
|
|
105
109
|
onError: (error) => {
|
|
106
|
-
makeOfferModal$.callbacks?.onError
|
|
107
|
-
|
|
110
|
+
if (typeof makeOfferModal$.callbacks?.onError === 'function') {
|
|
111
|
+
makeOfferModal$.callbacks.onError(error);
|
|
112
|
+
} else {
|
|
113
|
+
console.debug('onError callback not provided:', error);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
108
116
|
});
|
|
109
117
|
|
|
110
118
|
const dateToUnixTime = (date: Date) =>
|
|
@@ -90,11 +90,19 @@ const ModalContent = observer(
|
|
|
90
90
|
sellModal$.close();
|
|
91
91
|
},
|
|
92
92
|
onSuccess: (hash) => {
|
|
93
|
-
sellModal$.callbacks?.onSuccess
|
|
93
|
+
if (typeof sellModal$.callbacks?.onSuccess === 'function') {
|
|
94
|
+
sellModal$.callbacks.onSuccess(hash);
|
|
95
|
+
} else {
|
|
96
|
+
console.debug('onSuccess callback not provided:', hash);
|
|
97
|
+
}
|
|
94
98
|
},
|
|
95
99
|
onError: (error) => {
|
|
96
|
-
sellModal$.callbacks?.onError
|
|
97
|
-
|
|
100
|
+
if (typeof sellModal$.callbacks?.onError === 'function') {
|
|
101
|
+
sellModal$.callbacks.onError(error);
|
|
102
|
+
} else {
|
|
103
|
+
console.debug('onError callback not provided:', error);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
98
106
|
});
|
|
99
107
|
|
|
100
108
|
const {
|
|
@@ -169,9 +177,9 @@ const ModalContent = observer(
|
|
|
169
177
|
price={
|
|
170
178
|
currency
|
|
171
179
|
? {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
180
|
+
amountRaw: order?.priceAmount,
|
|
181
|
+
currency,
|
|
182
|
+
}
|
|
175
183
|
: undefined
|
|
176
184
|
}
|
|
177
185
|
currencyImageUrl={currency?.imageUrl}
|
|
@@ -48,7 +48,7 @@ const EnterWalletAddressView = () => {
|
|
|
48
48
|
|
|
49
49
|
return (
|
|
50
50
|
<Box display="grid" gap="6" flexGrow="1">
|
|
51
|
-
<Text color="white" fontSize="large" fontWeight="bold">
|
|
51
|
+
<Text color="white" fontSize="large" fontWeight="bold" fontFamily="body">
|
|
52
52
|
Transfer your item
|
|
53
53
|
</Text>
|
|
54
54
|
|
|
@@ -80,6 +80,7 @@ const EnterWalletAddressView = () => {
|
|
|
80
80
|
color={insufficientBalance ? 'negative' : 'text50'}
|
|
81
81
|
fontSize="small"
|
|
82
82
|
fontWeight="medium"
|
|
83
|
+
fontFamily="body"
|
|
83
84
|
>
|
|
84
85
|
{`You have ${balanceAmount} of this item`}
|
|
85
86
|
</Text>
|
|
@@ -6,7 +6,7 @@ import { Box, Button, Text } from '@0xsequence/design-system';
|
|
|
6
6
|
const FollowWalletInstructionsView = observer(() => {
|
|
7
7
|
return (
|
|
8
8
|
<Box display="grid" gap="6" flexGrow="1">
|
|
9
|
-
<Text color="white" fontSize="large" fontWeight="bold">
|
|
9
|
+
<Text color="white" fontSize="large" fontWeight="bold" fontFamily="body">
|
|
10
10
|
Transfer your item
|
|
11
11
|
</Text>
|
|
12
12
|
|
|
@@ -10,7 +10,7 @@ type AlertMessageProps = {
|
|
|
10
10
|
export default function AlertMessage({ message, type }: AlertMessageProps) {
|
|
11
11
|
return (
|
|
12
12
|
<Box className={`${alertMessageBox} ${alertMessageBoxVariants[type]}`}>
|
|
13
|
-
<Text color="white" fontSize="normal" fontWeight="medium">
|
|
13
|
+
<Text color="white" fontSize="normal" fontWeight="medium" fontFamily="body">
|
|
14
14
|
{message}
|
|
15
15
|
</Text>
|
|
16
16
|
|
|
@@ -46,7 +46,7 @@ const CurrencyOptionsSelect = observer(function CurrencyOptionsSelect({
|
|
|
46
46
|
const options = currencies.map(
|
|
47
47
|
(currency) =>
|
|
48
48
|
({
|
|
49
|
-
label: currency.
|
|
49
|
+
label: currency.symbol,
|
|
50
50
|
value: currency.contractAddress,
|
|
51
51
|
}) satisfies SelectOption,
|
|
52
52
|
);
|
|
@@ -61,12 +61,7 @@ const CurrencyOptionsSelect = observer(function CurrencyOptionsSelect({
|
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
|
-
<CustomSelect
|
|
65
|
-
items={options}
|
|
66
|
-
placeholder={options[0].label}
|
|
67
|
-
onValueChange={onChange}
|
|
68
|
-
defaultValue={options[0].value}
|
|
69
|
-
/>
|
|
64
|
+
<CustomSelect items={options} onValueChange={onChange} placeholder="" />
|
|
70
65
|
);
|
|
71
66
|
});
|
|
72
67
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChainId, networks } from '@0xsequence/network';
|
|
1
2
|
import { truncateMiddle } from '../../../../../../utils';
|
|
2
3
|
import SvgPositiveCircleIcon from '../../../../icons/PositiveCircleIcon';
|
|
3
4
|
import { Box, Spinner, Text } from '@0xsequence/design-system';
|
|
@@ -8,6 +9,7 @@ type TransactionFooterProps = {
|
|
|
8
9
|
isConfirming: boolean;
|
|
9
10
|
isConfirmed: boolean;
|
|
10
11
|
isFailed: boolean;
|
|
12
|
+
chainId: ChainId;
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
export default function TransactionFooter({
|
|
@@ -15,6 +17,7 @@ export default function TransactionFooter({
|
|
|
15
17
|
isConfirming,
|
|
16
18
|
isConfirmed,
|
|
17
19
|
isFailed,
|
|
20
|
+
chainId,
|
|
18
21
|
}: TransactionFooterProps) {
|
|
19
22
|
const icon =
|
|
20
23
|
(isConfirming && <Spinner size="md" />) ||
|
|
@@ -24,25 +27,43 @@ export default function TransactionFooter({
|
|
|
24
27
|
(isConfirming && 'Processing transaction') ||
|
|
25
28
|
(isConfirmed && 'Transaction complete') ||
|
|
26
29
|
(isFailed && 'Transaction failed');
|
|
30
|
+
|
|
31
|
+
const transactionUrl = `${networks[chainId as unknown as ChainId]?.blockExplorer?.rootUrl}tx/${transactionHash}`;
|
|
27
32
|
return (
|
|
28
33
|
<Box display="flex" alignItems="center">
|
|
29
34
|
{icon}
|
|
30
35
|
|
|
31
|
-
<Text color="text50" fontSize="normal" fontWeight="medium" marginLeft="2">
|
|
32
|
-
{title}
|
|
33
|
-
</Text>
|
|
34
|
-
|
|
35
36
|
<Text
|
|
36
|
-
|
|
37
|
-
color="polygonLight"
|
|
38
|
-
flexGrow="1"
|
|
39
|
-
textAlign="right"
|
|
37
|
+
color="text50"
|
|
40
38
|
fontSize="normal"
|
|
41
39
|
fontWeight="medium"
|
|
42
40
|
marginLeft="2"
|
|
41
|
+
fontFamily="body"
|
|
43
42
|
>
|
|
44
|
-
{
|
|
43
|
+
{title}
|
|
45
44
|
</Text>
|
|
45
|
+
|
|
46
|
+
<Box
|
|
47
|
+
as="a"
|
|
48
|
+
flexGrow="1"
|
|
49
|
+
marginLeft="2"
|
|
50
|
+
href={transactionUrl}
|
|
51
|
+
target="_blank"
|
|
52
|
+
rel="noopener noreferrer"
|
|
53
|
+
textAlign="right"
|
|
54
|
+
textDecoration="none"
|
|
55
|
+
>
|
|
56
|
+
<Text
|
|
57
|
+
// TODO: Replace "polygonLight" with the actual color from design system
|
|
58
|
+
color="polygonLight"
|
|
59
|
+
textAlign="right"
|
|
60
|
+
fontSize="normal"
|
|
61
|
+
fontWeight="medium"
|
|
62
|
+
fontFamily="body"
|
|
63
|
+
>
|
|
64
|
+
{truncateMiddle(transactionHash, 4, 4)}
|
|
65
|
+
</Text>
|
|
66
|
+
</Box>
|
|
46
67
|
</Box>
|
|
47
68
|
);
|
|
48
69
|
}
|
|
@@ -64,7 +64,7 @@ export default function TransactionDetails({
|
|
|
64
64
|
justifyContent={'space-between'}
|
|
65
65
|
alignItems={'center'}
|
|
66
66
|
>
|
|
67
|
-
<Text fontSize={'small'} color={'text50'}>
|
|
67
|
+
<Text fontSize={'small'} color={'text50'} fontFamily="body">
|
|
68
68
|
Total earnings
|
|
69
69
|
</Text>
|
|
70
70
|
|
|
@@ -74,7 +74,7 @@ export default function TransactionDetails({
|
|
|
74
74
|
{priceLoading ? (
|
|
75
75
|
<Skeleton width="16" height={'4'} />
|
|
76
76
|
) : (
|
|
77
|
-
<Text fontSize={'small'} color={'text100'}>
|
|
77
|
+
<Text fontSize={'small'} color={'text100'} fontFamily="body">
|
|
78
78
|
{formattedAmount} {price.currency.symbol}
|
|
79
79
|
</Text>
|
|
80
80
|
)}
|
|
@@ -14,14 +14,26 @@ export default function TransactionHeader({
|
|
|
14
14
|
}: TransactionHeaderProps) {
|
|
15
15
|
return (
|
|
16
16
|
<Box display="flex" alignItems="center" width="full">
|
|
17
|
-
<Text
|
|
17
|
+
<Text
|
|
18
|
+
fontSize="small"
|
|
19
|
+
fontWeight="medium"
|
|
20
|
+
color="text80"
|
|
21
|
+
marginRight="1"
|
|
22
|
+
fontFamily="body"
|
|
23
|
+
>
|
|
18
24
|
{title}
|
|
19
25
|
</Text>
|
|
20
26
|
|
|
21
27
|
<Image src={currencyImageUrl} width="3" height="3" marginRight="1" />
|
|
22
28
|
|
|
23
29
|
{(date && (
|
|
24
|
-
<Text
|
|
30
|
+
<Text
|
|
31
|
+
fontSize="small"
|
|
32
|
+
color="text50"
|
|
33
|
+
flexGrow="1"
|
|
34
|
+
textAlign="right"
|
|
35
|
+
fontFamily="body"
|
|
36
|
+
>
|
|
25
37
|
{formatDistanceToNow(date)} ago
|
|
26
38
|
</Text>
|
|
27
39
|
)) || <Skeleton width="8" height="4" />}
|
|
@@ -7,6 +7,7 @@ import TimeAgo from '../timeAgo';
|
|
|
7
7
|
import { transactionStatusModal$ } from '../transactionStatusModal/store';
|
|
8
8
|
import { useTransactionPreviewTitle } from './useTransactionPreviewTitle';
|
|
9
9
|
import type { TokenMetadata } from '@0xsequence/metadata';
|
|
10
|
+
import ChessTileImage from '../../../../images/chess-tile.png';
|
|
10
11
|
|
|
11
12
|
type TransactionPreviewProps = {
|
|
12
13
|
price?: Price;
|
|
@@ -55,6 +56,7 @@ const TransactionPreview = observer(
|
|
|
55
56
|
fontSize="small"
|
|
56
57
|
fontWeight="medium"
|
|
57
58
|
marginRight="1"
|
|
59
|
+
fontFamily="body"
|
|
58
60
|
>
|
|
59
61
|
{title}
|
|
60
62
|
</Text>
|
|
@@ -66,7 +68,7 @@ const TransactionPreview = observer(
|
|
|
66
68
|
|
|
67
69
|
<Box display="flex" alignItems="center" marginTop="2">
|
|
68
70
|
<Image
|
|
69
|
-
src={collectibleImage}
|
|
71
|
+
src={collectibleImage || ChessTileImage}
|
|
70
72
|
alt={collectibleName}
|
|
71
73
|
width="9"
|
|
72
74
|
height="9"
|
|
@@ -80,11 +82,16 @@ const TransactionPreview = observer(
|
|
|
80
82
|
alignItems="flex-start"
|
|
81
83
|
gap="0.5"
|
|
82
84
|
>
|
|
83
|
-
<Text
|
|
85
|
+
<Text
|
|
86
|
+
color="text80"
|
|
87
|
+
fontSize="small"
|
|
88
|
+
fontWeight="medium"
|
|
89
|
+
fontFamily="body"
|
|
90
|
+
>
|
|
84
91
|
{collectibleName}
|
|
85
92
|
</Text>
|
|
86
93
|
|
|
87
|
-
<Text color="text100" fontSize="small">
|
|
94
|
+
<Text color="text100" fontSize="small" fontFamily="body">
|
|
88
95
|
{collectionName}
|
|
89
96
|
</Text>
|
|
90
97
|
</Box>
|
|
@@ -99,7 +106,12 @@ const TransactionPreview = observer(
|
|
|
99
106
|
>
|
|
100
107
|
<Image src={currencyImageUrl} width="3" height="3" />
|
|
101
108
|
|
|
102
|
-
<Text
|
|
109
|
+
<Text
|
|
110
|
+
color="text80"
|
|
111
|
+
fontSize="small"
|
|
112
|
+
fontWeight="medium"
|
|
113
|
+
fontFamily="body"
|
|
114
|
+
>
|
|
103
115
|
{priceFormatted} {price!.currency.symbol}
|
|
104
116
|
</Text>
|
|
105
117
|
</Box>
|