-
Notifications
You must be signed in to change notification settings - Fork 1
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/sessionkey token validation #40
Conversation
Yooo! You forgot to bump the version in package.json! |
Yooo! You forgot to bump the version in package.json! |
|
||
const erc20 = new Contract(token, ERC20_ABI, this.provider); | ||
const decimals = await erc20.decimals(); | ||
if (!decimals || decimals == null || decimals as number == 0) { |
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.
@kanthgithub !decimals
will shadow decimals==null
i think we can skip decimals==null
as it will get covered in !decimals
also can a erc20 token not have decimals as zero, is there a reason not to support it ?
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.
this is just to check if it is atoken address that exists on this chain
calling the view function on it
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.
updated by removing redundant check
@@ -66,6 +67,12 @@ export class SessionKeyValidator { | |||
throw new Error('Function Selector is required'); | |||
} | |||
|
|||
const isAValidTokenIndicator = await this.isAValidToken(token); |
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.
Can we rename it to isValidTokenIndicator
?
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.
updated
@@ -1,4 +1,9 @@ | |||
# Changelog | |||
## [2.0.5] - 2024-09-23 | |||
### Breaking Changes | |||
- validate the tokenAddress for `enableSessionKey` on `SessionKeyValidator` SDK instance |
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.
How is this a breaking change? Will it affect how existing users integrate our SDK?
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.
updated the change log
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
Description
enableSessionKey
androtateSessionKey
to validate the token address in the session dataTypes of changes