Skip to content

Commit 2b81c3e

Browse files
committed
Merge develop and yarn it
2 parents bd08dfa + 48fa68f commit 2b81c3e

File tree

12 files changed

+299
-7
lines changed

12 files changed

+299
-7
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: Keplr Wallet
3+
---
4+
5+
# {$frontmatter.title}
6+
7+
## Wallet module for connecting Keplr Wallet through Web3 Onboard
8+
9+
### Install
10+
11+
<Tabs values={['yarn', 'npm']}>
12+
<TabPanel value="yarn">
13+
14+
```sh copy
15+
yarn add @web3-onboard/keplr
16+
```
17+
18+
</TabPanel>
19+
<TabPanel value="npm">
20+
21+
```sh copy
22+
npm install @web3-onboard/keplr
23+
```
24+
25+
</TabPanel>
26+
</Tabs>
27+
28+
## Usage
29+
30+
```typescript
31+
import Onboard from '@web3-onboard/core'
32+
import KeplrWallet from '@web3-onboard/keplr'
33+
34+
const keplr = KeplrWallet()
35+
36+
const onboard = Onboard({
37+
// ... other Onboard options
38+
wallets: [
39+
keplr
40+
//... other wallets
41+
]
42+
})
43+
44+
const connectedWallets = await onboard.connectWallet()
45+
console.log(connectedWallets)
46+
```
47+
48+
## Build Environments
49+
50+
For build env configurations and setups please see the Build Env section [here](/docs/modules/core#build-environments)

packages/demo/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@
4444
"@web3-onboard/gas": "^2.2.1",
4545
"@web3-onboard/gnosis": "^2.3.1",
4646
"@web3-onboard/infinity-wallet": "^2.1.1",
47-
"@web3-onboard/injected-wallets": "^2.11.1",
47+
"@web3-onboard/injected-wallets": "^2.11.2-alpha.2",
4848
"@web3-onboard/keepkey": "^2.3.8",
49+
"@web3-onboard/keplr": "2.0.0-alpha.1",
4950
"@web3-onboard/keystone": "^2.3.8",
5051
"@web3-onboard/ledger": "^2.7.1",
5152
"@web3-onboard/magic": "^2.2.1",

packages/demo/src/App.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import bitgetModule from '@web3-onboard/bitget'
3939
import bloomModule from '@web3-onboard/bloom'
4040
import particleAuthModule from '@web3-onboard/particle-network'
41+
import keplrModule from '@web3-onboard/keplr'
4142
import capsuleModule, {
4243
Environment,
4344
OAuthMethod
@@ -257,6 +258,7 @@
257258
clientKey: 'cSTLqhvONB5j588Wz6E5WJLMPrHeUlGbymf1DFhO',
258259
appId: 'b1f0239a-edb0-41f9-b0f5-ab780bb02a9e'
259260
})
261+
const keplr = keplrModule()
260262
261263
const dcent = dcentModule()
262264
const bitget = bitgetModule()
@@ -322,7 +324,8 @@
322324
blocto,
323325
venly,
324326
particle,
325-
passport
327+
passport,
328+
keplr
326329
],
327330
transactionPreview,
328331
gas,

