Closed pjc0247 closed 5 years ago
@jimni1222 please take a look.
@pjc0247 Which version of caver-js are you using? And is it correct that the account you want to test is AccountKeyRoleBased and that the account you want to caver.klay.accounts.wallet.add has feePayerKey?
what do you mean feePayerKey
?
Do I need to use different code for role based accounts?
my caver version is 1.2.0
.
Could you add some examples what the problem is? It would be better to provide some example code as what you did in #147 .
@kjhman21
You can reproduce it with issue #147 's snippet.
Change this line to
caver.klay.accounts.wallet.add({
address: "0x48649c3beb3e5abf532b0626ce72c27cb64e012f",
privateKey: "0x7b04975dea529019127697fb267a72e2bb3c26c3e85ae358864baa84a2b56d47"
});
below code
caver.klay.accounts.wallet.add('0x7b04975dea529019127697fb267a72e2bb3c26c3e85ae358864baa84a2b56d47');
But you have to replace 0x7b04~~
to AccountKeyRoleBased private key.
I also found that below code works:
caver.klay.accounts.wallet.add(PRIV_KEY, ADDRESS);
If this is intended behavior, I think this issue is same as #147.
@pjc0247 If caver.klay.accounts.wallet.add has only a private key as a parameter, the account is added with the address that matches the private key. To add an account with an address decoupled from a private key, as above, you need to pass an object that defines privateKey and address as parameters, or pass privateKey and address as parameters.
For a description of caver.klay.accounts.wallet.add, please refer to the document below. https://docs.klaytn.com/bapp/sdk/caver-js/api-references/caver.klay.accounts#wallet-add
This issue is for features that are working as intended, so i will close this. :) Please let me know if you have any additional questions.
@jimni1222 Got it, but please note that Error: Only Legacy transactions can be signed on a Klaytn node!
error was thrown when I tried the wrong code which doesn't make sense.
So this could be case3 for #147
@pjc0247 Yes, I understand that the error message is not enough to analyze the exact cause of the problem.
As mentioned in #147 , the error message will be fixed. The related PR will be uploaded within today, please feel free to comment. :)
Describe the bug
caver.klay.accounts.wallet.add(PRIVATE_KEY)
does not work with fee delegation account.How to reproduce Steps to reproduce the behavior:
Expected behavior Both method should work or throw the proper exception.
Attachments
This may not work
This should work