Update UltraSwapService.ts#213
Conversation
|
@Leon-Zh80 is attempting to deploy a commit to the wowcats Team on Vercel. A member of the Team first needs to authorize it. |
thejesh23
left a comment
There was a problem hiding this comment.
This PR is presented as a tidy-up but quietly introduces breaking changes that the empty description doesn't call out. Worth either splitting or documenting before merge:
-
Dropped
status: 'Success' | 'Failed'fromUltraSwapResponseBase— any caller that switches onresponse.statusto distinguish success/failure now silently breaks. If the discriminator is meant to come from elsewhere (e.g. presence oferror), the union still works structurally but every existing consumer needs an audit. -
throw response→throw new UltraSwapApiError(...)— this is a behavioral change at every call site. Existingcatchblocks that expect aResponse(and call.json()on it, or check.status) will fail. Better error handling is a real improvement, but it has to land with the call-site updates in the same PR, otherwise quotes/swaps will throw uncaught. -
_fetchAndCheckreturnsPromise<any>— erases the type safety that the original explicitresponse.json()calls were leaning on. Worth making it generic:private async _fetchAndCheck<T>(...): Promise<T>. -
Title "Update UltraSwapService.ts" + empty body for a 146/-83 line refactor across the service surface — please add a description so reviewers can assess intent vs. scope.
Most of the structural cleanup (UltraSwapApiError, route map rename, JSDoc) looks fine in isolation; the concern is bundling breaking interface changes alongside it without notice.
No description provided.