packages/injected/src/icons/keplr.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
export default `
2+
<svg width="42" height="42" viewBox="0 0 42 42" fill="none"
3+
xmlns="http://www.w3.org/2000/svg">
4+
<g clip-path="url(#clip0_425_5107)">
5+
<path d="M32.4545 0H9.54545C4.27365 0 0 4.27365 0 9.54545V32.4545C0 37.7264 4.27365 42 9.54545 42H32.4545C37.7264 42 42 37.7264 42 32.4545V9.54545C42 4.27365 37.7264 0 32.4545 0Z" fill="url(#paint0_linear_425_5107)"/>
6+
<path d="M32.4545 0H9.54545C4.27365 0 0 4.27365 0 9.54545V32.4545C0 37.7264 4.27365 42 9.54545 42H32.4545C37.7264 42 42 37.7264 42 32.4545V9.54545C42 4.27365 37.7264 0 32.4545 0Z" fill="url(#paint1_radial_425_5107)"/>
7+
<path d="M32.4545 0H9.54545C4.27365 0 0 4.27365 0 9.54545V32.4545C0 37.7264 4.27365 42 9.54545 42H32.4545C37.7264 42 42 37.7264 42 32.4545V9.54545C42 4.27365 37.7264 0 32.4545 0Z" fill="url(#paint2_radial_425_5107)"/>
8+
<path d="M32.4545 0H9.54545C4.27365 0 0 4.27365 0 9.54545V32.4545C0 37.7264 4.27365 42 9.54545 42H32.4545C37.7264 42 42 37.7264 42 32.4545V9.54545C42 4.27365 37.7264 0 32.4545 0Z" fill="url(#paint3_radial_425_5107)"/>
9+
<path d="M17.2526 32.2614V22.5192L26.7185 32.2614H31.9849V32.0079L21.0964 20.9122L31.1469 10.3857V10.2614H25.8464L17.2526 19.5635V10.2614H12.9849V32.2614H17.2526Z" fill="white"/>
10+
</g>
11+
<defs>
12+
<linearGradient id="paint0_linear_425_5107" x1="21" y1="0" x2="21" y2="42" gradientUnits="userSpaceOnUse">
13+
<stop stop-color="#1FD1FF"/>
14+
<stop offset="1" stop-color="#1BB8FF"/>
15+
</linearGradient>
16+
<radialGradient id="paint1_radial_425_5107" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(2.00623 40.4086) rotate(-45.1556) scale(67.3547 68.3624)">
17+
<stop stop-color="#232DE3"/>
18+
<stop offset="1" stop-color="#232DE3" stop-opacity="0"/>
19+
</radialGradient>
20+
<radialGradient id="paint2_radial_425_5107" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(39.7379 41.7602) rotate(-138.45) scale(42.1137 64.2116)">
21+
<stop stop-color="#8B4DFF"/>
22+
<stop offset="1" stop-color="#8B4DFF" stop-opacity="0"/>
23+
</radialGradient>
24+
<radialGradient id="paint3_radial_425_5107" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(20.6501 0.311498) rotate(90) scale(33.1135 80.3423)">
25+
<stop stop-color="#24D5FF"/>
26+
<stop offset="1" stop-color="#1BB8FF" stop-opacity="0"/>
27+
</radialGradient>
28+
<clipPath id="clip0_425_5107">
29+
<rect width="42" height="42" fill="white"/>
30+
</clipPath>
31+
</defs>
32+
</svg>
33+
`

packages/injected/src/types.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ export enum ProviderIdentityFlag {
7171
Lif3Wallet = 'isLif3Wallet',
7272
ZodiacPilot = 'isZodiacPilot',
7373
StableWallet = 'isStableWallet',
74-
Echooo = 'isEchooo'
74+
Echooo = 'isEchooo',
75+
Keplr = 'keplr'
7576
}
7677

7778
/**
@@ -101,7 +102,8 @@ export enum ProviderExternalUrl {
101102
Lif3Wallet = 'https://lif3.com',
102103
Rabby = 'https://rabby.io',
103104
ZodiacPilot = 'https://pilot.gnosisguild.org/',
104-
Echooo = 'https://www.echooo.xyz'
105+
Echooo = 'https://www.echooo.xyz',
106+
Keplr = 'https://www.keplr.app/download'
105107
}
106108

107109
export enum ProviderLabel {
@@ -164,7 +166,8 @@ export enum ProviderLabel {
164166
Lif3Wallet = 'Lif3 Wallet',
165167
ZodiacPilot = 'Zodiac Pilot',
166168
StableWallet = 'StableWallet',
167-
Echooo = 'Echooo'
169+
Echooo = 'Echooo',
170+
Keplr = 'Keplr'
168171
}
169172

170173
export interface MeetOneProvider extends ExternalProvider {
@@ -291,7 +294,7 @@ export interface InjectedWalletOptions {
291294
walletUnavailableMessage?: (wallet: WalletModule) => string
292295
/**Function that can be used to sort the order of wallets that are displayed */
293296
sort?: (wallets: WalletModule[]) => WalletModule[]
294-
/** A boolean that can be passed to disable supporting 6963 (https://eips.ethereum.org/EIPS/eip-6963)
297+
/** A boolean that can be passed to disable supporting 6963 (https://eips.ethereum.org/EIPS/eip-6963)
295298
* which will display wallets available on the browser
296299
*/
297300
disable6963Support?: boolean

packages/injected/src/wallets.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,17 @@ const echooo: InjectedWalletModule = {
920920
externalUrl: ProviderExternalUrl.Echooo
921921
}
922922

