Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update chainId if it is set with default value (0) #358

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/signers/abstract-signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ export abstract class AbstractSigner<P extends null | Provider = null | Provider
const pop = (await populate(this, tx)) as QuaiTransactionLike;

if (pop.type == null) {
pop.type = await getTxType(pop.from ?? null, pop.to ?? null);
pop.type = getTxType(pop.from ?? null, pop.to ?? null);
}

if (pop.nonce == null) {
if (pop.nonce == null || pop.nonce === 0) {
pop.nonce = await this.getNonce('pending');
}

if (pop.gasLimit == null) {
if (pop.gasLimit == null || pop.gasLimit === 0n) {
if (pop.type == 0) pop.gasLimit = await this.estimateGas(pop);
else {
//Special cases for type 2 tx to bypass address out of scope in the node
Expand All @@ -128,7 +128,7 @@ export abstract class AbstractSigner<P extends null | Provider = null | Provider
// Populate the chain ID
const network = await (<Provider>this.provider).getNetwork();

if (pop.chainId != null) {
if (pop.chainId != null && pop.chainId !== 0n) {
const chainId = getBigInt(pop.chainId);
assertArgument(chainId === network.chainId, 'transaction chainId mismatch', 'tx.chainId', zone);
} else {
Expand All @@ -148,7 +148,7 @@ export abstract class AbstractSigner<P extends null | Provider = null | Provider
if (tx.accessList) {
pop.accessList = tx.accessList;
} else {
pop.accessList = await this.createAccessList(tx);
pop.accessList = await this.createAccessList(pop as QuaiTransactionRequest);
}
}
//@TOOD: Don't await all over the place; save them up for
Expand Down
Loading