-
-
Notifications
You must be signed in to change notification settings - Fork 252
Ramps-Controller #6999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Ramps-Controller #6999
Conversation
| const nativeContext = (context as unknown as string) as keyof typeof NativeContext; | ||
| const nativeConfig: NativeRampsSdkConfig = { | ||
| context: NativeContext[nativeContext] ?? NativeContext.Browser, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Unsafe Context Mapping Causes Inconsistent SDK Behavior
The NativeRampsSdk initialization on line 539 maps the context value unsafely. The direct cast from context to keyof typeof NativeContext lacks runtime validation, which can result in NativeContext[nativeContext] evaluating to undefined and the SDK falling back to a default context inconsistently.
| }; | ||
| export type RampsControllerDepositGetTransalationAction = { | ||
| type: `${typeof controllerName}:depositGetTransalation`; | ||
| handler: RampsController['depositGetTransalation']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Translation Typo Causes SDK Method Mismatch
The depositGetTransalation method, its action type, and messenger handler are misspelled as "Transalation" instead of "Translation." This typo creates a mismatch with the correctly named NativeQuoteTranslation type from the SDK, potentially causing issues when calling the underlying SDK method.
Explanation
Ramps currently depends on an sdk to handle all connections to the RAMPS api. We now have 2 different offerings which each use their own SDK. All of this routing logic is done on the mobile app. If this logic were to be extended to pdapp or extension it would require rework on those codebases. Additionally many other teams already use this controller design pattern. By moving towards this we can handle all business logic in 1 controller. It lets us expose Ramps data and apis to other experiences without those experiences requiring any knowledge of business logic. Lastly it would speed up any Ramps api integrations on extension and pdapp in the future.
References
Checklist
Note
Introduce
ramps-controllerpackage withRampsController, tests, docs, and build/tooling setup.packages/ramps-controllerRampsControllerinsrc/RampsController.tsand exports public API viasrc/index.ts.src/RampsController.test.tsandjest.config.js.package.json,tsconfig.json,tsconfig.build.json, andtypedoc.json.README.md, initializesCHANGELOG.md, and includesLICENSE.tsconfig.build.jsonto integrate the new package.Written by Cursor Bugbot for commit 4c43415. This will update automatically on new commits. Configure here.