Fixed LedgerSigner sendTransaction (#936).
This commit is contained in:
parent
72385c2287
commit
cadb28d6b3
@ -94,13 +94,22 @@ export class LedgerSigner extends ethers.Signer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async signTransaction(transaction: ethers.providers.TransactionRequest): Promise<string> {
|
async signTransaction(transaction: ethers.providers.TransactionRequest): Promise<string> {
|
||||||
const tx = transaction = await ethers.utils.resolveProperties(transaction);
|
const tx = await ethers.utils.resolveProperties(transaction);
|
||||||
const unsignedTx = ethers.utils.serializeTransaction(<ethers.utils.UnsignedTransaction>tx).substring(2);
|
const baseTx: ethers.utils.UnsignedTransaction = {
|
||||||
|
chainId: (tx.chainId || undefined),
|
||||||
|
data: (tx.data || undefined),
|
||||||
|
gasLimit: (tx.gasLimit || undefined),
|
||||||
|
gasPrice: (tx.gasPrice || undefined),
|
||||||
|
nonce: (tx.nonce ? ethers.BigNumber.from(tx.nonce).toNumber(): undefined),
|
||||||
|
to: (tx.to || undefined),
|
||||||
|
value: (tx.value || undefined),
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsignedTx = ethers.utils.serializeTransaction(baseTx).substring(2);
|
||||||
const sig = await this._retry((eth) => eth.signTransaction(this.path, unsignedTx));
|
const sig = await this._retry((eth) => eth.signTransaction(this.path, unsignedTx));
|
||||||
|
|
||||||
return ethers.utils.serializeTransaction(<ethers.utils.UnsignedTransaction>tx, {
|
return ethers.utils.serializeTransaction(baseTx, {
|
||||||
v: sig.v,
|
v: ethers.BigNumber.from("0x" + sig.v).toNumber(),
|
||||||
r: ("0x" + sig.r),
|
r: ("0x" + sig.r),
|
||||||
s: ("0x" + sig.s),
|
s: ("0x" + sig.s),
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user