-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(credential-eip712): chainId for any did method #1334
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## next #1334 +/- ##
==========================================
- Coverage 89.84% 89.83% -0.02%
==========================================
Files 176 176
Lines 27278 27285 +7
Branches 2164 2164
==========================================
+ Hits 24509 24512 +3
- Misses 2769 2773 +4 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, leave some comments
@@ -161,7 +161,7 @@ export function getEthereumAddress(verificationMethod: VerificationMethod): stri | |||
* | |||
* @beta This API may change without a BREAKING CHANGE notice. | |||
*/ | |||
export function getChainIdForDidEthr(verificationMethod: _NormalizedVerificationMethod): number { | |||
export function getChainId(verificationMethod: _NormalizedVerificationMethod): number { | |||
if (verificationMethod.blockchainAccountId?.includes('@eip155')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be we can also add is NAN as the parseInt result
if it is nan, then throw error, hence the Eip712 fallback to use chainId 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
It is worth handling the NaN case that @stanleyyconsensys mentioned.
The test would be against a malformed blockchainAccountId:
eip155:0xe708:0x197...
eip155:linea:0x197...
0x197...@eip155:0xe708
0x197...@eip155:linea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
What issue is this PR fixing
Getting correct chainId for any did method
Quality
Check all that apply:
pnpm i
,pnpm build
,pnpm test
,pnpm test:browser
locally.