-
Notifications
You must be signed in to change notification settings - Fork 0
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: update checks for old format #6
Conversation
@@ -23,3 +23,6 @@ export const VALUE_KEY = b64encode("value"); | |||
export const STORE_KEY = b64encode("store"); | |||
export const VSTORAGE_VALUE = b64encode("vstorage"); | |||
export const KEY_KEY = b64encode("key"); | |||
export const STORE_NAME_KEY = b64encode("store_name"); | |||
export const SUBKEY_KEY = b64encode("store_subkey"); | |||
export const UNPROVED_VALUE_KEY = b64encode("unproved_value"); |
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.
SUBKEY_KEY
......... KEY KEY :D Perhaps, SUB_KEY
?
I think this is cleaner:
export const STORE_NAME = b64encode("store_name");
export const SUB_KEY = b64encode("store_subkey");
export const UNPROVED_VALUE = b64encode("unproved_value");
Line 25 too :D
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.
the repetition is there intentionally to indicate the actual name of the key. for keys that end with "key" the name might look strange but i think we should keep the same pattern among all consts to avoid confusion
if (!valueAttr || !valueAttr.value) { | ||
logger.warn("Value attribute is missing or empty."); | ||
return; | ||
} | ||
|
||
const keyAttr = event.attributes.find((a: any) => a.key === KEY_KEY); | ||
const keyAttr = event.attributes.find((a: any) => a.key === KEY_KEY || a.key === SUBKEY_KEY); | ||
if (!keyAttr) { |
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.
Why use :any
on line 65 and 71 but not on 60?
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.
accidentally added
@@ -10,7 +10,8 @@ | |||
"outDir": "dist", | |||
"rootDir": "src", | |||
"target": "es2017", | |||
"strict": true | |||
"strict": true, | |||
"lib": ["es2021"] | |||
}, |
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.
I see you added the lib
option in tsconfig.json
. Why make this change and which features from ES2021 you want to use?
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.
it enables us to use replaceAll
function
chore: removed any type
Fixes: #1
This PR fixes the attribute checks in the
handleStateChangeEvent
function.It checks for another format of the
event.attributes
property which contains different values for thekey
property and different encoding for thevalues
This now results in psm.Governances of all tokens to be indexed
How to test:
set
startBlock
andendBlock
to 9813445 and 9813490 respectively and start withyarn dev