-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEV-287-wallet-connect-integration (#20)
* allow a web3Provider to be used on the web3connectionoptions * add some tutorials on how to use the custom web3 provider (still needs testing tho) * make sure that web3CustomProvider is not a string * remove "connect" if provider is connected, because we already started and account is already loaded because the provider should be the one taking care of that (userland) * change markdown * add how to walletconnect to how-to readme.md * unused and web3link variables * lint * comment out two lines after the "enable" warning * remove web3 and add taikai/dappkit as dependency
- Loading branch information
Showing
6 changed files
with
66 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Wallet connect | ||
@taikai/dappkit supports Wallet Connect (and any other web3 provider) via the `Web3ConnectionOptions.web3CustomProvider`. | ||
|
||
## Dependencies | ||
```shell | ||
$ npm install --save @taikai/dappkit @walletconnect/web3-provider | ||
``` | ||
|
||
## Usage | ||
```typescript | ||
import WalletConnectProvider from "@walletconnect/web3-provider"; | ||
import {Web3Connection} from "@taikai/dappkit"; | ||
|
||
// Create WalletConnect Provider | ||
const provider = new WalletConnectProvider({ /* WalletConnect provider options go here */ }); | ||
|
||
// Enable session (triggers QR Code modal) | ||
await provider.enable(); | ||
|
||
// Provide the custom provider to Web3Connection | ||
const web3Connection = new Web3Connection({web3CustomProvider: provider}); | ||
|
||
// If `provider` was already connected when provided, then Web3Connection started itself; | ||
// Otherwise you'll need to do that by hand, | ||
|
||
/* you only need to enable and start if you didn't enable before */ | ||
// await provider.enable(); | ||
// web3Connection.start(); | ||
/* you only need to enable and start if you didn't enable before */ | ||
|
||
console.log('Connected address', await web3Connection.getAddress()) // Connected address: 0x1234... | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters