Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import type { WalletId } from "../../../../../../wallets/wallet-types.js";
import {
type Theme,
fontSize,
spacing,
} from "../../../../../core/design-system/index.js";
import type {
Expand All @@ -33,13 +34,15 @@
DrawerOverlay,
useDrawer,
} from "../../../components/Drawer.js";
import { Skeleton } from "../../../components/Skeleton.js";
import { Spacer } from "../../../components/Spacer.js";
import { Spinner } from "../../../components/Spinner.js";
import { SwitchNetworkButton } from "../../../components/SwitchNetwork.js";
import { Container, Line, ModalHeader } from "../../../components/basic.js";
import { Button } from "../../../components/buttons.js";
import { Text } from "../../../components/text.js";
import { TokenSymbol } from "../../../components/token/TokenSymbol.js";
import { TokenProvider } from "../../../prebuilt/Token/provider.js";
import { TokenSymbol } from "../../../prebuilt/Token/symbol.js";
import { ConnectButton } from "../../ConnectButton.js";
import { ChainButton, NetworkSelectorContent } from "../../NetworkSelector.js";
import type { ConnectLocale } from "../../locale/types.js";
Expand Down Expand Up @@ -685,18 +688,37 @@
</Text>

<Container flex="row" gap="xxs" center="y">
<TokenSymbol
token={props.selectedToken}
chain={props.selectedChain}
size="md"
color="secondaryText"
/>
<PayTokenIcon
<TokenProvider
address={
isNativeToken(props.selectedToken)
? NATIVE_TOKEN_ADDRESS
: props.selectedToken.address

Check warning on line 695 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx#L691-L695

Added lines #L691 - L695 were not covered by tests
}
chain={props.selectedChain}
client={props.client}
size="sm"
token={props.selectedToken}
/>
>
<Text size="md" color="secondaryText">
<TokenSymbol
symbolResolver={
isNativeToken(props.selectedToken)
? undefined
: props.selectedToken.symbol

Check warning on line 705 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx#L700-L705

Added lines #L700 - L705 were not covered by tests
}
loadingComponent={
<Skeleton width="70px" height={fontSize.md} />

Check warning on line 708 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx#L707-L708

Added lines #L707 - L708 were not covered by tests
}
fallbackComponent={
<Skeleton width="70px" height={fontSize.md} />

Check warning on line 711 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx#L710-L711

Added lines #L710 - L711 were not covered by tests
}
/>
</Text>
<PayTokenIcon
chain={props.selectedChain}
client={props.client}
size="sm"
token={props.selectedToken}
/>
</TokenProvider>

Check warning on line 721 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx#L713-L721

Added lines #L713 - L721 were not covered by tests
</Container>
</Container>

