Skip to content

Commit 653f049

Browse files
committed
feat: hide the contract label if unknown
1 parent 61bfebf commit 653f049

File tree

2 files changed

+25
-16
lines changed

2 files changed

+25
-16
lines changed

.changeset/whole-bottles-wait.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
TransactionWidget: Hides the "UnknownContract" label

packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -212,22 +212,26 @@ export function TransactionPayment({
212212
<Spacer y="md" />
213213

214214
{/* Contract Info */}
215-
<Container
216-
flex="row"
217-
style={{
218-
alignItems: "center",
219-
justifyContent: "space-between",
220-
}}
221-
>
222-
<Text color="secondaryText" size="sm">
223-
Contract
224-
</Text>
225-
<Text color="primaryText" size="sm">
226-
{contractName}
227-
</Text>
228-
</Container>
215+
{contractName !== "UnknownContract" && contractName !== undefined && contractName !== "Unknown Contract" && (
216+
<>
217+
<Container
218+
flex="row"
219+
style={{
220+
alignItems: "center",
221+
justifyContent: "space-between",
222+
}}
223+
>
224+
<Text color="secondaryText" size="sm">
225+
Contract
226+
</Text>
227+
<Text color="primaryText" size="sm">
228+
{contractName}
229+
</Text>
230+
</Container>
229231

230-
<Spacer y="xs" />
232+
<Spacer y="xs" />
233+
</>
234+
)}
231235

232236
{/* Address */}
233237
<Container
@@ -359,7 +363,7 @@ export function TransactionPayment({
359363
Math.max(
360364
0,
361365
Number(transactionDataQuery.data.totalCost) -
362-
Number(userBalance ?? "0"),
366+
Number(userBalance ?? "0"),
363367
).toString(),
364368
transactionDataQuery.data.tokenInfo,
365369
getAddress(activeAccount.address),

0 commit comments

Comments
 (0)