Skip to content

Commit 98cce77

Browse files
[SDK] Add ZERO_ADDRESS check to isNativeToken function (#6918)
1 parent 5f0049f commit 98cce77

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

.changeset/rude-peaches-juggle.md

+5
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/bridge/Status.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { defineChain } from "../chains/utils.js";
44
import { status } from "./Status.js";
55

66
describe.runIf(process.env.TW_SECRET_KEY)("Bridge.status", () => {
7-
it("should handle successful status", async () => {
7+
// TODO: flaky test
8+
it.skip("should handle successful status", async () => {
89
const result = await status({
910
transactionHash:
1011
"0x5959b9321ec581640db531b80bac53cbd968f3d34fc6cb1d5f4ea75f26df2ad7",

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

+6-2
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)