question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve connector abstraction

See original GitHub issue

At the moment the connector abstraction is very bare bone, consisting only of the InjectedConnector class (and the proposed testing connector in #54). Now we have a new wallet (see #77) and so it makes sense to improve what is available.

As a React library we have a few of design goals:

  1. Give maximum control to developers when it comes to the UI and UX of their application. Embedding a modal is sub-optimal IMHO, ready-made wallet pickers should be developed on top of this library and not the other way round.
  2. Support future non-injected wallets like Wallet Connect.
  3. Improve discoverability, so for example show wallets that the user has not installed but the developer wants to push.
  4. Support all kind of injected wallets, without the developer having to manually add them.

Point 3 and 4 are at odds so there’s going to be tradeoffs.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
fracekcommented, Apr 24, 2022

I think the best way forward is to continue improving on the connectors interface we have. There should be a way to list StarkNet wallets installed by the user (for example, have a global dictionary window.starknetWallet[id] => wallet) that we can leverage when building connectors. Then we would add:

  • Wallet specific classes (ArgentConnector, BraavosConnector, etc).
  • An helper function to automatically detect injected wallets.

Then we can update the current API to something like:

const connectors = [
  new ArgentConnector(),
  new CartridgeConnector(),
  new OtherConnector()
].filter(connector => connector.available())

<StarknetProvider connectors={connectors}>
  <MyApp />
</StarknetProvider>

The modal component would use the available connectors as follows:

const connectors = useConnectors()

<div>
{connectors.map(connector => (
  <button onClick={connector.connect}><img src={connector.iconUrl} /> Connect {connector.name}</button>
))}
</div>

I think having a global injected registry of wallets would also be beneficial to the wallets since they can control branding by providing an icon and homepage url.

1reaction
avimakcommented, May 4, 2022

I believe that refactoring get-starknet “core” APIs into a dedicated package under the same repo (i.e. get-starknet/core) will answer most of the points raised above. flexibility, no UI, lookup installed wallets, discovery for available (non-installed) wallets, wallets order/include/exclude options for dapps, aligning wallet APIs for easier dapps<->wallet integrations, unified types, etc.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Implement Software Connectors? A Reusable ...
The goal of this paper is to propose a better way to implement abstract connectors. In the remainder of this article, section 2...
Read more >
How to Implement Software Connectors? A ... - ResearchGate
For a better reuse of design effort, and to avoid using only simple connectors when realizing applications, we propose to define connectors as ......
Read more >
How to Implement Software Connectors? A ... - Springer Link
In this article, we propose a means to fill the gap between connector specification and implementation. For a better reuse of design effort,...
Read more >
Increasing the Level of Abstraction as a Strategy for ...
In this paper, we propose increasing levels of abstraction as a strategy for speeding the adoption of new technologies.
Read more >
Ports, Components, and Connectors: the next great abstraction?
Agilest will argue that feedback from actual running code is the best way to battle complexity and scale. Tighten the feedback loop with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found