Skip to content

Commit

Permalink
Fallback to wallet address when populating tx in signTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
rileystephens28 committed Jun 17, 2024
1 parent 0d5cdb0 commit 4d27fa4
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/wallet/base-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,27 +89,26 @@ export class BaseWallet extends AbstractSigner {
from: tx.from ? resolveAddress(tx.from) : undefined,
});

if (to != null) {
if (to !== undefined) {
validateAddress(to);
tx.to = to;
}
if (from != null) {
validateAddress(from);
tx.from = from;
}

if (tx.from != null) {
if (from !== undefined) {
assertArgument(
getAddress(<string>tx.from) === this.#address,
getAddress(<string>from) === this.#address,
'transaction from address mismatch',
'tx.from',
tx.from,
from,
);
} else {
// No `from` specified, use the wallet's address
tx.from = this.#address;
}

const btx = QuaiTransaction.from(<QuaiTransactionLike>tx);
const digest= keccak256(btx.unsignedSerialized)
btx.signature = this.signingKey.sign(digest)
const digest = keccak256(btx.unsignedSerialized);
btx.signature = this.signingKey.sign(digest);

return btx.serialized;
}
Expand Down

0 comments on commit 4d27fa4

Please sign in to comment.