Migrate public API from Buffer to Uint8Array#1564
Open
Ryang-21 wants to merge 11 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Migrates the SDK’s public binary APIs from Node Buffer to platform-standard Uint8Array, reducing browser polyfill requirements.
Changes:
- Replaces Buffer-based crypto, transaction, XDR, contract, RPC, and WebAuth APIs.
- Replaces
base32.jswith@exodus/bytesand removes bundler Buffer injection. - Updates tests, documentation, generated references, and migration guidance.
Reviewed changes
Copilot reviewed 109 out of 112 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
types/base32.js/index.d.ts |
Removes obsolete Base32 declarations. |
tsconfig.json |
Removes Base32 type inclusion. |
test/unit/xdr/schema_exhaustive.test.ts |
Uses Uint8Array conversions for XDR comparisons. |
test/unit/xdr/primitive_shims.test.ts |
Replaces Buffer base64 encoding. |
test/unit/xdr/legacy_round_trip.test.ts |
Limits Buffer use to legacy XDR. |
test/unit/xdr/corpus_round_trip.test.ts |
Migrates corpus decoding and comparisons. |
test/unit/utils.test.ts |
Updates byte-string conversions. |
test/unit/transaction.test.ts |
Passes XDR bytes directly to StrKey. |
test/unit/spec/contract_spec.test.ts |
Migrates contract-spec byte handling. |
test/unit/server/soroban/simulate_transaction.test.ts |
Replaces base64 Buffer fixtures. |
test/unit/server/soroban/request_airdrop.test.ts |
Migrates byte fixtures and contract IDs. |
test/unit/server/soroban/get_contract_wasm.test.ts |
Uses Uint8Array WASM fixtures. |
test/unit/server/soroban/get_classic_entries.test.ts |
Migrates classic-entry byte construction. |
test/unit/no_buffer_polyfill.test.ts |
Adds browser-safe public API coverage. |
test/unit/http_client_contract.test.ts |
Uses Uint8Array response bodies. |
test/unit/contract/client_from.test.ts |
Builds test WASM without Buffer. |
test/unit/base/transaction.test.ts |
Migrates transaction byte assertions. |
test/unit/base/transaction_envelope.test.ts |
Converts transaction hashes to hex. |
test/unit/base/transaction_builder.test.ts |
Migrates muxed-account byte construction. |
test/unit/base/sorobandata_builder.test.ts |
Tests raw Uint8Array construction. |
test/unit/base/signing.test.ts |
Migrates signing vectors and assertions. |
test/unit/base/scval.test.ts |
Migrates ScVal byte tests. |
test/unit/base/operations/set_trustline_flags.test.ts |
Decodes XDR hex directly. |
test/unit/base/operations/set_options.test.ts |
Migrates signer byte tests. |
test/unit/base/operations/revoke_sponsorship.test.ts |
Migrates signer and payload bytes. |
test/unit/base/operations/path_payment_strict_receive.test.ts |
Decodes XDR hex directly. |
test/unit/base/operations/manage_data.test.ts |
Tests Uint8Array ManageData values. |
test/unit/base/operations/liquidity_pool_withdraw.test.ts |
Decodes XDR hex directly. |
test/unit/base/operations/invoke_host_function.test.ts |
Migrates contract operation bytes. |
test/unit/base/operations/inflation.test.ts |
Decodes XDR hex directly. |
test/unit/base/operations/create_account.test.ts |
Decodes XDR hex directly. |
test/unit/base/operations/clawback.test.ts |
Decodes XDR hex directly. |
test/unit/base/operations/allow_trust.test.ts |
Decodes XDR hex directly. |
test/unit/base/memo.test.ts |
Migrates memo byte behavior tests. |
test/unit/base/liquidity_pool_id.test.ts |
Migrates pool ID byte handling. |
test/unit/base/invocation.test.ts |
Replaces Buffer fixtures. |
test/unit/base/hashing.test.ts |
Tests Uint8Array hash results. |
test/unit/base/get_liquidity_pool_id.test.ts |
Converts pool IDs using byte utilities. |
test/unit/base/fee_bump_transaction.test.ts |
Migrates fee-bump byte assertions. |
test/unit/base/claimant.test.ts |
Passes claimant bytes directly. |
test/unit/base/base32.test.ts |
Adds strict Base32 compatibility tests. |
test/unit/base/auth.test.ts |
Migrates authorization signatures and ordering. |
test/unit/base/asset.test.ts |
Uses Uint8Array equality helpers. |
test/unit/base/address.test.ts |
Migrates address byte fixtures. |
test/setup-browser.ts |
Removes the browser Buffer global. |
test/e2e/src/custom-types.test.ts |
Migrates custom byte-type inputs. |
test/e2e/src/bindings.test.ts |
Migrates generated binding byte tests. |
src/xdr/values/to-json.ts |
Replaces Buffer wire conversions with typed arrays. |
src/webauth/utils.ts |
Uses Uint8Array equality and verification. |
src/webauth/challenge_transaction.ts |
Migrates challenge decoding and comparisons. |
src/rpc/server.ts |
Returns and accepts Uint8Array WASM data. |
src/horizon/horizon_api.ts |
Changes ManageData response typing. |
src/contract/wasm_spec_parser.ts |
Accepts and returns Uint8Array. |
src/contract/utils.ts |
Parses WASM directly from byte views. |
src/contract/spec.ts |
Migrates contract spec byte conversion. |
src/contract/client.ts |
Migrates WASM hash and salt APIs. |
src/contract/basic_node_signer.ts |
Replaces Buffer base64 signing. |
src/contract/assembled_transaction.ts |
Decodes wallet signatures to Uint8Array. |
src/cli/util.ts |
Renames local WASM bytes. |
src/bindings/wasm_fetcher.ts |
Returns Uint8Array WASM content. |
src/bindings/utils.ts |
Documents generated Uint8Array types. |
src/bindings/generator.ts |
Accepts Uint8Array WASM input. |
src/bindings/client.ts |
Updates generated deployment signatures. |
src/base/util/decode_encode_muxed_account.ts |
Migrates muxed-account byte assembly. |
src/base/transaction.ts |
Migrates envelope and signature-base bytes. |
src/base/transaction_base.ts |
Migrates signatures, hashes, and preimages. |
src/base/strkey.ts |
Replaces Base32 and Buffer implementation. |
src/base/sorobandata_builder.ts |
Narrows raw input to Uint8Array. |
src/base/signing.ts |
Returns Uint8Array from signing helpers. |
src/base/signerkey.ts |
Uses DataView and Uint8Array signer data. |
src/base/scval.ts |
Handles Uint8Array native values. |
src/base/operations/types.ts |
Updates public operation byte types. |
src/base/operations/set_options.ts |
Migrates signer hash decoding. |
src/base/operations/revoke_sponsorship.ts |
Migrates sponsorship signer bytes. |
src/base/operations/manage_data.ts |
Accepts Uint8Array data values. |
src/base/operations/liquidity_pool_withdraw.ts |
Decodes pool IDs without Buffer. |
src/base/operations/liquidity_pool_deposit.ts |
Decodes pool IDs without Buffer. |
src/base/operations/invoke_host_function.ts |
Copies contract bytes into Uint8Array. |
src/base/operations/allow_trust.ts |
Encodes asset codes as Uint8Array. |
src/base/operation.ts |
Returns Uint8Array operation fields. |
src/base/memo.ts |
Migrates memo values and validation. |
src/base/liquidity_pool_id.ts |
Converts pool IDs to hex. |
src/base/liquidity_pool_asset.ts |
Converts computed IDs to hex. |
src/base/keypair.ts |
Migrates key and signature APIs. |
src/base/invocation.ts |
Converts invocation bytes to hex. |
src/base/hashing.ts |
Returns Uint8Array SHA-256 results. |
src/base/get_liquidity_pool_id.ts |
Returns raw Uint8Array IDs. |
src/base/fee_bump_transaction.ts |
Returns Uint8Array signature bases. |
src/base/events.ts |
Encodes contract IDs directly. |
src/base/contract.ts |
Stores contract IDs as Uint8Array. |
src/base/claimant.ts |
Encodes claimant bytes directly. |
src/base/auth.ts |
Migrates authorization callback signatures. |
src/base/asset.ts |
Removes Buffer-based asset conversions. |
src/base/address.ts |
Migrates address storage and APIs. |
rollup.config.mjs |
Removes Buffer injection and aliasing. |
pnpm-lock.yaml |
Updates Base32 and Buffer dependencies. |
package.json |
Adds @exodus/bytes; removes Buffer tooling. |
docs/UINT8ARRAY_MIGRATION.md |
Adds the v17 migration guide. |
docs/reference/seps-webauth.md |
Refreshes WebAuth source links. |
docs/reference/network-horizon.md |
Updates ManageData reference typing. |
docs/reference/core-xdr.md |
Documents Uint8Array hash output. |
docs/reference/contracts-bindings.md |
Documents Uint8Array WASM input. |
config/vitest.config.browser.ts |
Removes Buffer browser dependency. |
CHANGELOG.md |
Records the breaking API migration. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| > { | ||
| name: string; | ||
| value: Buffer; | ||
| value: Uint8Array; |
| "vitest": "^4.1.9" | ||
| }, | ||
| "dependencies": { | ||
| "@exodus/bytes": "^1.15.1", |
Comment on lines
+10
to
+12
| The `buffer` dependency is gone, and the browser bundle no longer needs (or | ||
| ships) a Buffer polyfill — the SDK now runs in browsers, edge runtimes, Deno, | ||
| and Bun with no shims. |
| | --- | | ||
| | `rpc.Server#getContractWasmByContractId()`, `#getContractWasmByHash()` | | ||
| | `contract.Spec` byte-typed spec entries and `specFromWasm` results | | ||
| | `Horizon.ManageDataOperationResponse.value` | |
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.
What
Replaces
BufferwithUint8Arrayacross the public API: crypto and strkey helpers, value types, transactions, operations, auth, and the contract, rpc, and webauth layers. Drops the buffer polyfill and thebufferdependency. Adds a migration guide, changelog entry, and a Keypair test that checks seeds are copied, not aliased.Why
Bufferis a Node type. Shipping it in browser bundles requires a polyfill that adds weight and breaks in some bundlers.Uint8Arrayis the platform standard and works everywhere. This is a breaking change, so it lands on the v17 feature branch.