Skip to content

Commit 4c33936

Browse files
[SDK] Always checksum Account.address (#6834)
1 parent 125cc97 commit 4c33936

File tree

7 files changed

+14
-6
lines changed

7 files changed

+14
-6
lines changed

.changeset/shiny-pants-shout.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Always checksum Account.address

packages/thirdweb/src/adapters/ethers5.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
TransactionTypeMap,
1515
} from "../transaction/prepare-transaction.js";
1616
import type { SerializableTransaction } from "../transaction/serialize-transaction.js";
17+
import { getAddress } from "../utils/address.js";
1718
import { toHex } from "../utils/encoding/hex.js";
1819
import type { Account } from "../wallets/interfaces/wallet.js";
1920

@@ -364,7 +365,7 @@ export async function fromEthersSigner(
364365
): Promise<Account> {
365366
const address = await signer.getAddress();
366367
const account: Account = {
367-
address,
368+
address: getAddress(address),
368369
signMessage: async ({ message }) => {
369370
return signer.signMessage(
370371
typeof message === "string" ? message : message.raw,

packages/thirdweb/src/adapters/ethers6.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { type ThirdwebContract, getContract } from "../contract/contract.js";
1010
import { toSerializableTransaction } from "../transaction/actions/to-serializable-transaction.js";
1111
import type { PreparedTransaction } from "../transaction/prepare-transaction.js";
1212
import type { SerializableTransaction } from "../transaction/serialize-transaction.js";
13+
import { getAddress } from "../utils/address.js";
1314
import { toHex } from "../utils/encoding/hex.js";
1415
import { resolvePromisedValue } from "../utils/promise/resolve-promised-value.js";
1516
import type { Account } from "../wallets/interfaces/wallet.js";
@@ -327,7 +328,7 @@ export async function fromEthersSigner(
327328
): Promise<Account> {
328329
const address = await signer.getAddress();
329330
const account: Account = {
330-
address,
331+
address: getAddress(address),
331332
signMessage: async ({ message }) => {
332333
return signer.signMessage(
333334
typeof message === "string" ? message : message.raw,

packages/thirdweb/src/wallets/coinbase/coinbase-web.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ function createAccount({
284284
client: ThirdwebClient;
285285
}) {
286286
const account: Account = {
287-
address,
287+
address: getAddress(address),
288288
async sendTransaction(tx: SendTransactionOption) {
289289
const transactionHash = (await provider.request({
290290
method: "eth_sendTransaction",

packages/thirdweb/src/wallets/private-key.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { getRpcClient } from "../rpc/rpc.js";
1010
import type { AuthorizationRequest } from "../transaction/actions/eip7702/authorization.js";
1111
import { signTransaction } from "../transaction/actions/sign-transaction.js";
1212
import type { SerializableTransaction } from "../transaction/serialize-transaction.js";
13+
import { getAddress } from "../utils/address.js";
1314
import { type Hex, toHex } from "../utils/encoding/hex.js";
1415
import { signMessage } from "../utils/signatures/sign-message.js";
1516
import { signTypedData } from "../utils/signatures/sign-typed-data.js";
@@ -79,7 +80,7 @@ export function privateKeyToAccount(
7980
const address = publicKeyToAddress(publicKey);
8081

8182
const account = {
82-
address,
83+
address: getAddress(address),
8384
sendTransaction: async (
8485
tx: SerializableTransaction & { chainId: number },
8586
) => {

packages/thirdweb/src/wallets/smart/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ function createZkSyncAccount(args: {
421421
}): Account {
422422
const { creationOptions, connectionOptions, chain } = args;
423423
const account: Account = {
424-
address: connectionOptions.personalAccount.address,
424+
address: getAddress(connectionOptions.personalAccount.address),
425425
async sendTransaction(transaction: SendTransactionOption) {
426426
// override passed tx, we have to refetch gas and fees always
427427
const prepTx = {

packages/thirdweb/src/wallets/wallet-connect/controller.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ function createAccount({
333333
client: ThirdwebClient;
334334
}) {
335335
const account: Account = {
336-
address: address,
336+
address: getAddress(address),
337337
async sendTransaction(tx: SendTransactionOption) {
338338
const transactionHash = (await provider.request({
339339
method: "eth_sendTransaction",

0 commit comments

Comments
 (0)