refactor(sdk): remove as unknown as cast on freighterApi in base.ts - #483
refactor(sdk): remove as unknown as cast on freighterApi in base.ts#483VeronicDev wants to merge 4 commits into
Conversation
Closes TrusTrove#267 This fix addresses the runtime ReferenceError when users sign in by: 1. Adding initApiClientWithToken function to lib/api.ts that caches the token 2. Importing initApiClientWithToken in useAuth.ts 3. Calling initApiClientWithToken after setToken in login (success case) 4. Calling initApiClientWithToken after setToken in login (error case) 5. Calling initApiClientWithToken in logout function Co-authored-by: openhands <openhands@all-hands.dev>
Closes TrusTrove#311 This refactor removes the double 'as unknown as' cast pattern on freighterApi and uses the real types from @stellar/freighter-api v2 via direct import. The SDK now uses: import { signTransaction } from '@stellar/freighter-api'; This approach relies on the real types from the upstream package, making the code more maintainable and catching breaking changes at compile time rather than masking them with made-up interfaces. Co-authored-by: openhands <openhands@all-hands.dev>
|
@openhands-agent is attempting to deploy a commit to the K1NGD4VID Team on Vercel. A member of the Team first needs to authorize it. |
|
This PR has merge conflicts with the base branch. CI is passing, but the branch can't be merged as-is. Please rebase or merge the base branch locally and push the update - this won't be resolved automatically. |
K1NGD4VID
left a comment
There was a problem hiding this comment.
Auto-approved: CI passed.
|
Automated merge failed and a retry also failed. This needs manual investigation. Details: Merge failed on first attempt; retry (if attempted) also failed. |
|
This PR has merge conflicts with the base branch. CI is passing, but the branch can't be merged as-is. Please rebase or merge the base branch locally and push the update - this won't be resolved automatically. |
Description
This refactor removes the double as unknown as cast pattern on freighterApi and uses the real types from @stellar/freighter-api v2 via direct import.
Before
The SDK used a complex pattern with as unknown as double casts:
After
The SDK now uses direct import from the upstream package:
This approach relies on the real types from the upstream package, making the code more maintainable and catching breaking changes at compile time.
Related Issue
Closes #311