[deps] Remove need for polyfill for Buffer.from#835
Merged
gregnazario merged 2 commits intomainfrom Mar 2, 2026
Merged
Conversation
0482e60 to
bed1e5f
Compare
Contributor
There was a problem hiding this comment.
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_ENCODERconstant and updates internal code paths to use it instead ofBuffer.from(..., "utf8"). - Replaces base64url encoding/decoding that previously used
Bufferwithjs-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.
WGB5445
approved these changes
Mar 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Test Plan
Related Links
Checklist
pnpm fmt?CHANGELOG.md?