Dapp Pocket
Published in

Dapp Pocket

How to use Ethereum Wallet SDK

Connect your Dapp to many wallets in one-line of code!

Why there are so many Ethereum wallets? If you have this question and you feel exhausted to integrate and test many wallets when building Dapp, Ethereum Wallet SDK can help you! It provides the same web3 interface API that could work with many wallets, and it just needs one-line of code to install.

Ethereum Wallet SDK
ContentsGet Started
▪️ Install
▪️ Request user to choose a wallet
🔧API
▪️ Connect User's Wallet
▪️ Sign Message
▪️ Send Transaction
▪️ Other API
🔨Wallet Specific API
▪️ Wallet SDK
▪️ MetaMask
▪️ Dapper
▪️ Torus
▪️ Portis
▪️ Ledger
▪️ Mobile Wallets
🛠Testnet📱Support Mobile

✨Get Started

Install

Simply put this line of script on your website (Dapp):

Connect User’s Wallet

You can use the familiar web3 interface API:

Result

The modal will prompt after you call window.ethereum.enable()

After users select a wallet, a web3 object that connected to the user’s wallet is set!

Note: window.ethereum.enable() is based on EIP-1102 and designed by MetaMask.

🔧API

Web3 is the common API for Ethereum Blockchain. You can always access web3 throughwindow.web3.

Every web3 instance will connect to an Ethereum Node (also called Provider). You can always get the current provider in window.ethereum.

Get User Ethereum Account

Example 1:

or

Example 2:

Official Docs

Sign Message

Example:

Official Docs

Use MetaMask to Sign

Send Transaction

Example:

Official Docs

Use Torus to Send Transaction

Other API

You can check the Web3 Official Document for more APIs.

🛎Notice: If the version of web3 provides by certain wallet is older (e.g. 0.2.x), it might not supports promise, so you need to use callback for the asynchronous calls.

🔨Wallet Specific API

Check the official documents of MetaMask, Torus, and Portis here.

Ledger

Ledger is a hardware crypto wallet. It connects with your computer with USB. You can get one from their website.

Ledger Nano S

The SDK supports 2 paths of HD wallet, each path will create a different Ethereum account. Users can choose which one they want to use.

Choose Path of Wallet

Ledger Official Docs

Trezor

Trezor is also a hardware crypto wallet. It connects with your computer with USB. You can get one from their website.

Trezor Model T

User will need to install Trezor Bridge before using Trezor to connect PC/MAC.

Trezor Official Document

Mobile Wallets

Crypto Wallet SDK uses the Wallet Connect protocol to connect with mobile wallets

  1. To login, the SDK will show a QR Code and the user needs to use supported mobile wallets e.g. Trust Wallet or Dapp Pocket to scan it.
  2. After a user is connected to your Dapp, you can use the logout API to let the user log out.

Example:

⚒Testnet

You can use Testnet to test your Dapp!

For now, we recommend MetaMask. You can change the network in settings of MetaMask.

It will work fine with our SDK.👌

Set network with MetaMask

📱Support Mobile

The SDK supports RWD and it will only show the wallets available on your phone.

Open in Chrome

Users can use cloud wallets like Torus to login and use your Dapp in any mobile browser like Chrome!

Also, users can use mobile wallets that provide a Web3 browser like Dapp Pocket to open your Dapp and connect to it easily.

Use in Web3 browser

Please check our official website to see a Demo!

Welcome to join our Telegram to chat with us.

Also, it’s Open Source now!

Buidl with ❤️ by Dapp Pocket Team.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store