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

feat(WIP): use boarsh schema type #382

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

Conversation

fospring
Copy link
Contributor

@fospring fospring commented Mar 10, 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

related issue: #377

Test Plan

Related issues/PRs

@fospring
Copy link
Contributor Author

Hi @gagdiez , I re-exported BorshSchema from "borsher" and imported BorshSchema in test file, but it build failed withe error, do you know what's the problem on the re-exported error:

cd examples
pnpm run build:status-deserialize-class

major error info:

Error: 'BorshSchema' is not exported by ../node_modules/.pnpm/[email protected]/node_modules/borsher/dist/index.js, imported by ../packages/near-sdk-js/lib/index.js

@gagdiez
Copy link
Collaborator

gagdiez commented Mar 11, 2024

summoning @hanakannzashi

@fospring
Copy link
Contributor Author

fospring commented May 5, 2024

https://www.npmjs.com/package/borsher?activeTab=code
borsher dosen't contains a lib directory, maybe this is the reason that not suppport in .js file. @hanakannzashi, can you please have a check?
image

@fospring fospring force-pushed the feat-reconstruct-schema-type branch from fbb224d to c9d5707 Compare May 5, 2024 03:09
@fospring
Copy link
Contributor Author

fospring commented May 5, 2024

https://www.npmjs.com/package/borsher?activeTab=code borsher dosen't contains a lib directory, maybe this is the reason that not suppport in .js file. @hanakannzashi, can you please have a check? image

but I created examples/src/index2.js,

import { BorshSchema, borshSerialize, borshDeserialize } from 'borsher';
const n = 100;
const buffer = borshSerialize(BorshSchema.u8, n);

and then run:

cd examples
node src/index2.js

the result was OK, quite strange.

@ailisp
Copy link
Member

ailisp commented May 7, 2024

@fospring the problem is probably borsher isn't ESM packaged. CommonJS packaging is not supported by near-sdk-js builder. Let's skip this one from the 2.0 release and introduce it in a later version

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.

3 participants