923+
const keplr: InjectedWalletModule = {
924+
label: ProviderLabel.Keplr,
925+
injectedNamespace: InjectedNameSpace.Ethereum,
926+
checkProviderIdentity: ({ provider }) =>
927+
!!provider && !!provider[ProviderIdentityFlag.Keplr],
928+
getIcon: async () => (await import('./icons/keplr.js')).default,
929+
getInterface: getInjectedInterface(ProviderIdentityFlag.Keplr),
930+
platforms: ['all'],
931+
externalUrl: ProviderExternalUrl.Keplr
932+
}
933+
923934
const wallets = [
924935
zeal,
925936
exodus,
@@ -978,7 +989,8 @@ const wallets = [
978989
Lif3Wallet,
979990
zodiacPilot,
980991
stablewallet,
981-
echooo
992+
echooo,
993+
keplr
982994
]
983995

984996
export default wallets

packages/keplr/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# @web3-onboard/keplr
2+
3+
## Wallet module for connecting keplr Wallet through web3-onboard
4+
5+
Keplr Wallet SDK wallet module for connecting to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.
6+
7+
### Install
8+
9+
**NPM**
10+
`npm i @web3-onboard/core @web3-onboard/keplr`
11+
12+
**Yarn**
13+
`yarn add @web3-onboard/core @web3-onboard/keplr`
14+
15+
## Usage
16+
17+
```typescript
18+
import Onboard from '@web3-onboard/core'
19+
import keplrModule from '@web3-onboard/keplr'
20+
21+
const keplr = keplrModule()
22+
23+
const onboard = Onboard({
24+
// ... other Onboard options
25+
wallets: [
26+
keplr
27+
//... other wallets
28+
]
29+
})
30+
31+
const connectedWallets = await onboard.connectWallet()
32+
console.log(connectedWallets)
33+
```

packages/keplr/package.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"name": "@web3-onboard/keplr",
3+
"version": "2.0.0-alpha.1",
4+
"description": "Keplr Wallet SDK wallet module for connecting to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
5+
"keywords": [
6+
"Ethereum",
7+
"Web3",
8+
"EVM",
9+
"dapp",
10+
"Multichain",
11+
"Wallet",
12+
"Transaction",
13+
"Provider",
14+
"Hardware Wallet",
15+
"Notifications",
16+
"React",
17+
"Svelte",
18+
"Vue",
19+
"Next",
20+
"Nuxt",
21+
"MetaMask",
22+
"Coinbase",
23+
"WalletConnect",
24+
"Ledger",
25+
"Trezor",
26+
"Connect Wallet",
27+
"Ethereum Hooks",
28+
"Blocknative",
29+
"Mempool",
30+
"pending",
31+
"confirmed",
32+
"Injected Wallet",
33+
"Crypto",
34+
"Crypto Wallet",
35+
"Enkrypt",
36+
"Keplr"
37+
],
38+
"repository": {
39+
"type": "git",
40+
"url": "https://github.com/blocknative/web3-onboard.git",
41+
"directory": "packages/keplr"
42+
},
43+
"homepage": "https://www.blocknative.com/onboard",
44+
"bugs": "https://github.com/blocknative/web3-onboard/issues",
45+
"module": "dist/index.js",
46+
"browser": "dist/index.js",
47+
"main": "dist/index.js",
48+
"type": "module",
49+
"typings": "dist/index.d.ts",
50+
"files": [
51+
"dist"
52+
],
53+
"scripts": {
54+
"build": "tsc",
55+
"dev": "tsc -w",
56+
"type-check": "tsc --noEmit"
57+
},
58+
"license": "MIT",
59+
"devDependencies": {
60+
"@types/node": "^17.0.21",
61+
"typescript": "^5.4.5"
62+
},
63+
"dependencies": {
64+
"@web3-onboard/common": "^2.4.1"
65+
}
66+
}

