@0xsequence/marketplace-sdk 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-P3EQRM7K.js → chunk-5GDO4ZBC.js} +5 -4
- package/dist/{chunk-P3EQRM7K.js.map → chunk-5GDO4ZBC.js.map} +1 -1
- package/dist/{chunk-QTQH5I2E.js → chunk-EVRILXOH.js} +2 -2
- package/dist/chunk-EVRILXOH.js.map +1 -0
- package/dist/{chunk-GVDLVCR5.js → chunk-GSDUAHL3.js} +1 -1
- package/dist/chunk-GSDUAHL3.js.map +1 -0
- package/dist/{chunk-6HEMV2OR.js → chunk-IOTKCWOB.js} +890 -644
- package/dist/chunk-IOTKCWOB.js.map +1 -0
- package/dist/{chunk-AY2MZHZN.js → chunk-KNX2LER4.js} +5 -6
- package/dist/{chunk-PAHT6PTD.js.map → chunk-KNX2LER4.js.map} +1 -1
- package/dist/{chunk-SBVLWSRZ.js → chunk-LF44FCG5.js} +2 -2
- package/dist/{chunk-SBVLWSRZ.js.map → chunk-LF44FCG5.js.map} +1 -1
- package/dist/{chunk-PAHT6PTD.js → chunk-LSMQVX77.js} +5 -6
- package/dist/{chunk-AY2MZHZN.js.map → chunk-LSMQVX77.js.map} +1 -1
- package/dist/{chunk-6AYHE7ZA.js → chunk-MIYMMP2K.js} +79 -33
- package/dist/chunk-MIYMMP2K.js.map +1 -0
- package/dist/{chunk-EK5ZSW4M.js → chunk-QMO2CUNM.js} +2 -2
- package/dist/{chunk-L6GSYPCR.js → chunk-RZSZNVEH.js} +5 -5
- package/dist/{chunk-L6GSYPCR.js.map → chunk-RZSZNVEH.js.map} +1 -1
- package/dist/chunk-T5T6JNB2.js +171 -0
- package/dist/chunk-T5T6JNB2.js.map +1 -0
- package/dist/chunk-UPLTM63S.js +435 -0
- package/dist/chunk-UPLTM63S.js.map +1 -0
- package/dist/{chunk-Y7YO5TLE.js → chunk-XXML5K3X.js} +5 -2
- package/dist/chunk-XXML5K3X.js.map +1 -0
- package/dist/{create-config-CgtmCzvb.d.ts → create-config-8sffBvlt.d.ts} +1 -1
- package/dist/index.js +4 -4
- package/dist/react/_internal/api/index.js +2 -2
- package/dist/react/_internal/index.d.ts +1 -1
- package/dist/react/_internal/index.js +3 -3
- package/dist/react/_internal/wagmi/index.d.ts +1 -1
- package/dist/react/_internal/wagmi/index.js +2 -2
- package/dist/react/hooks/index.d.ts +663 -74
- package/dist/react/hooks/index.js +7 -7
- package/dist/react/index.css +17 -0
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +11 -11
- package/dist/react/ssr/index.js +1 -1
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/index.css +17 -0
- package/dist/react/ui/components/index.css.map +1 -1
- package/dist/react/ui/components/index.js +11 -11
- package/dist/react/ui/icons/index.js +4 -4
- package/dist/react/ui/icons/index.js.map +1 -1
- package/dist/react/ui/index.css +17 -0
- package/dist/react/ui/index.css.map +1 -1
- package/dist/react/ui/index.js +11 -11
- package/dist/react/ui/modals/_internal/components/actionModal/index.css +22 -0
- package/dist/react/ui/modals/_internal/components/actionModal/index.css.map +1 -1
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +17 -9
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +8 -4
- package/dist/react/ui/styles/index.d.ts +1 -1
- package/dist/styles/index.d.ts +1 -1
- package/dist/styles/index.js +2 -2
- package/dist/types/index.js +3 -3
- package/dist/utils/index.js +2 -2
- package/package.json +25 -25
- package/src/react/_internal/api/marketplace-api.ts +3 -2
- package/src/react/_internal/transaction-machine/execute-transaction.ts +28 -12
- package/src/react/_internal/transaction-machine/useTransactionMachine.ts +43 -8
- package/src/react/hooks/useBuyCollectable.tsx +13 -6
- package/src/react/hooks/useCancelOrder.tsx +14 -7
- package/src/react/hooks/useCreateListing.tsx +74 -10
- package/src/react/hooks/useCurrencies.tsx +1 -1
- package/src/react/hooks/useCurrencyBalance.tsx +1 -1
- package/src/react/hooks/useCurrencyOptions.tsx +1 -1
- package/src/react/hooks/useMakeOffer.tsx +73 -11
- package/src/react/hooks/useSell.tsx +72 -11
- package/src/react/ui/components/_internals/action-button/ActionButton.tsx +1 -7
- package/src/react/ui/components/_internals/action-button/types.ts +7 -0
- package/src/react/ui/components/_internals/custom-select/CustomSelect.tsx +18 -15
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +5 -7
- package/src/react/ui/components/collectible-card/Footer.tsx +5 -7
- package/src/react/ui/components/collectible-card/styles.css.ts +1 -1
- package/src/react/ui/icons/ArrowUp.tsx +3 -0
- package/src/react/ui/icons/Bell.tsx +3 -0
- package/src/react/ui/icons/CalendarIcon.tsx +3 -0
- package/src/react/ui/icons/DiamondEye.tsx +3 -0
- package/src/react/ui/icons/InfoIcon.tsx +3 -0
- package/src/react/ui/icons/InventoryIcon.tsx +3 -0
- package/src/react/ui/icons/MinusIcon.tsx +3 -0
- package/src/react/ui/icons/PlusIcon.tsx +3 -0
- package/src/react/ui/icons/PositiveCircleIcon.tsx +3 -0
- package/src/react/ui/modals/BuyModal/index.tsx +25 -8
- package/src/react/ui/modals/CreateListingModal/_store.ts +5 -2
- package/src/react/ui/modals/CreateListingModal/index.tsx +62 -23
- package/src/react/ui/modals/MakeOfferModal/_store.ts +5 -2
- package/src/react/ui/modals/MakeOfferModal/index.tsx +83 -65
- package/src/react/ui/modals/SellModal/index.tsx +107 -57
- package/src/react/ui/modals/TransferModal/_store.ts +1 -1
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +4 -2
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx +5 -5
- package/src/react/ui/modals/TransferModal/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +29 -8
- package/src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx +15 -5
- package/src/react/ui/modals/_internal/components/actionModal/LoadingModal.tsx +15 -5
- package/src/react/ui/modals/_internal/components/actionModal/store.ts +6 -0
- package/src/react/ui/modals/_internal/components/calendar/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/currencyImage/index.tsx +3 -3
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +11 -10
- package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +14 -19
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +34 -12
- package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +3 -3
- package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +7 -4
- package/src/react/ui/modals/_internal/components/tokenPreview/index.tsx +1 -0
- package/src/react/ui/modals/_internal/components/transaction-footer/index.tsx +3 -3
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +9 -5
- package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +4 -4
- package/src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +51 -29
- package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +2 -2
- package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getFormattedType.ts +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getMessage.ts +2 -2
- package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getTitle.ts +6 -3
- package/src/react/ui/modals/_internal/components/waasFeeOptionsBox/index.tsx +146 -0
- package/src/react/ui/modals/_internal/components/waasFeeOptionsBox/store.ts +12 -0
- package/src/react/ui/modals/_internal/components/waasFeeOptionsBox/styles.css.ts +53 -0
- package/src/react/ui/modals/_internal/components/waasFeeOptionsSelect/WaasFeeOptionsSelect.tsx +117 -0
- package/src/utils/_internal/error/transaction.ts +2 -2
- package/src/utils/price.ts +3 -4
- package/tsconfig.json +1 -21
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/chunk-6AYHE7ZA.js.map +0 -1
- package/dist/chunk-6HEMV2OR.js.map +0 -1
- package/dist/chunk-FFCNYF3S.js +0 -153
- package/dist/chunk-FFCNYF3S.js.map +0 -1
- package/dist/chunk-GVDLVCR5.js.map +0 -1
- package/dist/chunk-NMCGA2TB.js +0 -98
- package/dist/chunk-NMCGA2TB.js.map +0 -1
- package/dist/chunk-QTQH5I2E.js.map +0 -1
- package/dist/chunk-Y7YO5TLE.js.map +0 -1
- /package/dist/{chunk-EK5ZSW4M.js.map → chunk-QMO2CUNM.js.map} +0 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Box,
|
|
3
|
+
Button,
|
|
4
|
+
Skeleton,
|
|
5
|
+
Text,
|
|
6
|
+
WarningIcon,
|
|
7
|
+
} from '@0xsequence/design-system';
|
|
8
|
+
import { useWaasFeeOptions } from '@0xsequence/kit';
|
|
9
|
+
import { observer } from '@legendapp/state/react';
|
|
10
|
+
import { useEffect } from 'react';
|
|
11
|
+
import { type Hex, zeroAddress } from 'viem';
|
|
12
|
+
import { useAccount } from 'wagmi';
|
|
13
|
+
import { useCurrencyBalance } from '../../../../../hooks/useCurrencyBalance';
|
|
14
|
+
import WaasFeeOptionsSelect, {
|
|
15
|
+
type FeeOption,
|
|
16
|
+
} from '../waasFeeOptionsSelect/WaasFeeOptionsSelect';
|
|
17
|
+
import { waasFeeOptionsModal$ } from './store';
|
|
18
|
+
import { feeOptionsWrapper } from './styles.css';
|
|
19
|
+
|
|
20
|
+
type WaasFeeOptionsBoxProps = {
|
|
21
|
+
onFeeOptionsLoaded: () => void;
|
|
22
|
+
onFeeOptionConfirmed: () => void;
|
|
23
|
+
chainId: number;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const WaasFeeOptionsBox = observer(
|
|
27
|
+
({
|
|
28
|
+
onFeeOptionsLoaded,
|
|
29
|
+
onFeeOptionConfirmed,
|
|
30
|
+
chainId,
|
|
31
|
+
}: WaasFeeOptionsBoxProps) => {
|
|
32
|
+
const { address: userAddress } = useAccount();
|
|
33
|
+
const selectedFeeOption$ = waasFeeOptionsModal$.selectedFeeOption;
|
|
34
|
+
const [pendingFeeOptionConfirmation, confirmPendingFeeOption] =
|
|
35
|
+
useWaasFeeOptions();
|
|
36
|
+
const { data: currencyBalance, isLoading: currencyBalanceLoading } =
|
|
37
|
+
useCurrencyBalance({
|
|
38
|
+
chainId,
|
|
39
|
+
currencyAddress: (selectedFeeOption$.token.contractAddress.get() ||
|
|
40
|
+
zeroAddress) as Hex,
|
|
41
|
+
userAddress: userAddress as Hex,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (pendingFeeOptionConfirmation) {
|
|
47
|
+
onFeeOptionsLoaded();
|
|
48
|
+
}
|
|
49
|
+
}, [pendingFeeOptionConfirmation]);
|
|
50
|
+
|
|
51
|
+
const selectedFeeOption = selectedFeeOption$.get();
|
|
52
|
+
const insufficientBalance = (() => {
|
|
53
|
+
if (!selectedFeeOption?.value || !selectedFeeOption.token.decimals) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (!currencyBalance?.value && currencyBalance?.value !== 0n) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
const feeValue = BigInt(selectedFeeOption.value);
|
|
63
|
+
return currencyBalance.value === 0n || currencyBalance.value < feeValue;
|
|
64
|
+
} catch {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
})();
|
|
68
|
+
|
|
69
|
+
const handleConfirmFeeOption = () => {
|
|
70
|
+
if (!selectedFeeOption?.token || !pendingFeeOptionConfirmation?.id)
|
|
71
|
+
return;
|
|
72
|
+
|
|
73
|
+
confirmPendingFeeOption(
|
|
74
|
+
pendingFeeOptionConfirmation?.id,
|
|
75
|
+
selectedFeeOption.token.contractAddress || zeroAddress,
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
onFeeOptionConfirmed();
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
if (!pendingFeeOptionConfirmation) return null;
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<Box className={feeOptionsWrapper}>
|
|
85
|
+
<Text
|
|
86
|
+
fontSize="medium"
|
|
87
|
+
fontFamily="body"
|
|
88
|
+
fontWeight="bold"
|
|
89
|
+
marginBottom="2"
|
|
90
|
+
>
|
|
91
|
+
Select a fee option
|
|
92
|
+
</Text>
|
|
93
|
+
|
|
94
|
+
<WaasFeeOptionsSelect
|
|
95
|
+
options={(pendingFeeOptionConfirmation?.options as FeeOption[]) || []}
|
|
96
|
+
selectedFeeOption$={selectedFeeOption$}
|
|
97
|
+
/>
|
|
98
|
+
|
|
99
|
+
<Box
|
|
100
|
+
display="flex"
|
|
101
|
+
alignItems="center"
|
|
102
|
+
justifyContent="space-between"
|
|
103
|
+
width="full"
|
|
104
|
+
>
|
|
105
|
+
{currencyBalanceLoading ? (
|
|
106
|
+
<Skeleton style={{ height: 15 }} borderRadius="md" width="1/3" />
|
|
107
|
+
) : (
|
|
108
|
+
<Box display="flex" alignItems="center" gap="2">
|
|
109
|
+
{insufficientBalance && (
|
|
110
|
+
<WarningIcon color="negative" size="xs" />
|
|
111
|
+
)}
|
|
112
|
+
<Text
|
|
113
|
+
fontSize="small"
|
|
114
|
+
fontWeight="semibold"
|
|
115
|
+
fontFamily="body"
|
|
116
|
+
color={insufficientBalance ? 'negative' : 'text100'}
|
|
117
|
+
>
|
|
118
|
+
You have {currencyBalance?.formatted || '0'}{' '}
|
|
119
|
+
{selectedFeeOption?.token.symbol}
|
|
120
|
+
</Text>
|
|
121
|
+
</Box>
|
|
122
|
+
)}
|
|
123
|
+
|
|
124
|
+
<Button
|
|
125
|
+
disabled={
|
|
126
|
+
!selectedFeeOption?.token ||
|
|
127
|
+
insufficientBalance ||
|
|
128
|
+
currencyBalanceLoading
|
|
129
|
+
}
|
|
130
|
+
pending={currencyBalanceLoading}
|
|
131
|
+
onClick={handleConfirmFeeOption}
|
|
132
|
+
label={
|
|
133
|
+
<Box display="flex" alignItems="center" gap="2">
|
|
134
|
+
Confirm
|
|
135
|
+
</Box>
|
|
136
|
+
}
|
|
137
|
+
variant={insufficientBalance ? 'danger' : 'primary'}
|
|
138
|
+
size="xs"
|
|
139
|
+
/>
|
|
140
|
+
</Box>
|
|
141
|
+
</Box>
|
|
142
|
+
);
|
|
143
|
+
},
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
export default WaasFeeOptionsBox;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { observable } from '@legendapp/state';
|
|
2
|
+
import type { FeeOption } from '../waasFeeOptionsSelect/WaasFeeOptionsSelect';
|
|
3
|
+
|
|
4
|
+
type WaasFeeOptionsModalState = {
|
|
5
|
+
selectedFeeOption: FeeOption | undefined;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const initialState = {
|
|
9
|
+
selectedFeeOption: undefined,
|
|
10
|
+
} as WaasFeeOptionsModalState;
|
|
11
|
+
|
|
12
|
+
export const waasFeeOptionsModal$ = observable(initialState);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { atoms } from '@0xsequence/design-system';
|
|
2
|
+
import { globalStyle, style } from '@vanilla-extract/css';
|
|
3
|
+
|
|
4
|
+
export const feeOptionsWrapper = style([
|
|
5
|
+
atoms({
|
|
6
|
+
position: 'absolute',
|
|
7
|
+
background: 'buttonEmphasis',
|
|
8
|
+
backdropFilter: 'blur',
|
|
9
|
+
width: 'full',
|
|
10
|
+
left: '0',
|
|
11
|
+
borderRadius: 'lg',
|
|
12
|
+
display: 'flex',
|
|
13
|
+
flexDirection: 'column',
|
|
14
|
+
gap: '2',
|
|
15
|
+
padding: '4',
|
|
16
|
+
}),
|
|
17
|
+
{
|
|
18
|
+
bottom: '-140px',
|
|
19
|
+
},
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
export const dialogOverlay = style([
|
|
23
|
+
atoms({
|
|
24
|
+
background: 'backgroundBackdrop',
|
|
25
|
+
position: 'fixed',
|
|
26
|
+
inset: '0',
|
|
27
|
+
zIndex: '50',
|
|
28
|
+
}),
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
export const dialogContent = style([
|
|
32
|
+
atoms({
|
|
33
|
+
display: 'flex',
|
|
34
|
+
background: 'backgroundPrimary',
|
|
35
|
+
borderRadius: 'lg',
|
|
36
|
+
position: 'fixed',
|
|
37
|
+
zIndex: '50',
|
|
38
|
+
}),
|
|
39
|
+
{
|
|
40
|
+
top: '50%',
|
|
41
|
+
left: '50%',
|
|
42
|
+
transform: 'translate(-50%, -50%)',
|
|
43
|
+
padding: '24px',
|
|
44
|
+
},
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
export const cta = style({
|
|
48
|
+
borderRadius: '12px !important',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
globalStyle(`${cta} > div`, {
|
|
52
|
+
justifyContent: 'center !important',
|
|
53
|
+
});
|
package/src/react/ui/modals/_internal/components/waasFeeOptionsSelect/WaasFeeOptionsSelect.tsx
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Box, Image, Text } from '@0xsequence/design-system';
|
|
2
|
+
import type { Observable } from '@legendapp/state';
|
|
3
|
+
import { observer } from '@legendapp/state/react';
|
|
4
|
+
import { useEffect } from 'react';
|
|
5
|
+
import { formatUnits } from 'viem';
|
|
6
|
+
import {
|
|
7
|
+
CustomSelect,
|
|
8
|
+
type SelectItem,
|
|
9
|
+
} from '../../../../components/_internals/custom-select/CustomSelect';
|
|
10
|
+
|
|
11
|
+
export type FeeOption = {
|
|
12
|
+
gasLimit: number;
|
|
13
|
+
to: string;
|
|
14
|
+
token: {
|
|
15
|
+
chainId: number;
|
|
16
|
+
contractAddress: string | null;
|
|
17
|
+
decimals: number;
|
|
18
|
+
logoURL: string;
|
|
19
|
+
name: string;
|
|
20
|
+
symbol: string;
|
|
21
|
+
tokenID: string | null;
|
|
22
|
+
type: string;
|
|
23
|
+
};
|
|
24
|
+
value: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const WaasFeeOptionsSelect = observer(
|
|
28
|
+
({
|
|
29
|
+
options,
|
|
30
|
+
selectedFeeOption$,
|
|
31
|
+
}: {
|
|
32
|
+
options: FeeOption[];
|
|
33
|
+
selectedFeeOption$: Observable<FeeOption | undefined>;
|
|
34
|
+
}) => {
|
|
35
|
+
const feeOptions = options
|
|
36
|
+
.filter((option) => option.token.contractAddress !== null)
|
|
37
|
+
.map((option) => {
|
|
38
|
+
const value = option.token.contractAddress ?? '';
|
|
39
|
+
return FeeOptionSelectItem({ value, option });
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (options.length > 0 && !selectedFeeOption$.get())
|
|
45
|
+
selectedFeeOption$.set(options[0]);
|
|
46
|
+
}, [options]);
|
|
47
|
+
|
|
48
|
+
if (options.length === 0 || !selectedFeeOption$.get()?.token) return null;
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<CustomSelect
|
|
52
|
+
items={feeOptions}
|
|
53
|
+
onValueChange={(value) => {
|
|
54
|
+
const selectedOption = options.find(
|
|
55
|
+
(option) => option.token.contractAddress === value,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
selectedFeeOption$.set(selectedOption);
|
|
59
|
+
}}
|
|
60
|
+
defaultValue={
|
|
61
|
+
selectedFeeOption$.get()?.token.contractAddress
|
|
62
|
+
? FeeOptionSelectItem({
|
|
63
|
+
value: selectedFeeOption$.get()?.token.contractAddress ?? '',
|
|
64
|
+
option: selectedFeeOption$.get() ?? options[0],
|
|
65
|
+
})
|
|
66
|
+
: undefined
|
|
67
|
+
}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
},
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
function FeeOptionSelectItem({
|
|
74
|
+
value,
|
|
75
|
+
option,
|
|
76
|
+
}: {
|
|
77
|
+
value: string;
|
|
78
|
+
option: FeeOption;
|
|
79
|
+
}) {
|
|
80
|
+
return {
|
|
81
|
+
value,
|
|
82
|
+
content: (
|
|
83
|
+
<Box display="flex" alignItems="center" gap="2">
|
|
84
|
+
<Image
|
|
85
|
+
src={option.token.logoURL}
|
|
86
|
+
alt={option.token.symbol}
|
|
87
|
+
width="3"
|
|
88
|
+
height="3"
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
<Box display="flex" gap="1">
|
|
92
|
+
<Text color="text100" fontSize="small" fontFamily="body">
|
|
93
|
+
Fee
|
|
94
|
+
</Text>
|
|
95
|
+
<Text
|
|
96
|
+
color="text50"
|
|
97
|
+
fontSize="small"
|
|
98
|
+
fontFamily="body"
|
|
99
|
+
fontWeight="semibold"
|
|
100
|
+
>
|
|
101
|
+
(in {option.token.symbol})
|
|
102
|
+
</Text>
|
|
103
|
+
|
|
104
|
+
<Text color="text100" fontSize="small" fontFamily="body">
|
|
105
|
+
:
|
|
106
|
+
</Text>
|
|
107
|
+
</Box>
|
|
108
|
+
|
|
109
|
+
<Text fontSize="small" fontFamily="body">
|
|
110
|
+
{formatUnits(BigInt(option.value), option.token.decimals || 0)}
|
|
111
|
+
</Text>
|
|
112
|
+
</Box>
|
|
113
|
+
),
|
|
114
|
+
} as SelectItem;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export default WaasFeeOptionsSelect;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address } from 'viem';
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
2
|
import { BaseError } from './base';
|
|
3
3
|
|
|
4
4
|
export type TransactionErrorType<name extends string = 'TransactionError'> =
|
|
@@ -263,7 +263,7 @@ export class InvalidCurrencyOptionsError extends TransactionError {
|
|
|
263
263
|
export class ProjectNotFoundError extends TransactionError {
|
|
264
264
|
override name = 'ProjectNotFoundError';
|
|
265
265
|
constructor(projectId: string, url: string) {
|
|
266
|
-
super(
|
|
266
|
+
super('Project not found', {
|
|
267
267
|
details: `Project id: ${projectId} not found at ${url}`,
|
|
268
268
|
});
|
|
269
269
|
}
|
package/src/utils/price.ts
CHANGED
|
@@ -11,11 +11,10 @@ export const calculatePriceDifferencePercentage = ({
|
|
|
11
11
|
basePriceRaw,
|
|
12
12
|
decimals,
|
|
13
13
|
}: CalculatePriceDifferencePercentageArgs) => {
|
|
14
|
-
const
|
|
15
|
-
formatUnits(inputPriceRaw - basePriceRaw, decimals),
|
|
16
|
-
);
|
|
14
|
+
const inputPrice = Number(formatUnits(inputPriceRaw, decimals));
|
|
17
15
|
const basePrice = Number(formatUnits(basePriceRaw, decimals));
|
|
16
|
+
const difference = inputPrice - basePrice;
|
|
18
17
|
const percentageDifference = (difference / basePrice) * 100;
|
|
19
18
|
|
|
20
|
-
return
|
|
19
|
+
return percentageDifference.toFixed(2);
|
|
21
20
|
};
|
package/tsconfig.json
CHANGED
|
@@ -1,24 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
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
|
-
},
|
|
2
|
+
"extends": "../../tsconfig.json",
|
|
23
3
|
"include": ["src", "tsup.config.ts"]
|
|
24
4
|
}
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +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/transaction-machine/execute-transaction.ts","./src/react/_internal/transaction-machine/logger.ts","./src/react/_internal/transaction-machine/usetransactionmachine.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/usebuycollectable.tsx","./src/react/hooks/usecancelorder.tsx","./src/react/hooks/usecheckoutoptions.tsx","./src/react/hooks/usecollectible.tsx","./src/react/hooks/usecollection.tsx","./src/react/hooks/useconfig.tsx","./src/react/hooks/usecountlistingsforcollectible.tsx","./src/react/hooks/usecountofcollectables.tsx","./src/react/hooks/usecountoffersforcollectible.tsx","./src/react/hooks/usecreatelisting.tsx","./src/react/hooks/usecurrencies.tsx","./src/react/hooks/usecurrency.tsx","./src/react/hooks/usecurrencybalance.tsx","./src/react/hooks/usecurrencyoptions.tsx","./src/react/hooks/usefilters.tsx","./src/react/hooks/usefloororder.tsx","./src/react/hooks/usegeneratebuytransaction.tsx","./src/react/hooks/usegeneratecanceltransaction.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/uselistcollections.tsx","./src/react/hooks/uselistlistingsforcollectible.tsx","./src/react/hooks/uselistoffersforcollectible.tsx","./src/react/hooks/uselowestlisting.tsx","./src/react/hooks/usemakeoffer.tsx","./src/react/hooks/usemarketplaceconfig.tsx","./src/react/hooks/useroyaltypercentage.tsx","./src/react/hooks/usesell.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/components/index.ts","./src/react/ui/components/_internals/action-button/actionbutton.tsx","./src/react/ui/components/_internals/custom-network-image/customnetworkimage.tsx","./src/react/ui/components/_internals/custom-network-image/styles.css.ts","./src/react/ui/components/_internals/custom-select/customselect.tsx","./src/react/ui/components/_internals/custom-select/styles.css.ts","./src/react/ui/components/_internals/pill/pill.tsx","./src/react/ui/components/collectible-card/collectiblecard.tsx","./src/react/ui/components/collectible-card/footer.tsx","./src/react/ui/components/collectible-card/styles.css.ts","./src/react/ui/icons/arrowup.tsx","./src/react/ui/icons/bell.tsx","./src/react/ui/icons/calendaricon.tsx","./src/react/ui/icons/diamondeye.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/buymodal/_store.ts","./src/react/ui/modals/buymodal/index.tsx","./src/react/ui/modals/createlistingmodal/_store.ts","./src/react/ui/modals/createlistingmodal/index.tsx","./src/react/ui/modals/makeoffermodal/_store.ts","./src/react/ui/modals/makeoffermodal/index.tsx","./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/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/_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/types.ts","./src/react/ui/modals/_internal/components/actionmodal/actionmodal.tsx","./src/react/ui/modals/_internal/components/actionmodal/errormodal.tsx","./src/react/ui/modals/_internal/components/actionmodal/loadingmodal.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/currencyimage/index.tsx","./src/react/ui/modals/_internal/components/currencyoptionsselect/index.tsx","./src/react/ui/modals/_internal/components/expirationdateselect/index.tsx","./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/components/transactionstatusmodal/util/getformattedtype.ts","./src/react/ui/modals/_internal/components/transactionstatusmodal/util/getmessage.ts","./src/react/ui/modals/_internal/components/transactionstatusmodal/util/gettitle.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/custom.d.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/_internal/error/base.ts","./src/utils/_internal/error/context.ts","./src/utils/_internal/error/transaction.ts","./src/utils/abi/index.ts","./src/utils/abi/marketplace/eip2981.ts","./src/utils/abi/marketplace/index.ts","./src/utils/abi/marketplace/sequence-marketplace-v1.ts","./src/utils/abi/marketplace/sequence-marketplace-v2.ts","./src/utils/abi/token/erc1155.ts","./src/utils/abi/token/erc20.ts","./src/utils/abi/token/erc721.ts","./src/utils/abi/token/index.ts","./tsup.config.ts"],"version":"5.7.2"}
|
|
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/transaction-machine/execute-transaction.ts","./src/react/_internal/transaction-machine/logger.ts","./src/react/_internal/transaction-machine/usetransactionmachine.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/usebuycollectable.tsx","./src/react/hooks/usecancelorder.tsx","./src/react/hooks/usecheckoutoptions.tsx","./src/react/hooks/usecollectible.tsx","./src/react/hooks/usecollection.tsx","./src/react/hooks/useconfig.tsx","./src/react/hooks/usecountlistingsforcollectible.tsx","./src/react/hooks/usecountofcollectables.tsx","./src/react/hooks/usecountoffersforcollectible.tsx","./src/react/hooks/usecreatelisting.tsx","./src/react/hooks/usecurrencies.tsx","./src/react/hooks/usecurrency.tsx","./src/react/hooks/usecurrencybalance.tsx","./src/react/hooks/usecurrencyoptions.tsx","./src/react/hooks/usefilters.tsx","./src/react/hooks/usefloororder.tsx","./src/react/hooks/usegeneratebuytransaction.tsx","./src/react/hooks/usegeneratecanceltransaction.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/uselistcollections.tsx","./src/react/hooks/uselistlistingsforcollectible.tsx","./src/react/hooks/uselistoffersforcollectible.tsx","./src/react/hooks/uselowestlisting.tsx","./src/react/hooks/usemakeoffer.tsx","./src/react/hooks/usemarketplaceconfig.tsx","./src/react/hooks/useroyaltypercentage.tsx","./src/react/hooks/usesell.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/components/index.ts","./src/react/ui/components/_internals/action-button/actionbutton.tsx","./src/react/ui/components/_internals/action-button/types.ts","./src/react/ui/components/_internals/custom-network-image/customnetworkimage.tsx","./src/react/ui/components/_internals/custom-network-image/styles.css.ts","./src/react/ui/components/_internals/custom-select/customselect.tsx","./src/react/ui/components/_internals/custom-select/styles.css.ts","./src/react/ui/components/_internals/pill/pill.tsx","./src/react/ui/components/collectible-card/collectiblecard.tsx","./src/react/ui/components/collectible-card/footer.tsx","./src/react/ui/components/collectible-card/styles.css.ts","./src/react/ui/icons/arrowup.tsx","./src/react/ui/icons/bell.tsx","./src/react/ui/icons/calendaricon.tsx","./src/react/ui/icons/diamondeye.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/buymodal/_store.ts","./src/react/ui/modals/buymodal/index.tsx","./src/react/ui/modals/createlistingmodal/_store.ts","./src/react/ui/modals/createlistingmodal/index.tsx","./src/react/ui/modals/makeoffermodal/_store.ts","./src/react/ui/modals/makeoffermodal/index.tsx","./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/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/_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/types.ts","./src/react/ui/modals/_internal/components/actionmodal/actionmodal.tsx","./src/react/ui/modals/_internal/components/actionmodal/errormodal.tsx","./src/react/ui/modals/_internal/components/actionmodal/loadingmodal.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/currencyimage/index.tsx","./src/react/ui/modals/_internal/components/currencyoptionsselect/index.tsx","./src/react/ui/modals/_internal/components/expirationdateselect/index.tsx","./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/components/transactionstatusmodal/util/getformattedtype.ts","./src/react/ui/modals/_internal/components/transactionstatusmodal/util/getmessage.ts","./src/react/ui/modals/_internal/components/transactionstatusmodal/util/gettitle.ts","./src/react/ui/modals/_internal/components/waasfeeoptionsbox/index.tsx","./src/react/ui/modals/_internal/components/waasfeeoptionsbox/store.ts","./src/react/ui/modals/_internal/components/waasfeeoptionsbox/styles.css.ts","./src/react/ui/modals/_internal/components/waasfeeoptionsselect/waasfeeoptionsselect.tsx","./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/custom.d.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/_internal/error/base.ts","./src/utils/_internal/error/context.ts","./src/utils/_internal/error/transaction.ts","./src/utils/abi/index.ts","./src/utils/abi/marketplace/eip2981.ts","./src/utils/abi/marketplace/index.ts","./src/utils/abi/marketplace/sequence-marketplace-v1.ts","./src/utils/abi/marketplace/sequence-marketplace-v2.ts","./src/utils/abi/token/erc1155.ts","./src/utils/abi/token/erc20.ts","./src/utils/abi/token/erc721.ts","./src/utils/abi/token/index.ts","./tsup.config.ts"],"version":"5.7.2"}
|