/glass-wallet-adapter

Primary LanguageTypeScriptMIT LicenseMIT

Glass Wallet Adapter

Integrate your DApp with Glass Wallet.

With this adapter, your DApp can easily connect with the Glass Wallet. Demo: demo
Integrate with Glass Adapter: github
Integrate with WalletStandardAdapterProvider: github

🚀 Get Started

Installation

npm install @glass-wallet/glass-wallet-adapter
# or
yarn add install @glass-wallet/glass-wallet-adapter

Setup

With WalletStandardAdapterProvider

// App.js
import "./App.css";
import { useMemo } from "react";
import { WalletProvider } from "@mysten/wallet-adapter-react";
import { WalletStandardAdapterProvider } from "@mysten/wallet-adapter-all-wallets";
import MainScreen from "./MainScreen";

function App() {
  const adapters = useMemo(() => [new WalletStandardAdapterProvider()], []);

  return (
    <div className="App">
      <header className="App-header">
        <WalletProvider adapters={adapters}>
          <MainScreen />
        </WalletProvider>
      </header>
    </div>
  );
}

export default App;

With GlassWalletAdapter

// App.js
import "./App.css";
import { useMemo } from "react";
import {
  Wallet,
  WalletAdapter,
  WalletProvider,
} from "@mysten/wallet-adapter-react";
import MainScreen from "./MainScreen";
import { GlassWalletAdapter } from "@glass-wallet/glass-wallet-adapter";

const glassAdapter = new GlassWalletAdapter();

function App() {
  const adapters = useMemo(() => {
    return [
      {
        adapter: glassAdapter,
      } as Wallet,
    ];
  }, []);

  return (
    <div className="App">
      <header className="App-header">
        <WalletProvider supportedWallets={adapters}>
          <MainScreen />
        </WalletProvider>
      </header>
    </div>
  );
}

export default App;

@Reference: MystenLabs/sui