Skip to content

[deps] Remove need for polyfill for Buffer.from#835

Merged
gregnazario merged 2 commits intomainfrom
remove-polyfill
Mar 2, 2026
Merged

[deps] Remove need for polyfill for Buffer.from#835
gregnazario merged 2 commits intomainfrom
remove-polyfill

Conversation

@gregnazario
Copy link
Collaborator

Description

Test Plan

Related Links

Checklist

  • Have you ran pnpm fmt?
  • Have you updated the CHANGELOG.md?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes reliance on Buffer.from (and associated polyfills) by switching string-to-bytes serialization to a shared TextEncoder and base64/base64url conversions to js-base64 utilities.

Changes:

  • Introduces a shared TEXT_ENCODER constant and updates internal code paths to use it instead of Buffer.from(..., "utf8").
  • Replaces base64url encoding/decoding that previously used Buffer with js-base64 (Base64.fromUint8Array(..., true) / Base64.toUint8Array(...)).
  • Updates unit/e2e tests to use the new encoding utilities.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit/address.test.ts Updates seeds to use TEXT_ENCODER.encode(...) instead of Buffer.from.
tests/e2e/transaction/signTransaction.test.ts Switches base64url challenge encoding from Buffer helpers to js-base64.
tests/e2e/transaction/helper.ts Replaces exported base64url helper implementation with js-base64.
src/utils/helpers.ts Replaces Buffer base64 decode with js-base64 decode utilities.
src/utils/const.ts Adds shared TEXT_ENCODER constant.
src/transactions/transactionBuilder/remoteAbi.ts Uses shared TEXT_ENCODER import instead of a local instance.
src/core/account/utils/address.ts Replaces Buffer.from(seed, "utf8") with TEXT_ENCODER.encode(seed).
src/bcs/serializer.ts Moves string serialization to shared TEXT_ENCODER import.
package.json No functional change (format-only).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gregnazario gregnazario merged commit ed2bc8f into main Mar 2, 2026
13 checks passed
@gregnazario gregnazario deleted the remove-polyfill branch March 2, 2026 16:56
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.

3 participants