Skip to content

fix(node-sdk): inject SDK version at build time and make chains optional#30

Merged
chaitanyapotti merged 1 commit into
mainfrom
fix/node-sdk-build-version-and-optional-chains
Jun 17, 2026
Merged

fix(node-sdk): inject SDK version at build time and make chains optional#30
chaitanyapotti merged 1 commit into
mainfrom
fix/node-sdk-build-version-and-optional-chains

Conversation

@chaitanyapotti

Copy link
Copy Markdown
Member

Motivation and Context

The node SDK was reading package.json at runtime for analytics version tracking, which breaks in bundled environments and is unnecessary overhead. Additionally, chains was required in Web3AuthOptions even though the SDK can resolve chain config from the Web3Auth API, causing friction for simple integrations.

Description

  • Inject __WEB3AUTH_SDK_VERSION__ at build time via Rollup (rollup.config.mjs) and at test time via Vitest define
  • Make chains optional in Web3AuthOptions with safe fallbacks in Web3Auth (currentChainId defaults to 0x1, optional chaining for currentChain)
  • Update package entry points to dist/lib.cjs / dist/lib.esm and add package metadata
  • Migrate demo/node-app to ESM and update EIP155 signer usage for viem WalletClient (signer.account?.address)

How has this been tested?

  • npm run build --workspace=@web3auth/node-sdk — build succeeds; SDK_VERSION is "5.0.0" in dist output
  • npm run type-check --workspace=@web3auth/node-sdk — passes
  • npm run test --workspace=@web3auth/node-sdk — requires network access to api.web3auth.io and .env.test credentials (integration tests)

Screenshots (if appropriate):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project. (run lint)
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Replace runtime package.json reads with a build-time version constant, allow
connecting without an explicit chains array, and update the demo app for ESM
and viem WalletClient signer usage.
@chaitanyapotti chaitanyapotti requested review from a team as code owners June 17, 2026 06:17
@chaitanyapotti chaitanyapotti merged commit 1b34c10 into main Jun 17, 2026
1 check passed
@chaitanyapotti chaitanyapotti deleted the fix/node-sdk-build-version-and-optional-chains branch June 17, 2026 07:01
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