Mirroring https://github.com/anza-xyz/wallet-adapter
|
|
před 4 roky | |
|---|---|---|
| packages | 4e5d3358cd remove rollup, use tsc for build (#3) | před 4 roky |
| .editorconfig | 28dc8100e7 initial commit | před 4 roky |
| .eslintignore | 28dc8100e7 initial commit | před 4 roky |
| .eslintrc.json | 28dc8100e7 initial commit | před 4 roky |
| .gitignore | 7e112fec90 add rollup and configure build | před 4 roky |
| .nojekyll | 26b78a12da .nojekyll file | před 4 roky |
| .prettierignore | 28dc8100e7 initial commit | před 4 roky |
| .prettierrc | 28dc8100e7 initial commit | před 4 roky |
| LICENSE | 28dc8100e7 initial commit | před 4 roky |
| README.md | 9311ee0b3d readme version bump | před 4 roky |
| lerna.json | 28dc8100e7 initial commit | před 4 roky |
| package.json | 4e5d3358cd remove rollup, use tsc for build (#3) | před 4 roky |
| tsconfig.json | 4e5d3358cd remove rollup, use tsc for build (#3) | před 4 roky |
| yarn.lock | 4e5d3358cd remove rollup, use tsc for build (#3) | před 4 roky |
@solana/wallet-adapterTypeScript wallet adapters and components for Solana applications.
Install these peer dependencies (or skip this if you have them already):
yarn add @material-ui/core \
@material-ui/icons \
@solana/web3.js \
react
Install these dependencies:
yarn add \
# Wallets to use
@solana/wallet-adapter-wallets \
# React hooks and context for wallets
@solana/wallet-adapter-react \
# Simple components for connecting a wallet
@solana/wallet-adapter-material-ui
import React, { FC, useMemo } from 'react';
import { WalletProvider } from '@solana/wallet-adapter-react';
import {
getLedgerWallet,
getMathWallet,
getPhantomWallet,
getSolletWallet,
getSolongWallet,
getTorusWallet,
} from '@solana/wallet-adapter-wallets';
import {
WalletConnectButton,
WalletDialogProvider,
WalletDisconnectButton,
WalletMultiButton,
} from '@solana/wallet-adapter-material-ui';
export const Wallet: FC = () => {
const wallets = useMemo(() => [
getPhantomWallet(),
getLedgerWallet(),
getTorusWallet({ clientId: 'Go to https://developer.tor.us and create a client ID' }),
getSolongWallet(),
getMathWallet(),
getSolletWallet(),
], []);
return (
<WalletProvider wallets={wallets} autoConnect>
<WalletDialogProvider>
<WalletMultiButton/>
<WalletDisconnectButton/>
</WalletDialogProvider>
</WalletProvider>
);
};