Skip to content

Migrated address.js file to TS#878

Open
quietbits wants to merge 1 commit intotypescript-migrationfrom
tsm-address
Open

Migrated address.js file to TS#878
quietbits wants to merge 1 commit intotypescript-migrationfrom
tsm-address

Conversation

@quietbits
Copy link
Contributor

No description provided.

@quietbits quietbits linked an issue Feb 26, 2026 that may be closed by this pull request
5 tasks
@github-actions
Copy link

Size Change: -331 B (-0.01%)

Total Size: 3.54 MB

Filename Size Change
dist/stellar-base.js 2.61 MB -302 B (-0.01%)
dist/stellar-base.min.js 929 kB -29 B (0%)

compressed-size-action

Copy link

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 migrates the address.js file to TypeScript as address.ts, including its test file and generating appropriate type declarations. The migration adds proper type annotations while preserving all existing functionality.

Changes:

  • Migrated src/address.js to TypeScript with type annotations for all methods and properties
  • Converted test file to TypeScript using vitest framework instead of Mocha/Chai
  • Generated type declaration file type_validation/address.d.ts

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/address.ts Migrated to TypeScript with proper type annotations, import path updates (.js extensions), and conversion of JSDoc comments to TypeScript types
type_validation/address.d.ts New generated TypeScript declaration file defining the Address class interface
test/unit/address.test.ts Migrated test file to TypeScript using vitest framework with updated assertion syntax (toBe, toEqual, toThrow)
test/unit/address_test.js Deleted old JavaScript test file
type_validation/memo.d.ts Minor alphabetical reordering of MemoType union (no functional change)
Comments suppressed due to low confidence (1)

src/address.ts:187

  • The original JavaScript code was future-proof for ClaimableBalanceId V1 by reading the version from the first byte of _key: new xdr.ClaimableBalanceId(\claimableBalanceIdTypeV${this._key.at(0)}`, this._key.subarray(1))`. The new code hardcodes to V0.

While V1 doesn't exist yet in the XDR, this creates an asymmetry: fromScAddress preserves the version byte when parsing (line 126), but toScAddress now always outputs V0. Consider adding a comment explaining this trade-off or restoring the dynamic version handling if the TypeScript XDR types support it.


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

Comment on lines +185 to +187
xdr.ClaimableBalanceId.claimableBalanceIdTypeV0(
this._key.subarray(1),
),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup that's correct

@quietbits quietbits changed the title Migrated address.js file to TS Migrated address.js file to TS Feb 26, 2026
@quietbits quietbits requested a review from Ryang-21 February 26, 2026 21:23
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.

Migrate address.js file to TS

3 participants