Skip to content

Commit 0be0fd9

Browse files
[SDK] Add ZERO_ADDRESS check to isNativeToken function
1 parent 004f377 commit 0be0fd9

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.changeset/rude-peaches-juggle.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+
Handle zero address as native tokens in UB

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/nativeToken.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { NATIVE_TOKEN_ADDRESS } from "../../../../../constants/addresses.js";
1+
import {
2+
NATIVE_TOKEN_ADDRESS,
3+
ZERO_ADDRESS,
4+
} from "../../../../../constants/addresses.js";
25
import { type Address, getAddress } from "../../../../../utils/address.js";
36
import type { TokenInfo } from "../../../../core/utils/defaultTokens.js";
47

@@ -15,7 +18,8 @@ export function isNativeToken(
1518
return (
1619
(token &&
1720
("nativeToken" in token ||
18-
token.address?.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase())) ||
21+
token.address?.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase() ||
22+
token?.address === ZERO_ADDRESS)) ||
1923
false
2024
);
2125
}

0 commit comments

Comments
 (0)