Skip to content

Commit

Permalink
chore: fix window.ethereum
Browse files Browse the repository at this point in the history
  • Loading branch information
joepegler committed Dec 10, 2024
1 parent 12b47a5 commit 443ab9c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/sdk/account/utils/toSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,15 @@ export async function toSigner<
walletClient = signer as WalletClient<Transport, Chain | undefined, Account>
}

const addressFromWalletClient =
walletClient?.account?.address ?? (await walletClient?.getAddresses())?.[0]

if (!addressFromWalletClient) {
throw new Error("address not found in wallet client")
}

return toAccount({
address: walletClient.account.address,
address: addressFromWalletClient,
async signMessage({ message }) {
return walletClient.signMessage({ message })
},
Expand Down

0 comments on commit 443ab9c

Please sign in to comment.