TypeError: Cannot read property 'include' of undefined
Closed this issue · 11 comments
Describe the bug
KIP-7 approve
method error. This bug does not occur in version 1.6.1, but in version 1.6.3.
How to reproduce
if (window.klaytn) {
const caver = new Caver(window.klaytn);
const KIP7Instance = new caver.kct.kip7('0x{address in hex}');
KIP7Instance.approve(
'0x{address in hex}',
new BigNumber('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'),
{ from: '0x{address in hex}'},
);
}
Environment (please complete the following information)
- caver-js version: 1.6.3
- Chrome version: 92.0.4515.107
- Kaikas version: 1.8.1
Additional context
I downgraded the version to 1.6.1 and it was resolved.
Did you add 0x{address in hex
address keyring to the caver.wallet
?
Please add to the in-memory wallet.
const keyring = caver.wallet.keyring.create('0x{address in hex}', '0x{private key}') // or you can use createFromPrivateKey
caver.wallet.add(keyring)
This is the front code. Use the Kaikas chrome extension program without using key string. If it doesn't support approve
using Kaikas, why does the same code work without any problem in version 1.6.1?
Between v1.6.1 ~ v1.6.3, there is some changings for caver.contract
.
Can you try with v1.6.4-rc.2?
A different error occurs than before. Is there any change in the way to use it? I following official documents of caver-js.
@hangem422
I merged one PR in this regard and deployed caver-js v1.6.4-rc.3.
Please check using the corresponding version.
As the fee delegation model was introduced in caver.contract, the logic to handle the case where there is no keyring in the existing caver.wallet
has changed.
In the past, sendTransaction
was used, but this time it was changed to call sendRawTransaction
after signTransaction
, but this part was changed to use sendTransaction
again.
Please check the PR for details. Thank you.
A new error occurred using a new version.
RPC Error: Error: Params' chain id (0x2019) does not match current network's chain id (8217)
at t.<anonymous> (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:1:66153)
at b (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94:167996)
at Generator._invoke (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94:167749)
at Generator.forEach.e.<computed> [as next] (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94:168176)
at n (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28:270264)
at chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28:270409
at new Promise (<anonymous>)
at new t (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:41:457700)
at t.<anonymous> (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28:270198)
at t.<anonymous> (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:1:67505)
at t.<anonymous> (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:1:132743)
at b (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94:167996)
at Generator._invoke (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94:167749)
at Generator.forEach.e.<computed> [as next] (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94:168176)
at n (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28:270264)
at chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28:270409
at new Promise (<anonymous>)
at new t (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:41:457700)
at t.<anonymous> (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28:270198)
at t.<anonymous> (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:1:132885)
at chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:1:254293
at b (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94:167996)
at Generator._invoke (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94:167749)
at Generator.forEach.e.<computed> [as next] (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94:168176)
at n (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28:270264)
at chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28:270361 Object
(anonymous) @ inpage.js:1
Error: Returned error: Error: Params' chain id (0x2019) does not match current network's chain id (8217)
at t.<anonymous> (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:1)
at b (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94)
at Generator._invoke (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94)
at Generator.forEach.e.<computed> [as next] (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94)
at n (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28)
at chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28
at new Promise (<anonymous>)
at new t (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:41)
at t.<anonymous> (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28)
at t.<anonymous> (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:1)
at t.<anonymous> (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:1)
at b (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94)
at Generator._invoke (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94)
at Generator.forEach.e.<computed> [as next] (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94)
at n (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28)
at chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28
at new Promise (<anonymous>)
at new t (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:41)
at t.<anonymous> (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28)
at t.<anonymous> (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:1)
at chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:1
at b (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94)
at Generator._invoke (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94)
at Generator.forEach.e.<computed> [as next] (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:94)
at n (chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28)
at chrome-extension://jblndlipeogpafnldhgmapagcccfchpi/background.js:28
at Object.ErrorResponse (errors.js:87)
at index.js:155
at inpage.js:24
at inpage.js:1
at i (inpage.js:1)
at inpage.js:1
at inpage.js:1
at f (inpage.js:1)
at s (inpage.js:1)
at inpage.js:1
at inpage.js:24
at inpage.js:24
at inpage.js:1
at f (inpage.js:1)
at s (inpage.js:1)
at inpage.js:1
at inpage.js:1
at inpage.js:24
at inpage.js:1
at f (inpage.js:1)
at inpage.js:1
at Nt (inpage.js:1)
at Object.<anonymous> (inpage.js:1)
at t.value (inpage.js:24)
at inpage.js:24
at n (inpage.js:1)
at i (inpage.js:1)
at inpage.js:1
at inpage.js:24
at n (inpage.js:1)
at i (inpage.js:1)
at inpage.js:1
at inpage.js:24
at inpage.js:1
at inpage.js:1
at f (inpage.js:1)
at s (inpage.js:1)
at inpage.js:1
at inpage.js:1
at inpage.js:24
If I request chain id of caver right before calling approve
, it prints 8217. And the mainnet chain id set in my Kaikas extension program is also 8217. Are there any additional properties that need to be set up when using the provider as Kaikas?
const id = await caver.klay.getChainId();
console.log(id); // 8217
@hangem422 0x2019
is hex format of 8217
. I think this issue should be fixed in Kaikas.
@jimni1222 So the format of the caver's chain id has been changed, and is it not compatible with Kaikas?
It's not incompatible, it's a bug that needs to be fixed in Kaikas.
This bug has been reported and will be fixed soon.
This is not cave-js issue anymore, so i will close this issue.
@jimni1222 Okay. Thank you so much for your quick response.