packages/keplr/src/icon.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
export default `
2+
<svg width="42" height="42" viewBox="0 0 42 42" fill="none"
3+
xmlns="http://www.w3.org/2000/svg">
4+
<g clip-path="url(#clip0_425_5107)">
5+
<path d="M32.4545 0H9.54545C4.27365 0 0 4.27365 0 9.54545V32.4545C0 37.7264 4.27365 42 9.54545 42H32.4545C37.7264 42 42 37.7264 42 32.4545V9.54545C42 4.27365 37.7264 0 32.4545 0Z" fill="url(#paint0_linear_425_5107)"/>
6+
<path d="M32.4545 0H9.54545C4.27365 0 0 4.27365 0 9.54545V32.4545C0 37.7264 4.27365 42 9.54545 42H32.4545C37.7264 42 42 37.7264 42 32.4545V9.54545C42 4.27365 37.7264 0 32.4545 0Z" fill="url(#paint1_radial_425_5107)"/>
7+
<path d="M32.4545 0H9.54545C4.27365 0 0 4.27365 0 9.54545V32.4545C0 37.7264 4.27365 42 9.54545 42H32.4545C37.7264 42 42 37.7264 42 32.4545V9.54545C42 4.27365 37.7264 0 32.4545 0Z" fill="url(#paint2_radial_425_5107)"/>
8+
<path d="M32.4545 0H9.54545C4.27365 0 0 4.27365 0 9.54545V32.4545C0 37.7264 4.27365 42 9.54545 42H32.4545C37.7264 42 42 37.7264 42 32.4545V9.54545C42 4.27365 37.7264 0 32.4545 0Z" fill="url(#paint3_radial_425_5107)"/>
9+
<path d="M17.2526 32.2614V22.5192L26.7185 32.2614H31.9849V32.0079L21.0964 20.9122L31.1469 10.3857V10.2614H25.8464L17.2526 19.5635V10.2614H12.9849V32.2614H17.2526Z" fill="white"/>
10+
</g>
11+
<defs>
12+
<linearGradient id="paint0_linear_425_5107" x1="21" y1="0" x2="21" y2="42" gradientUnits="userSpaceOnUse">
13+
<stop stop-color="#1FD1FF"/>
14+
<stop offset="1" stop-color="#1BB8FF"/>
15+
</linearGradient>
16+
<radialGradient id="paint1_radial_425_5107" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(2.00623 40.4086) rotate(-45.1556) scale(67.3547 68.3624)">
17+
<stop stop-color="#232DE3"/>
18+
<stop offset="1" stop-color="#232DE3" stop-opacity="0"/>
19+
</radialGradient>
20+
<radialGradient id="paint2_radial_425_5107" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(39.7379 41.7602) rotate(-138.45) scale(42.1137 64.2116)">
21+
<stop stop-color="#8B4DFF"/>
22+
<stop offset="1" stop-color="#8B4DFF" stop-opacity="0"/>
23+
</radialGradient>
24+
<radialGradient id="paint3_radial_425_5107" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(20.6501 0.311498) rotate(90) scale(33.1135 80.3423)">
25+
<stop stop-color="#24D5FF"/>
26+
<stop offset="1" stop-color="#1BB8FF" stop-opacity="0"/>
27+
</radialGradient>
28+
<clipPath id="clip0_425_5107">
29+
<rect width="42" height="42" fill="white"/>
30+
</clipPath>
31+
</defs>
32+
</svg>
33+
`

packages/keplr/src/index.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import {
2+
type WalletInit,
3+
type EIP1193Provider,
4+
createDownloadMessage
5+
} from '@web3-onboard/common'
6+
import { createEIP1193Provider } from '@web3-onboard/common'
7+
8+
import { CustomWindow } from './types.js'
9+
10+
declare const window: CustomWindow
11+
12+
function keplr(): WalletInit {
13+
if (typeof window === 'undefined') return () => null
14+
15+
return () => {
16+
return {
17+
label: 'Keplr Wallet',
18+
getIcon: async () => (await import('./icon.js')).default,
19+
getInterface: async () => {
20+
const keplrwalletInjectionExists = window.hasOwnProperty('keplr')
21+
22+
let provider: EIP1193Provider
23+
24+
if (keplrwalletInjectionExists) {
25+
provider = createEIP1193Provider(window['keplr'])
26+
} else {
27+
const downloadUrl = 'https://www.keplr.app/download'
28+
throw new Error(createDownloadMessage('keplr Wallet', downloadUrl))
29+
}
30+
return {
31+
provider
32+
}
33+
}
34+
}
35+
}
36+
}
37+
38+
export default keplr

packages/keplr/src/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import type { EIP1193Provider } from '@web3-onboard/common'
2+
3+
export interface CustomWindow extends Window {
4+
keplr?: EIP1193Provider
5+
}

packages/keplr/tsconfig.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"include": ["src/**/*"],
4+
5+
"compilerOptions": {
6+
"outDir": "dist",
7+
"rootDir": "src",
8+
"declaration": true,
9+
"declarationDir": "dist",
10+
"paths": {
11+
"*": ["./src/*", "./node_modules/*"]
12+
},
13+
"typeRoots": ["node_modules/@types"]
14+
}
15+
}

0 commit comments

Comments
 (0)