Skip to content

feat: migrate build to tsup and use near-api-js directly#79

Draft
mikedotexe wants to merge 1 commit intoazbang:mainfrom
mikedotexe:feat/tsup-near-api-js
Draft

feat: migrate build to tsup and use near-api-js directly#79
mikedotexe wants to merge 1 commit intoazbang:mainfrom
mikedotexe:feat/tsup-near-api-js

Conversation

@mikedotexe
Copy link

⚠️ Depends on upstream near-api-js PRs — do not merge until all three land.

near-api-js is currently resolved from github:mikedotexe/near-api-js#pr/tsup-build.
Once the PRs below are merged and a new version is published, this will be
updated to a normal version range.

Upstream dependency chain (must merge in order)

  1. near/near-api-js#1894 — Inline borsh serializer, make is-my-json-valid optional
  2. near/near-api-js#1895 — Add standalone crypto utils and plain transaction builder (depends on #1894)
  3. near/near-api-js#1896 — Switch build from tsc to tsup: ESM + CJS + IIFE output (depends on #1895)

Summary

  • Replace @near-js/* scoped packages with near-api-js — all wallet integrations now import from near-api-js directly instead of @near-js/crypto, @near-js/transactions, etc.
  • Switch build from tsc to tsup — produces ESM, CJS, and IIFE output with proper exports map
  • Remove unnecessary dependencies — drops @meteorwallet/sdk (+ its patch-package hack), @here-wallet/core, @peersyst/near-mobile-signer, @noble/hashes, qr-code-styling, vite-plugin-node-polyfills
  • Use crypto utils from near-api-jssignHash, sha256, privateKeyFromRandom, etc. replace direct @noble/hashes usage
  • Use plain transaction buildersmapTransaction and mapAction from near-api-js replace hand-rolled conversion code
  • Replace qr-code-styling with qrcode-generator — lighter QR code generation

Test plan

  • yarn install resolves cleanly (once upstream PRs land)
  • yarn build produces dist/ with ESM, CJS, and IIFE bundles
  • yarn build:wallets builds all wallet modules without errors
  • Wallet integrations work end-to-end (hotwallet, meteor, mnw, near-mobile, nightly, okx, wallet-connect)

🤖 Generated with Claude Code

Replace granular @near-js/* scoped packages with near-api-js, switch
from tsc to tsup for ESM + CJS + IIFE output, and remove patch-package
hacks and unnecessary dependencies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mikedotexe
Copy link
Author

near-api-js-wallets-update

quite dramatic reduction. big small if true

@frol
Copy link
Contributor

frol commented Mar 16, 2026

Just for the reference: #73 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants