Skip to content
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

Update to use stellar-wallets-kit to support other wallets #115

Open
paulbellamy opened this issue Jun 5, 2023 · 3 comments
Open

Update to use stellar-wallets-kit to support other wallets #115

paulbellamy opened this issue Jun 5, 2023 · 3 comments
Labels
soroban-scrum A label to make relevant issues appear in the Platform Scrum board.

Comments

@paulbellamy
Copy link
Contributor

What problem does your feature solve?

The example dapp should use standard libraries to support many wallets, so that devs can learn best practices.

What would you like to see?

Instead of connecting directly to Freighter, the dapp should use https://github.com/Creit-Tech/Stellar-Wallets-Kit

What alternatives are there?

@paulbellamy paulbellamy added the soroban-scrum A label to make relevant issues appear in the Platform Scrum board. label Jun 5, 2023
@esteblock
Copy link
Contributor

Great! Will check this to include it in paltalabs/soroban-react#11

@esteblock
Copy link
Contributor

Currently, @soroban-react uses "connectors"
Each connector should be created first as a package @soroban-react/my-connector and then used like this:

...
import {futurenet, sandbox, standalone} from '@soroban-react/chains';
import {freighter} from '@soroban-react/freighter';
 ...   
const connectors: Connector[] = [freighter()];
                                           
  export default function ProviderExample({children}:{children: React.ReactNode}) {
    return (
      <SorobanReactProvider
        chains={chains}
        appName={"Example Stellar App"}
        connectors={connectors}>
          <SorobanEventsProvider>
          {children}
        </SorobanEventsProvider>
      </SorobanReactProvider>
    )
  }

A connector should just do:

export type Connector = {
  id: string;
  name: string;
  shortName?: string;
  iconUrl: string | (() => Promise<string>);
  iconBackground: string;
  installed?: boolean;
  downloadUrls?: {
    android?: string;
    ios?: string;
    browserExtension?: string;
    qrCode?: string;
  };
  isConnected: () => boolean;
  getNetworkDetails: () => Promise<NetworkDetails>;
  getPublicKey: () => Promise<string>;
  signTransaction: (xdr: string, opts?: { network?: string; networkPassphrase?: string; accountToSign?: string }) => Promise<string>;
};

@esteblock
Copy link
Contributor

I see that Stellar-Wallet-Kit has a similar architecture:
https://github.com/Creit-Tech/Stellar-Wallets-Kit/tree/main/src/lib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
soroban-scrum A label to make relevant issues appear in the Platform Scrum board.
Projects
Status: Backlog
Development

No branches or pull requests

3 participants
@paulbellamy @esteblock and others