Skip to content

Commit d88fed0

Browse files
authored
README (#22)
1 parent d649784 commit d88fed0

1 file changed

Lines changed: 20 additions & 125 deletions

File tree

packages/client/README.md

Lines changed: 20 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,31 @@
1-
# Coinbase Wallet SDK
1+
# Mobile Wallet Protocol - React Native Client
22

3-
## Coinbase Wallet SDK lets developers connect their dapps to Coinbase Wallet in the following ways:
3+
[![npm](https://img.shields.io/npm/v/@mobile-wallet-protocol/client.svg)](https://www.npmjs.com/package/@mobile-wallet-protocol/client)
44

5-
1. [Coinbase Smart Wallet](https://keys.coinbase.com/onboarding)
6-
- [Docs](https://www.smartwallet.dev/)
7-
1. Coinbase Wallet mobile for [Android](https://play.google.com/store/apps/details?id=org.toshi&referrer=utm_source%3DWallet_LP) and [iOS](https://apps.apple.com/app/apple-store/id1278383455?pt=118788940&ct=Wallet_LP&mt=8)
8-
- Desktop: Users can connect to your dapp by scanning a QR code
9-
- Mobile: Users can connect to your mobile dapp through a deeplink to the dapp browser
10-
1. Coinbase Wallet extension for [Chrome](https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad?hl=en) and [Brave](https://chromewebstore.google.com/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad?hl=en)
11-
- Desktop: Users can connect by clicking the connect with extension option.
12-
13-
### Installing Wallet SDK
14-
15-
1. Check available versions:
16-
17-
```shell
18-
# yarn
19-
yarn info @coinbase/wallet-sdk versions
20-
21-
# npm
22-
npm view @coinbase/wallet-sdk versions
23-
```
24-
25-
2. Install latest version:
26-
27-
```shell
28-
# yarn
29-
yarn add @coinbase/wallet-sdk
30-
31-
# npm
32-
npm install @coinbase/wallet-sdk
33-
```
34-
35-
3. Check installed version:
36-
37-
```shell
38-
# yarn
39-
yarn list @coinbase/wallet-sdk
40-
41-
# npm
42-
npm list @coinbase/wallet-sdk
43-
```
44-
45-
### Upgrading Wallet SDK
46-
47-
Upgrade Coinbase Wallet SDK using yarn or npm.
48-
49-
#### yarn/npm
50-
51-
1. Compare installed version with latest:
52-
53-
```shell
54-
# yarn
55-
yarn outdated @coinbase/wallet-sdk
5+
## Mobile Wallet Protocol Connects Your React Native App to Wallets
566

57-
# npm
58-
npm outdated @coinbase/wallet-sdk
59-
```
60-
61-
2. Update to latest:
62-
63-
```shell
64-
# yarn
65-
yarn upgrade @coinbase/wallet-sdk --latest
66-
67-
# npm
68-
npm update @coinbase/wallet-sdk
69-
```
70-
71-
### Basic Usage
72-
73-
1. Initialize SDK
74-
75-
```js
76-
const sdk = new CoinbaseWalletSDK({
77-
appName: 'SDK Playground',
78-
});
79-
```
80-
81-
2. Make web3 Provider
82-
83-
```js
84-
const provider = sdk.makeWeb3Provider();
85-
```
86-
87-
3. Request accounts to initialize connection to wallet
88-
89-
```js
90-
const addresses = provider.request({
91-
method: 'eth_requestAccounts',
92-
});
93-
```
94-
95-
4. Make more requests
96-
97-
```js
98-
provider.request('personal_sign', [
99-
`0x${Buffer.from('test message', 'utf8').toString('hex')}`,
100-
addresses[0],
101-
]);
102-
```
103-
104-
5. Handle provider events
105-
106-
```js
107-
provider.on('connect', (info) => {
108-
setConnect(info);
109-
});
7+
### Supported Wallets
8+
1. [Coinbase Smart Wallet](https://keys.coinbase.com/onboarding)
9+
- [Documentation](https://www.smartwallet.dev/)
11010

111-
provider.on('disconnect', (error) => {
112-
setDisconnect({ code: error.code, message: error.message });
113-
});
11+
### Wallets on the Roadmap
12+
1. Coinbase Wallet Mobile for [Android](https://play.google.com/store/apps/details?id=org.toshi&referrer=utm_source%3DWallet_LP) and [iOS](https://apps.apple.com/app/apple-store/id1278383455?pt=118788940&ct=Wallet_LP&mt=8)
13+
1. Other wallets adopting the Mobile Wallet Protocol
11414

115-
provider.on('accountsChanged', (accounts) => {
116-
setAccountsChanged(accounts);
117-
});
15+
### Integrate @MWP/client with Your App
11816

119-
provider.on('chainChanged', (chainId) => {
120-
setChainChanged(chainId);
121-
});
17+
Please refer to the [Smart Wallet Integration Guide](https://www.smartwallet.dev/guides/react-native-integration).
12218

123-
provider.on('message', (message) => {
124-
setMessage(message);
125-
});
126-
```
19+
### Developing Locally and Running the Test App
12720

128-
### Developing locally and running the test dapp
21+
- Test app available [here](https://github.com/MobileWalletProtocol/smart-wallet-expo-example).
22+
- To develop locally, follow these steps:
12923

130-
- The Coinbase Wallet SDK test dapp can be viewed here https://coinbase.github.io/coinbase-wallet-sdk/.
131-
- To run it locally follow these steps:
24+
1. Fork this repository and clone it.
25+
2. Fork the test app repository and clone it.
26+
3. Develop for MWP Client.
27+
4. From the root directory of the MWP Client repository, run `yarn build`.
28+
5. From the root directory of the test app, run `yarn add "@mobile-wallet-protocol/client"@<your-path-to-MWP-client>`.
29+
6. From the root directory of the test app, run `yarn ios` or `yarn android` to see the result.
13230

133-
1. Fork this repo and clone it
134-
1. From the root dir run `yarn install`
135-
1. From the root dir run `yarn dev`
13631

0 commit comments

Comments
 (0)