Expand Down Expand Up @@ -1138,16 +1160,24 @@
{errorMsg && (
<div>
{errorMsg.minAmount && (
<Text color="danger" size="sm" center multiline>
Minimum amount is {errorMsg.minAmount}{" "}
<TokenSymbol
token={toToken}
chain={toChain}
size="sm"
inline
color="danger"
/>
</Text>
<TokenProvider
address={
isNativeToken(toToken) ? NATIVE_TOKEN_ADDRESS : toToken.address

Check warning on line 1165 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx#L1163-L1165

Added lines #L1163 - L1165 were not covered by tests
}
client={props.client}
chain={toChain}

Check warning on line 1168 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx#L1167-L1168

Added lines #L1167 - L1168 were not covered by tests
>
<Text color="danger" size="sm" center multiline>
Minimum amount is {errorMsg.minAmount}{" "}
<Text color="danger" inline>
<TokenSymbol
symbolResolver={
isNativeToken(toToken) ? undefined : toToken.icon

Check warning on line 1175 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx#L1170-L1175

Added lines #L1170 - L1175 were not covered by tests
}
/>
</Text>
</Text>
</TokenProvider>

Check warning on line 1180 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx#L1177-L1180

Added lines #L1177 - L1180 were not covered by tests
)}

{errorMsg.msg?.map((msg) => (
Expand Down Expand Up @@ -1386,16 +1416,24 @@
{errorMsg && (
<div>
{errorMsg.minAmount && (
<Text color="danger" size="sm" center multiline>
Minimum amount is {errorMsg.minAmount}{" "}
<TokenSymbol
token={toToken}
chain={toChain}
size="sm"
inline
color="danger"
/>
</Text>
<TokenProvider
address={
isNativeToken(toToken) ? NATIVE_TOKEN_ADDRESS : toToken.address

Check warning on line 1421 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx#L1419-L1421

Added lines #L1419 - L1421 were not covered by tests
}
client={props.client}
chain={toChain}

Check warning on line 1424 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx#L1423-L1424

Added lines #L1423 - L1424 were not covered by tests
>
<Text color="danger" size="sm" center multiline>
Minimum amount is {errorMsg.minAmount}{" "}
<Text color="danger" inline>
<TokenSymbol
symbolResolver={
isNativeToken(toToken) ? undefined : toToken.icon

Check warning on line 1431 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx#L1426-L1431

Added lines #L1426 - L1431 were not covered by tests
}
/>
</Text>
</Text>
</TokenProvider>

Check warning on line 1436 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx#L1433-L1436

Added lines #L1433 - L1436 were not covered by tests
)}

{errorMsg.msg?.map((msg) => (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import styled from "@emotion/styled";
import { getCachedChain } from "../../../../../../../chains/utils.js";
import type { ThirdwebClient } from "../../../../../../../client/client.js";
import { TokenProvider } from "../../../../../../../react/web/ui/prebuilt/Token/provider.js";
import { formatNumber } from "../../../../../../../utils/formatNumber.js";
import { useCustomTheme } from "../../../../../../core/design-system/CustomThemeProvider.js";
import { spacing } from "../../../../../../core/design-system/index.js";
Expand Down Expand Up @@ -37,73 +38,81 @@
paddingBlock: spacing.sm,
}}
>
<Container
flex="row"
center="y"
gap="sm"
style={{
flex: 1,
}}
<TokenProvider
address={props.txInfo.status.quote.toToken.tokenAddress}
client={props.client}
chain={getCachedChain(props.txInfo.status.quote.toToken.chainId)}

Check warning on line 44 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx#L41-L44

Added lines #L41 - L44 were not covered by tests
>
<PayTokenIcon
client={props.client}
chain={getCachedChain(props.txInfo.status.quote.toToken.chainId)}
size="md"
token={{
address: props.txInfo.status.quote.toToken.tokenAddress,
}}
/>

<div
<Container
flex="row"
center="y"
gap="sm"

Check warning on line 49 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx#L46-L49

Added lines #L46 - L49 were not covered by tests
style={{
flex: 1,
display: "flex",
flexDirection: "column",
justifyContent: "center",
}}
>
{/* Row 1 */}
<Container
flex="row"
gap="xs"
center="y"
style={{
justifyContent: "space-between",
<PayTokenIcon
client={props.client}
chain={getCachedChain(props.txInfo.status.quote.toToken.chainId)}
size="md"
token={{
address: props.txInfo.status.quote.toToken.tokenAddress,

Check warning on line 59 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx#L54-L59

Added lines #L54 - L59 were not covered by tests
}}
>
<Text size="sm" color="primaryText">
Buy{" "}
{formatNumber(
Number(
props.txInfo.type === "swap"
? props.txInfo.status.quote.toAmount
: props.txInfo.status.quote.estimatedToTokenAmount,
),
6,
)}{" "}
{props.txInfo.status.quote.toToken.symbol}
</Text>
</Container>
/>

Check warning on line 61 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx#L61

Added line #L61 was not covered by tests

<Spacer y="xxs" />

{/* Row 2 */}
<Container
flex="row"
center="y"
gap="xxs"
<div

Check warning on line 63 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx#L63

Added line #L63 was not covered by tests
style={{
justifyContent: "space-between",
flex: 1,
display: "flex",
flexDirection: "column",
justifyContent: "center",

Check warning on line 68 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx#L65-L68

Added lines #L65 - L68 were not covered by tests
}}
>
<ChainName
chain={getCachedChain(props.txInfo.status.quote.toToken.chainId)}
size="xs"
client={props.client}
/>
</Container>
</div>
</Container>
{/* Row 1 */}
<Container
flex="row"
gap="xs"
center="y"
style={{
justifyContent: "space-between",
}}

Check warning on line 78 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx#L72-L78

Added lines #L72 - L78 were not covered by tests
>
<Text size="sm" color="primaryText">
Buy{" "}
{formatNumber(
Number(
props.txInfo.type === "swap"
? props.txInfo.status.quote.toAmount
: props.txInfo.status.quote.estimatedToTokenAmount,
),
6,
)}{" "}
{props.txInfo.status.quote.toToken.symbol}
</Text>
</Container>

Check warning on line 92 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx#L80-L92

Added lines #L80 - L92 were not covered by tests

<Spacer y="xxs" />

Check warning on line 94 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx#L94

Added line #L94 was not covered by tests

{/* Row 2 */}
<Container
flex="row"
center="y"
gap="xxs"
style={{
justifyContent: "space-between",
}}

Check warning on line 103 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx#L97-L103

Added lines #L97 - L103 were not covered by tests
>
<ChainName
chain={getCachedChain(
props.txInfo.status.quote.toToken.chainId,
)}
size="xs"
client={props.client}
/>
</Container>
</div>
</Container>
</TokenProvider>

Check warning on line 115 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx#L105-L115

Added lines #L105 - L115 were not covered by tests

{/* Status */}
<Container flex="row" gap="xxs" center="y">
Expand Down
Loading
Loading