Skip to content
New issue

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

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

Already on GitHub? # to your account

Error: invalid object key - from - using Ledger Signer #936

Closed
andrewpaulicek opened this issue Jul 7, 2020 · 9 comments
Closed

Error: invalid object key - from - using Ledger Signer #936

andrewpaulicek opened this issue Jul 7, 2020 · 9 comments
Labels
discussion Questions, feedback and general information. fixed/complete This Bug is fixed or Enhancement is complete and published.

Comments

@andrewpaulicek
Copy link

andrewpaulicek commented Jul 7, 2020

Hi,

I have noticed there is a similar issue to #862 when using the LedgerSigner.

"@ethersproject/hardware-wallets": "^5.0.1",
"ethers": "^5.0.4",

The fix that worked out for me locally was to add from to allowedTransactionKeys array in @ethersproject/transaction.
https://github.com/ethers-io/ethers.js/blob/master/packages/transactions/src.ts/index.ts#L72

@ricmoo
Copy link
Member

ricmoo commented Jul 8, 2020

Can you provide a code snippet? :)

@ricmoo ricmoo added the discussion Questions, feedback and general information. label Jul 8, 2020
@andrewpaulicek
Copy link
Author

andrewpaulicek commented Jul 8, 2020

Hi,
sure thing.

const provider = new ethers.providers.JsonRpcProvider(rpcUrl);
const signer = new LedgerSigner(provider, 'hid', derivationPath ?? `m/44'/60'/0'/0/0`);
const feedContract = new ethers.Contract(feed.contractAddress.toString(), fluxAggregatorAbi, signer);
var res = await feedContract.withdrawPayment(oracleAddress, withdrawTo, withdrawableAmount, txOptions);

Our use case is calling a withdrawPayment function on the smart contract, but you won't be able to test it with this particular call / ABI :(.

@dhadrien
Copy link

I had the exact same issue, it seems sendTransaction does not work while signTransaction works.

Indeed I broadcasted the rawTransaction from a signTransaction and the tx was working as intended, however using the sendTransaction I got the following error:

UnhandledPromiseRejectionWarning: Error: invalid object key - from (argument="transaction:from"

The code creating the error

    const signer = new LedgerSigner(provider, 'hid', "44'/60'/0'/0");
    const addr = await signer.getAddress();
    const chaindId = await signer.getChainId();
    const nonce = await signer.getTransactionCount();
    txData.chainId = chaindId;
    // txData.from = addr;
    txData.nonce = nonce;
    const sentTransaction = await signer.sendTransaction(txData);

the code working as intended:

    const signer = new LedgerSigner(provider, 'hid', "44'/60'/0'/0");
    const addr = await signer.getAddress();
    const chaindId = await signer.getChainId();
    const nonce = await signer.getTransactionCount();
    txData.chainId = chaindId;
    // txData.from = addr;
    txData.nonce = nonce;
    const signedTransaction = await signer.signTransaction(txData);

@dhadrien
Copy link

Oh, and the chainId was not automatically added by the signer, might be related.

@ricmoo ricmoo added the on-deck This Enhancement or Bug is currently being worked on. label Aug 21, 2020
@dhadrien
Copy link

dhadrien commented Sep 4, 2020

Hey @ricmoo :) No pressure, but was wondering: should I do a hot fix locally are do you plan to release the bug fix soon?

Thanks!!

@ricmoo
Copy link
Member

ricmoo commented Sep 4, 2020

I’m trying to burn through the backlog right now, but this might be a week or two before I get this far back. If you can hotfix it for now, go for it. I’ll comment this ticket (which will notify you) once I get to it. :)

@ricmoo
Copy link
Member

ricmoo commented Sep 4, 2020

(I think this should be an easy fix, so I might take a look at this shortly actually; I’m having issues with my mocha reporter in the browser, and it’s easy to sneak in a few easy tasks with updates to the test case stuff ;))

@dhadrien
Copy link

dhadrien commented Sep 4, 2020

that would be amazing <3 thanks for the quick reply anyway!

You rock man

@ricmoo ricmoo added fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. labels Sep 11, 2020
@ricmoo
Copy link
Member

ricmoo commented Sep 12, 2020

This should be fixed now, please try it if you have any issues let me know. :)

Thanks! :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
discussion Questions, feedback and general information. fixed/complete This Bug is fixed or Enhancement is complete and published.
Projects
None yet
Development

No branches or pull requests

3 participants