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 test case for Vector with borsh serializer #403

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

denbite
Copy link
Contributor

@denbite denbite commented Jul 21, 2024

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • Commit messages follow the conventional commits spec
  • If this is a code change: I have written unit tests.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

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

Added a new test case to verify that Near collections (Vector, LookupMap, etc) are correctly serialized and deserialized using the borsh serializer.
@denbite denbite requested review from ailisp and volovyks as code owners July 21, 2024 18:11
@ailisp
Copy link
Member

ailisp commented Jul 23, 2024

@denbite is this expected to pass after merge #402 ?


const message: PostedMessage = { premium, sender, text };
this.messages.push(message, {
serializer: (value) => borsh.serialize(MessageSchema, value),
Copy link
Member

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?

Copy link
Contributor Author

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);
Copy link
Member

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

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: NEW❗
Development

Successfully merging this pull request may close these issues.

2 participants