|
1 | 1 | import styled from "@emotion/styled"; |
| 2 | +import { TokenProvider } from "src/react/web/ui/prebuilt/Token/provider.js"; |
2 | 3 | import { getCachedChain } from "../../../../../../../chains/utils.js"; |
3 | 4 | import type { ThirdwebClient } from "../../../../../../../client/client.js"; |
4 | 5 | import { formatNumber } from "../../../../../../../utils/formatNumber.js"; |
@@ -37,73 +38,81 @@ export function BuyTxHistoryButton(props: { |
37 | 38 | paddingBlock: spacing.sm, |
38 | 39 | }} |
39 | 40 | > |
40 | | - <Container |
41 | | - flex="row" |
42 | | - center="y" |
43 | | - gap="sm" |
44 | | - style={{ |
45 | | - flex: 1, |
46 | | - }} |
| 41 | + <TokenProvider |
| 42 | + address={props.txInfo.status.quote.toToken.tokenAddress} |
| 43 | + client={props.client} |
| 44 | + chain={getCachedChain(props.txInfo.status.quote.toToken.chainId)} |
47 | 45 | > |
48 | | - <PayTokenIcon |
49 | | - client={props.client} |
50 | | - chain={getCachedChain(props.txInfo.status.quote.toToken.chainId)} |
51 | | - size="md" |
52 | | - token={{ |
53 | | - address: props.txInfo.status.quote.toToken.tokenAddress, |
54 | | - }} |
55 | | - /> |
56 | | - |
57 | | - <div |
| 46 | + <Container |
| 47 | + flex="row" |
| 48 | + center="y" |
| 49 | + gap="sm" |
58 | 50 | style={{ |
59 | 51 | flex: 1, |
60 | | - display: "flex", |
61 | | - flexDirection: "column", |
62 | | - justifyContent: "center", |
63 | 52 | }} |
64 | 53 | > |
65 | | - {/* Row 1 */} |
66 | | - <Container |
67 | | - flex="row" |
68 | | - gap="xs" |
69 | | - center="y" |
70 | | - style={{ |
71 | | - justifyContent: "space-between", |
| 54 | + <PayTokenIcon |
| 55 | + client={props.client} |
| 56 | + chain={getCachedChain(props.txInfo.status.quote.toToken.chainId)} |
| 57 | + size="md" |
| 58 | + token={{ |
| 59 | + address: props.txInfo.status.quote.toToken.tokenAddress, |
72 | 60 | }} |
73 | | - > |
74 | | - <Text size="sm" color="primaryText"> |
75 | | - Buy{" "} |
76 | | - {formatNumber( |
77 | | - Number( |
78 | | - props.txInfo.type === "swap" |
79 | | - ? props.txInfo.status.quote.toAmount |
80 | | - : props.txInfo.status.quote.estimatedToTokenAmount, |
81 | | - ), |
82 | | - 6, |
83 | | - )}{" "} |
84 | | - {props.txInfo.status.quote.toToken.symbol} |
85 | | - </Text> |
86 | | - </Container> |
| 61 | + /> |
87 | 62 |
|
88 | | - <Spacer y="xxs" /> |
89 | | - |
90 | | - {/* Row 2 */} |
91 | | - <Container |
92 | | - flex="row" |
93 | | - center="y" |
94 | | - gap="xxs" |
| 63 | + <div |
95 | 64 | style={{ |
96 | | - justifyContent: "space-between", |
| 65 | + flex: 1, |
| 66 | + display: "flex", |
| 67 | + flexDirection: "column", |
| 68 | + justifyContent: "center", |
97 | 69 | }} |
98 | 70 | > |
99 | | - <ChainName |
100 | | - chain={getCachedChain(props.txInfo.status.quote.toToken.chainId)} |
101 | | - size="xs" |
102 | | - client={props.client} |
103 | | - /> |
104 | | - </Container> |
105 | | - </div> |
106 | | - </Container> |
| 71 | + {/* Row 1 */} |
| 72 | + <Container |
| 73 | + flex="row" |
| 74 | + gap="xs" |
| 75 | + center="y" |
| 76 | + style={{ |
| 77 | + justifyContent: "space-between", |
| 78 | + }} |
| 79 | + > |
| 80 | + <Text size="sm" color="primaryText"> |
| 81 | + Buy{" "} |
| 82 | + {formatNumber( |
| 83 | + Number( |
| 84 | + props.txInfo.type === "swap" |
| 85 | + ? props.txInfo.status.quote.toAmount |
| 86 | + : props.txInfo.status.quote.estimatedToTokenAmount, |
| 87 | + ), |
| 88 | + 6, |
| 89 | + )}{" "} |
| 90 | + {props.txInfo.status.quote.toToken.symbol} |
| 91 | + </Text> |
| 92 | + </Container> |
| 93 | + |
| 94 | + <Spacer y="xxs" /> |
| 95 | + |
| 96 | + {/* Row 2 */} |
| 97 | + <Container |
| 98 | + flex="row" |
| 99 | + center="y" |
| 100 | + gap="xxs" |
| 101 | + style={{ |
| 102 | + justifyContent: "space-between", |
| 103 | + }} |
| 104 | + > |
| 105 | + <ChainName |
| 106 | + chain={getCachedChain( |
| 107 | + props.txInfo.status.quote.toToken.chainId, |
| 108 | + )} |
| 109 | + size="xs" |
| 110 | + client={props.client} |
| 111 | + /> |
| 112 | + </Container> |
| 113 | + </div> |
| 114 | + </Container> |
| 115 | + </TokenProvider> |
107 | 116 |
|
108 | 117 | {/* Status */} |
109 | 118 | <Container flex="row" gap="xxs" center="y"> |
|
0 commit comments