Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ronanyeah/solana-connect
Standalone wallet UI for Solana dApps
https://github.com/ronanyeah/solana-connect
dapp-developers solana walletconnect
Last synced: 11 days ago
JSON representation
Standalone wallet UI for Solana dApps
- Host: GitHub
- URL: https://github.com/ronanyeah/solana-connect
- Owner: ronanyeah
- License: mit
- Created: 2023-07-13T15:39:06.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-09-15T18:09:49.000Z (about 1 year ago)
- Last Synced: 2024-10-20T07:51:56.425Z (20 days ago)
- Topics: dapp-developers, solana, walletconnect
- Language: Elm
- Homepage: https://www.npmjs.com/package/solana-connect
- Size: 400 KB
- Stars: 12
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - ronanyeah/solana-connect - Standalone wallet UI for Solana dApps (Elm)
README
# Solana Connect
Standalone wallet UI for Solana dApps[DEMO](https://solana-connect-demo.netlify.app/) | [DOCUMENTATION](https://solana-connect-docs.netlify.app/) | [npm](https://www.npmjs.com/package/solana-connect)
![wallet menu](assets/menu.png)
---
### __Usage:__
```
npm install solana-connect
``````typescript
import { SolanaConnect } from "solana-connect";
import { Adapter } from "@solana/wallet-adapter-base";const solConnect = new SolanaConnect();
solConnect.openMenu();
solConnect.onWalletChange((adapter: Adapter | null) =>
adapter
? console.log("connected:", adapter.name, adapter.publicKey.toString())
: console.log("disconnected")
);solConnect.onVisibilityChange((isOpen: boolean) => {
console.log("menu visible:", isOpen);
});const wallet: Adapter | null = solConnect.getWallet();
```
or use with [unpkg](https://www.unpkg.com/):
```html
const solConnect = new window.SolanaConnect();
solConnect.openMenu();
```
### __Adding more adapters:__
By default, only wallets that support the [Wallet Standard](https://github.com/wallet-standard/wallet-standard) will appear, but additional options can be provided.
```typescript
import {
SolanaMobileWalletAdapter,
createDefaultAuthorizationResultCache,
createDefaultAddressSelector,
createDefaultWalletNotFoundHandler,
} from "@solana-mobile/wallet-adapter-mobile";
import { SolflareWalletAdapter } from "@solana/wallet-adapter-solflare";
import { UnsafeBurnerWalletAdapter } from "@solana/wallet-adapter-unsafe-burner";const solConnect = new SolanaConnect({
additionalAdapters: [
new SolflareWalletAdapter(),
new UnsafeBurnerWalletAdapter(),
new SolanaMobileWalletAdapter({
addressSelector: createDefaultAddressSelector(),
appIdentity: {
name: "Supercorp",
uri: "https://supercorp.app/",
icon: "icon.png",
},
authorizationResultCache: createDefaultAuthorizationResultCache(),
cluster: "mainnet-beta",
onWalletNotFound: createDefaultWalletNotFoundHandler(),
}),
],
});
```