feat(WIP): use boarsh schema type
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: https://github.com/near/near-sdk-js/pull/377
Test Plan
Related issues/PRs
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
summoning @hanakannzashi
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?
https://www.npmjs.com/package/borsher?activeTab=code borsher dosen't contains a
libdirectory, maybe this is the reason that not suppport in.jsfile. @hanakannzashi, can you please have a check?
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.
@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
