[POC] Enhancing XchainJS Library with multi wallet support #910
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.
Description:
In the course of documenting and providing examples for integrating Ledger wallets and other external wallets with the XchainJS library, we have identified an opportunity for a substantial enhancement.
Our proposal is to introduce a base class in each blockchain package supported by XchainJS. This base class will house the shared code necessary for different wallet types, with an initial focus on Keystore and Ledger wallets. This streamlined approach will provide a consistent and efficient framework for integrating various wallets.
Additionally, specific client classes tailored to each wallet type will be developed. These classes will extends base class and will handle the unique methods and actions needed for interactions with each wallet type, simplifying the overall code structure and improving maintainability.
A critical aspect of this enhancement is the modification of the
getAddress
function in theBaseXChainClient.ts
interface. This function must be transformed to an asynchronous operation. This change is pivotal as it will impact all client implementations within the library.By incorporating these ready-to-use classes and addressing the critical need for asynchronous operations, we aim to significantly improve the developer experience. This enhancement will solidify XchainJS's position as the preferred choice for seamless and adaptable blockchain and wallet integrations.
As a proof of concept I have made some changes to the Bitcoin package as an example, do not fear it as a definitive code. It is just to discuss about this concept and if we want to continue working in this line.
Please leave your opinions in the comments