fix: commonjs compatibility#1877
Conversation
🦋 Changeset detectedLatest commit: 1954977 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
# Conflicts: # packages/accounts/src/account.ts # packages/accounts/src/interface.ts # packages/accounts/src/local-view-execution/index.ts # packages/accounts/src/local-view-execution/runtime.ts # packages/accounts/src/local-view-execution/types.ts # packages/accounts/src/utils.ts # packages/accounts/test/account.test.ts # packages/client/src/view.ts # packages/cookbook/transactions/batch-transactions.ts # packages/crypto/package.json # packages/near-api-js/package.json # packages/near-api-js/tsup.config.ts # packages/providers/src/failover-rpc-provider.ts # packages/providers/src/json-rpc-provider.ts # packages/tokens/package.json # packages/utils/src/provider.ts # pnpm-lock.yaml # src/crypto/key_pair_ed25519.ts # src/crypto/key_pair_secp256k1.ts # src/crypto/public_key.ts # src/transactions/action_creators.ts # src/utils/format.ts # test/unit/transactions/transaction.test.ts
- Use prehash: false since NEAR provides pre-hashed messages - Reorder recovered signature bytes from [recovery, r, s] to [r, s, recovery] to match NEAR's expected 65-byte format - Replace Buffer.from(hex) with Uint8Array in tests Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| "near-api-js": major | |||
There was a problem hiding this comment.
this would release near-api-js v8, maybe lets change it to "minor" so we release near-api-js 7.2.0 instead
thought, it could even be a patch, because there is no change in interfaces, only external things
There was a problem hiding this comment.
Nice catch, yeah I had the wrong idea about semver here. fixed in f8543dd
|
nice, I think that we do actually need this, and I do not have any major concerns with the code changes. Want to hear also @denbite's opinion as he created most of the v7 |
|
I want to share this because it's astonishing what can happen with compilations after doing these kinds of things suggested in this pull request:
More details about how this fit into shrinking the wallet compilations here azbang/near-connect#73 |
|
@mikedotexe overall this PR is looking good I’ve also been meaning to migrate from one thing I wanted to highlight though, is that we try to follow our changeset rules quite closely right now this PR seems to be doing two separate things:
ideally these would be implemented as two separate PRs if we do that, this LGTM from my side |
Head branch was pushed to by a user without write access

Pre-flight checklist
pnpm changesetto create achangesetJSON document appropriate for this change.Motivation
near-api-jsis a powerful library for connecting and interacting with the NEAR blockchain. Currently, there are some places where we can make small gains by removing the EcmaScript APIs (likeBuffer) with safe and modern APIs.More information on motivation located in issue #1876
Test Plan
Same tests, all passing, none added
Related issues/PRs
Issue #1876
Some screenshots that might help understand, or at least helped me…
BufferswapRemoval of dependency in favor of native and secure API
and so on.
Note: some of these screenshots are before pushing up the merge conflicts, but they illustrate what's happening here.