Skip to content
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

add a simple implementation of ADR002 #59

Merged
merged 1 commit into from
May 16, 2024
Merged

add a simple implementation of ADR002 #59

merged 1 commit into from
May 16, 2024

Conversation

konnov
Copy link
Contributor

@konnov konnov commented May 16, 2024

This PR implements ADR002.

@konnov konnov self-assigned this May 16, 2024
@konnov konnov added the enhancement New feature or request label May 16, 2024
@konnov konnov added this to the M1: Transaction extractor milestone May 16, 2024
Comment on lines +97 to +107
const loaded = JSONbig.parse(contents)
return {
height: loaded.height as number,
contractId: loaded.contractId as string,
txHash: loaded.txHash as string,
method: loaded.method as string,
methodArgs: loaded.methodArgs as any[],
returnValue: loaded.returnValue,
fields: OrderedMap<string, any>(loaded.fields),
oldFields: OrderedMap<string, any>(loaded.oldFields),
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd prefer to have a validation method, which checks that loaded has the correct shape, and then returns the value cast to the correct type with given field types, instead of just blind-casting each field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please feel free to implement one!

Copy link
Collaborator

@Kukovec Kukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not going to block with the above, LGTM generally.

@konnov konnov merged commit 1ec07e5 into main May 16, 2024
3 checks passed
@konnov konnov deleted the igor/storage branch May 16, 2024 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants