This repository features a minimal consumer wallet app powered by Turnkey. Behind the scenes, it uses @turnkey/ethers
for signing and WalletConnect (v1) for accessing dapps.
With Turnkey, you can easily build wallet apps leveraging the existing ecosystem; TurnkeySigner
is a drop-in replacement for ethers.Wallet
, but with fine-grained transaction controls via Turnkey policies, all without compromising on security.
with-uniswap.mp4
Make sure you have Node.js installed locally; we recommend using Node v16+.
$ node --version # v16+
$ git clone https://github.com/tkhq/demo-consumer-wallet
$ cd demo-consumer-wallet/
$ corepack enable # Updates npm for the local project
$ npm install
$ npm start # Follow the instructions on screen to build to your device or a simulator
To configure the demo passkey wallet you'll need the following:
- A Turnkey organization ID: you can create one by following our quickstart guide.
- A new Turnkey API key (public/private key pair). You can generate one using our CLI, or through the Turnkey dashboard dashboard
- Turnkey's base URL: you can leave the default of
https://api.turnkey.com
. - A new Turnkey private key ID: head to "Private Keys" in your Turnkey dashboard and create a new one ("Create private key"). The "Curve type" should be "SECP256K1", and the "Asset address type" should be "ETHEREUM".
- An account on Infura and Etherscan
You'll provide this information on first app start in the settings screen:
Upon clicking "Save" the settings are saved in your phone's keychain and you should see your wallet address and ETH balance:
Turnkey API keys and other credentials are encrypted and stored in your phone's Keychain:
Create a TurnkeySigner
, bring your own provider, then bridge it via EIP-1193:
demo-consumer-wallet/src/turnkey/TurnkeyWalletContext.tsx
Lines 73 to 85 in 14f7e55
WalletConnect payloads are signed by Turnkey and broadcasted by your provider, all via the bridge:
demo-consumer-wallet/src/screens/WalletConnectScreen.tsx
Lines 222 to 225 in 14f7e55