Skip to content

Commit

Permalink
[wallet-adapters] Remove old react UI packages (MystenLabs#6592)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan-Mysten authored Dec 5, 2022
1 parent 947b910 commit ff1ad91
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 990 deletions.
529 changes: 51 additions & 478 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

98 changes: 2 additions & 96 deletions sdk/wallet-adapter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,100 +6,6 @@ Sui Wallet Adapter is a set of libraries that makes it easy to connect your dApp

## Getting started

To get started in a React application, you can install the following packages:
We recommend using [Sui Wallet Kit](./packages/wallet-kit/README.md) for connecting to wallets from React applications.

```bash
npm install @mysten/wallet-adapter-all-wallets @mysten/wallet-adapter-react @mysten/wallet-adapter-react-ui
```

At the root of your application, you can then set up the wallet providers:

```tsx
import { WalletProvider } from "@mysten/wallet-adapter-react";
import { WalletStandardAdapterProvider } from "@mysten/wallet-adapter-all-wallets";

export function App() {
const adapters = useMemo(() => [
// Add support for all wallets that adhere to the Wallet Standard:
new WalletStandardAdapterProvider(),
], []);

return (
<WalletProvider adapters={adapters}>
{/* Your application... */}
</WalletProvider>
);
}
```

To add a **Connect Wallet** button to your page, use the `@mysten/wallet-adapter-react-ui` package:

```tsx
import { WalletWrapper } from "@mysten/wallet-adapter-react-ui";

function ConnectToWallet() {
return <WalletWrapper />;
}
```

To get access to the currently connected wallet, use the `useWallet()` hook from `@mysten/wallet-adapter-react` to interact with the wallet, such as proposing transactions:

```tsx
import { useWallet } from "sui-wallet-adapter-react";

export function SendTransaction() {
const { connected, getAccounts, signAndExecuteTransaction } = useWallet();

const handleClick = async () => {
await signAndExecuteTransaction({
kind: "moveCall",
data: {
packageObjectId: "0x2",
module: "devnet_nft",
function: "mint",
typeArguments: [],
arguments: [
"name",
"capy",
"https://cdn.britannica.com/94/194294-138-B2CF7780/overview-capybara.jpg?w=800&h=450&c=crop",
],
gasBudget: 10000,
},
});
};

return (
<Button onClick={handleClick} disabled={!connected}>
Send Transaction
</Button>
);
}
```

### Usage without React

We do not currently have non-React UI libraries for connecting to wallets. The wallet adapters and logic in the React library can be used as reference for implementing a wallet connection UI in other UI libraries.

## Supported wallets

All available wallet adapters are currently exported via the `@mysten/wallet-adapter-all-wallets` package.
You can also install individual wallet adapters that you plan on using in your project.

### Wallet Standard

The `WalletStandardAdapterProvider` adapter (published under `@mysten/wallet-adapter-wallet-standard`) automatically supports wallets that adhere to the cross-chain [Wallet Standard](https://github.com/wallet-standard/wallet-standard/). This adapter detects the available wallets in users' browsers. You do not need to configure additional adapters.

The following wallets are known to work with the Wallet Standard:

- **[Sui Wallet](https://docs.sui.io/devnet/explore/wallet-browser)**
- **[Ethos Wallet](https://chrome.google.com/webstore/detail/ethos-wallet/mcbigmjiafegjnnogedioegffbooigli)**
- **[Suiet Wallet](https://suiet.app/)**

## Demo app

This repo has a simple demo app to test the behavior of the wallet adapters. You can run it using the following commands:

```bash
pnpm install
pnpm dev
```
If you're not using React, you can use the underlying [wallet adapter packages](./packages/adapters/) to determine which wallets are currently available in the dApp, and interact with the wallets.
1 change: 0 additions & 1 deletion sdk/wallet-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"@mysten/wallet-adapter-all-wallets": "workspace:*",
"@mysten/wallet-adapter-base": "workspace:*",
"@mysten/wallet-adapter-react": "workspace:*",
"@mysten/wallet-adapter-react-ui": "workspace:*",
"@mysten/wallet-adapter-wallet-standard": "workspace:*",
"@mysten/wallet-kit": "workspace:*",
"@testing-library/jest-dom": "^5.16.4",
Expand Down
24 changes: 0 additions & 24 deletions sdk/wallet-adapter/packages/ui/.gitignore

This file was deleted.

80 changes: 0 additions & 80 deletions sdk/wallet-adapter/packages/ui/CHANGELOG.md

This file was deleted.

1 change: 0 additions & 1 deletion sdk/wallet-adapter/packages/ui/README.md

This file was deleted.

46 changes: 0 additions & 46 deletions sdk/wallet-adapter/packages/ui/package.json

This file was deleted.

111 changes: 0 additions & 111 deletions sdk/wallet-adapter/packages/ui/src/ConnectWalletModal.tsx

This file was deleted.

Loading

0 comments on commit ff1ad91

Please sign in to comment.