-
Notifications
You must be signed in to change notification settings - Fork 70
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 test case for Vector with borsh serializer #403
base: develop
Are you sure you want to change the base?
Conversation
Added a new test case to verify that Near collections (Vector, LookupMap, etc) are correctly serialized and deserialized using the borsh serializer.
|
||
const message: PostedMessage = { premium, sender, text }; | ||
this.messages.push(message, { | ||
serializer: (value) => borsh.serialize(MessageSchema, 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.
This is a manual serialization, can we make use of above
@NearBindgen({
serializer(value) {
return borsh.serialize(schema, value);
},
to auto serialize?
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.
didn't catch that, could you clarify?
|
||
@NearBindgen({ | ||
serializer(value) { | ||
return borsh.serialize(schema, 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.
schema is not defined, would result in error
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.
schema is defined in the bottom
Pre-flight checklist
Motivation
Added a new test case (based on GuestBook contract) to verify that Near collections (Vector, LookupMap, etc) are correctly serialized and deserialized using the borsh
Test Plan
Related issues/PRs
#402