This is the first step of adding a CAIP-2 scope to internal requests.
It's a "first step" as for now, we cannot get/extract the chainId for some methods. This would require a much bigger refactor (which will come later).
signTransaction requests
The chainId is part of the transaction request, so we extract it from there and attach it to the internal request.
signTypedData (when applicable) requests
The chainId is part of the domain field (as defined by EIP-712), however, some older versions of the eth_signTypedData_vX might not have it! In this case, we do not provide the scope.
As of today, only those methods do not have the domain:
Description
This is the first step of adding a CAIP-2 scope to internal requests.
It's a "first step" as for now, we cannot get/extract the
chainId
for some methods. This would require a much bigger refactor (which will come later).signTransaction
requestsThe
chainId
is part of the transaction request, so we extract it from there and attach it to the internal request.signTypedData
(when applicable) requestsThe
chainId
is part of thedomain
field (as defined by EIP-712), however, some older versions of theeth_signTypedData_vX
might not have it! In this case, we do not provide thescope
.As of today, only those methods do not have the
domain
:eth_signTypedData
eth_signTypedData_v1
Related issues
Testing
Manual testing
Prerequisites
1. Transaction
eip155:${chainId}
(depending on which chain you are using)2. Typed data
eip155:${chainId}
(depending on which chain you are using)Test coverage report
Coverage remains at 100%
Jest
Added a new test for CAIP helpers:
Updated test regarding transaction flow: