Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Enkrypt and MEW Wallet DApp browser as SDKs #1291

Merged
merged 34 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5dc605b
devop: add enkrypt and mew wallet
gamalielhere Sep 30, 2022
e74438c
Merge branch 'v2-web3-onboard-develop' into develop
gamalielhere Sep 30, 2022
fda10d1
chore: update version
gamalielhere Sep 30, 2022
6806bb9
update packages with necessary changes to fit current W3O patterns(ve…
Adamj1232 Oct 19, 2022
34fa3e2
Remove enkrypt from injected provider labels
Adamj1232 Oct 25, 2022
7d9f01c
Remove yarn lock within mew package
Adamj1232 Oct 25, 2022
7cf166c
Mark mew package as deprecated
Adamj1232 Oct 25, 2022
ec9d993
Merge branch 'blocknative:v2-web3-onboard-develop' into develop
gamalielhere Oct 25, 2022
56bdcdb
devop: remove unused packages
gamalielhere Oct 25, 2022
02b5d55
devop: move tsconfig to the right places, fix build
gamalielhere Oct 25, 2022
c514cce
devop: remove tsconfig in the wrong place
gamalielhere Oct 25, 2022
763a0e8
Update docs and deploy for new mew-wallet package
Adamj1232 Oct 26, 2022
bb4e4be
Update enkrypt injected provider
Adamj1232 Oct 26, 2022
1f1ee27
Update injected, MEW Wallet and Enkrypt packages
Adamj1232 Oct 26, 2022
48e6e0d
Update handling of ChainIds
Adamj1232 Oct 26, 2022
5616d98
fix: throw error for unsupported chains
gamalielhere Oct 27, 2022
534dfd6
chore: make mew wallet throw error on unsupported chains
gamalielhere Oct 27, 2022
d2ceccd
devop: add check for ios unsupported chains
gamalielhere Oct 28, 2022
3c1517b
chore: change error
gamalielhere Oct 28, 2022
51eb6fa
chore: change error
gamalielhere Oct 28, 2022
f01fc01
chore: change error
gamalielhere Oct 28, 2022
18c7fee
chore: remove console
gamalielhere Oct 28, 2022
328bc73
chore: remove hex conversion code
gamalielhere Nov 15, 2022
eb0c8a2
Remove package level yarn.lock files
Adamj1232 Nov 16, 2022
19e0e65
Remove unused mew icon from injected package
Adamj1232 Nov 16, 2022
7c05054
Add yarn options to readmes
Adamj1232 Nov 16, 2022
652661e
Clean up log
Adamj1232 Nov 16, 2022
4cab5cc
Bump mew package version to display deprecated warning
Adamj1232 Nov 16, 2022
4555784
chore: update logo
gamalielhere Nov 16, 2022
71e0428
Update packages/enkrypt/README.md
Adamj1232 Nov 16, 2022
f57788e
Prettier formatting
Adamj1232 Nov 16, 2022
47c1d1f
Apply suggestions from code review
Adamj1232 Nov 16, 2022
c4d3380
Refine mew package.json
Adamj1232 Nov 16, 2022
9f269c3
Merge remote-tracking branch 'upstream/v2-web3-onboard-develop' into …
Adamj1232 Nov 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ jobs:
working_directory: ~/web3-onboard-monorepo/packages/mew
steps:
- node-build-steps
build-mew-wallet:
docker:
- image: cimg/node:16.13.1
working_directory: ~/web3-onboard-monorepo/packages/mew-wallet
steps:
- node-build-steps
build-portis:
docker:
- image: cimg/node:16.13.1
Expand Down Expand Up @@ -309,6 +315,12 @@ jobs:
working_directory: ~/web3-onboard-monorepo/packages/tallyho
steps:
- node-build-steps
build-enkrypt:
docker:
- image: cimg/node:16.13.1
working_directory: ~/web3-onboard-monorepo/packages/enkrypt
steps:
- node-build-steps

# Build staging/Alpha releases
build-staging-core:
Expand Down Expand Up @@ -365,6 +377,12 @@ jobs:
working_directory: ~/web3-onboard-monorepo/packages/mew
steps:
- node-staging-build-steps
build-staging-mew-wallet:
docker:
- image: cimg/node:16.13.1
working_directory: ~/web3-onboard-monorepo/packages/mew-wallet
steps:
- node-staging-build-steps
build-staging-portis:
docker:
- image: cimg/node:16.13.1
Expand Down Expand Up @@ -455,6 +473,12 @@ jobs:
working_directory: ~/web3-onboard-monorepo/packages/tallyho
steps:
- node-staging-build-steps
build-staging-enkrypt:
docker:
- image: cimg/node:16.13.1
working_directory: ~/web3-onboard-monorepo/packages/enkrypt
steps:
- node-staging-build-steps

workflows:
version: 2
Expand Down Expand Up @@ -513,6 +537,12 @@ workflows:
<<: *deploy_production_filters
- build-staging-mew:
<<: *deploy_staging_filters
mew-wallet:
jobs:
- build-mew-wallet:
<<: *deploy_production_filters
- build-staging-mew-wallet:
<<: *deploy_staging_filters
portis:
jobs:
- build-portis:
Expand Down Expand Up @@ -603,3 +633,9 @@ workflows:
<<: *deploy_production_filters
- build-staging-tallyho:
<<: *deploy_staging_filters
enkrypt:
jobs:
- build-enkrypt:
<<: *deploy_production_filters
- build-staging-enkrypt:
<<: *deploy_staging_filters
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ For full documentation, check out the README.md for each package:
- [Magic](packages/magic/README.md)
- [Fortmatic](packages/fortmatic/README.md)
- [Portis](packages/portis/README.md)
- [MEW](packages/mew/README.md)
- [MEW-Wallet](packages/mew-wallet/README.md)
- [Web3Auth](packages/web3auth/README.md)
- [Sequence](packages/sequence/README.md)
- [TallyHo](packages/tallyho/README.md)
- [Enkrypt](packages/enkrypt/README.md)

**Hardware Wallets**

Expand Down
4 changes: 3 additions & 1 deletion packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@web3-onboard/fortmatic": "^2.0.14",
"@web3-onboard/gas": "^2.1.3",
"@web3-onboard/gnosis": "^2.1.3",
"@web3-onboard/injected-wallets": "^2.3.0",
"@web3-onboard/injected-wallets": "^2.4.0-alpha.1",
"@web3-onboard/keepkey": "^2.3.2",
"@web3-onboard/keystone": "^2.3.2",
"@web3-onboard/ledger": "^2.3.2",
Expand All @@ -40,6 +40,8 @@
"@web3-onboard/tallyho": "^2.0.1",
"@web3-onboard/walletconnect": "^2.2.0-alpha.1",
"@web3-onboard/web3auth": "^2.1.3",
"@web3-onboard/enkrypt": "^2.0.0-alpha.1",
"@web3-onboard/mew-wallet": "^2.0.0-alpha.1",
"vconsole": "^3.9.5"
},
"license": "MIT",
Expand Down
7 changes: 7 additions & 0 deletions packages/demo/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import dcentModule from '@web3-onboard/dcent'
import sequenceModule from '@web3-onboard/sequence'
import tallyHoModule from '@web3-onboard/tallyho'
import enkryptModule from '@web3-onboard/enkrypt'
import mewWalletModule from '@web3-onboard/mew-wallet'
import {
recoverAddress,
arrayify,
Expand Down Expand Up @@ -107,13 +109,18 @@

const sequence = sequenceModule()

const enrkypt = enkryptModule()
const mewWallet = mewWalletModule()

const onboard = Onboard({
wallets: [
injected,
web3auth,
ledger,
trezor,
walletConnect,
enrkypt,
mewWallet,
keepkey,
keystone,
coinbaseWallet,
Expand Down
31 changes: 31 additions & 0 deletions packages/enkrypt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# @web3-onboard/enkrypt

## Wallet module for connecting Enkrypt wallet through web3-onboard

### Install

**NPM**
`npm i @web3-onboard/core @web3-onboard/enkrypt`

**Yarn**
`yarn add @web3-onboard/core @web3-onboard/enkrypt`

## Usage

```typescript
import Onboard from '@web3-onboard/core'
import enrkypt from '@web3-onboard/enkrypt'

const enrkyptModule = enrkypt()

const onboard = Onboard({
// ... other Onboard options
wallets: [
enrkyptModule
//... other wallets
]
})

const connectedWallets = await onboard.connectWallet()
console.log(connectedWallets)
```
68 changes: 68 additions & 0 deletions packages/enkrypt/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"name": "@web3-onboard/enkrypt",
"version": "2.0.0-alpha.1",
"description": "Enkrypt SDK wallet module for connecting to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised 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.",
"keywords": [
"Ethereum",
"Web3",
"EVM",
"dapp",
"Multichain",
"Wallet",
"Transaction",
"Provider",
"Hardware Wallet",
"Notifications",
"React",
"Svelte",
"Vue",
"Next",
"Nuxt",
"MetaMask",
"Coinbase",
"WalletConnect",
"Ledger",
"Trezor",
"Connect Wallet",
"Ethereum Hooks",
"Blocknative",
"Mempool",
"pending",
"confirmed",
"Injected Wallet",
"Crypto",
"Crypto Wallet",
"Enkrypt"
],
"repository": {
"type": "git",
"url": "https://github.com/blocknative/web3-onboard.git",
"directory": "packages/core"
},
"homepage": "https://www.blocknative.com/onboard",
"bugs": "https://github.com/blocknative/web3-onboard/issues",
"module": "dist/index.js",
"browser": "dist/index.js",
"main": "dist/index.js",
"type": "module",
"typings": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "tsc",
"dev": "tsc -w",
"type-check": "tsc --noEmit"
},
"license": "MIT",
"devDependencies": {
"@ethersproject/providers": "^5.5.0",
"@types/node": "^17.0.21",
"ts-node": "^10.2.1",
"typescript": "^4.5.5",
"window": "^4.2.7"
},
"dependencies": {
"@web3-onboard/common": "^2.2.2"
}
}
12 changes: 12 additions & 0 deletions packages/enkrypt/src/icon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default `
<svg width="81" height="81" viewBox="0 0 81 81" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.0057 17.0062C18.9303 15.0816 21.5405 14.0004 24.2622 14.0004L67.3296 14V21.8741C67.3296 23.8305 66.5523 25.7067 65.169 27.09C63.7857 28.4733 61.9095 29.2504 59.9532 29.2504H39.7045C36.9828 29.2504 34.3726 30.3316 32.448 32.2561C30.5235 34.1807 29.4423 36.7909 29.4423 39.5126V42.1242C29.4423 44.8459 30.5235 47.4561 32.448 49.3806C34.3726 51.3051 36.9828 52.3863 39.7045 52.3863H59.9532C61.9095 52.3863 63.7857 53.1635 65.169 54.5468C66.5523 55.9301 67.3296 57.8063 67.3296 59.7626V67.33H24.2622C21.5405 67.33 18.9303 66.2488 17.0057 64.3243C15.0812 62.3997 14 59.7895 14 57.0678V24.2626C14 21.5409 15.0812 18.9307 17.0057 17.0062ZM40.1479 33.5423H60.9157C64.458 33.5423 67.3295 36.4138 67.3295 39.9561V41.6816C67.3295 45.2238 64.458 48.0954 60.9157 48.0954H40.1479C36.6057 48.0954 33.7341 45.2238 33.7341 41.6816V39.9561C33.7341 36.4138 36.6057 33.5423 40.1479 33.5423Z" fill="url(#paint0_linear_287_2359)"/>
<defs>
<linearGradient id="paint0_linear_287_2359" x1="19.3602" y1="14" x2="56.7696" y2="69.8005" gradientUnits="userSpaceOnUse">
<stop stop-color="#C549FF"/>
<stop offset="1" stop-color="#654BFF"/>
</linearGradient>
</defs>
</svg>

`
45 changes: 45 additions & 0 deletions packages/enkrypt/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import type {
WalletInit,
SimpleEventEmitter,
EIP1193Provider
} from '@web3-onboard/common'
import { createEIP1193Provider } from '@web3-onboard/common'
import { CustomWindow } from './types.js'
declare const window: CustomWindow

function enkrypt(): WalletInit {
if (typeof window === 'undefined') return () => null
return () => {
return {
label: 'Enkrypt',
getIcon: async () => (await import('./icon.js')).default,
getInterface: async () => {
const enkryptExists = window.hasOwnProperty('enkrypt')

if (enkryptExists) {
const enkryptProvider: EIP1193Provider = window.enkrypt.providers
.ethereum as EIP1193Provider
const addListener: SimpleEventEmitter['on'] =
enkryptProvider.on.bind(enkryptProvider)

enkryptProvider.on = (event, func) => {
addListener(event, func)
}

const provider = createEIP1193Provider(enkryptProvider)

provider.removeListener = (event, func) => {}

return {
provider
}
} else {
window.open('https://enkrypt.com', '_blank')
throw new Error('Please Install Enkrypt to use this wallet')
}
}
}
}
}

export default enkrypt
6 changes: 6 additions & 0 deletions packages/enkrypt/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { ExternalProvider } from '@ethersproject/providers'
export interface CustomWindow extends Window {
enkrypt: {
providers: { ethereum: ExternalProvider }
}
}
15 changes: 15 additions & 0 deletions packages/enkrypt/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "../../tsconfig.json",
"include": ["src/**/*"],

"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
"declaration": true,
"declarationDir": "dist",
"paths": {
"*": ["./src/*", "./node_modules/*"]
},
"typeRoots": ["node_modules/@types"]
}
}
2 changes: 1 addition & 1 deletion packages/injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/injected-wallets",
"version": "2.3.0",
"version": "2.4.0-alpha.1",
"description": "Injected wallet module for connecting browser extension and mobile wallets to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised 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.",
"keywords": [
"Ethereum",
Expand Down
3 changes: 2 additions & 1 deletion packages/injected/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ export const WALLET_NAMES: { [key: string]: string } = {
frame: 'Frame',
bitkeep: 'BitKeep',
sequence: 'Sequence',
core: 'Core'
core: 'Core',
enkrypt: 'Enkrypt'
}
17 changes: 17 additions & 0 deletions packages/injected/src/icons/enkrypt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default `
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 43 43" style="enable-background:new 0 0 43 43;" xml:space="preserve">
<style type="text/css">
.st0{fill:#7E44F2;}
</style>
<path class="st0" d="M11.1,2.3c-0.9,0.2-2.2,0.6-3,1c-1.9,1-3.6,2.9-4.4,4.9C3.1,9.7,3.1,9,3.1,21.1c0,11.8,0,11.9,0.4,13.3
c0.8,2.3,2.6,4.4,4.7,5.4c1.2,0.6,2.3,0.9,3.5,1c1.3,0.1,24.3,0.1,25.1,0c1.2-0.2,2.1-0.8,2.6-1.9l0.3-0.6v-2.1c0-1.8,0-2.2-0.2-2.6
c-0.6-1.9-1.9-3.1-3.7-3.6c-0.4-0.1-1.5-0.1-7.9-0.2l-7.5,0l-0.8-0.2c-3.1-1-5.4-3.4-6-6.4c-0.2-1-0.1-2.8,0.1-3.7
c0.2-0.8,0.8-1.9,1.2-2.5c0.9-1.2,2.5-2.5,3.8-3c1.4-0.5,1.4-0.5,8.8-0.5c3.7,0,7,0,7.4-0.1c2.1-0.3,3.7-1.6,4.4-3.6
c0.2-0.5,0.2-0.8,0.2-2.4c0-1.2,0-2-0.1-2.3c-0.3-1.4-1.3-2.4-2.7-2.7c-0.3-0.1-4-0.1-12.9-0.1C14.1,2.1,11.7,2.2,11.1,2.3z"/>
<path class="st0" d="M20.8,16c-1.7,0.4-3.2,1.8-3.7,3.5c-0.4,1.1-0.4,2.8,0,3.9c0.5,1.5,1.8,2.8,3.4,3.3l0.6,0.2h7c7,0,7,0,7.7-0.2
c1.8-0.6,3.3-2.1,3.7-3.9c0.2-1,0.2-2.5-0.1-3.4c-0.6-1.7-2.1-3-3.8-3.5C34.7,15.8,21.5,15.8,20.8,16z"/>
</svg>
`
14 changes: 11 additions & 3 deletions packages/injected/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export enum ProviderIdentityFlag {
Sequence = 'isSequence',
Core = 'isAvalanche',
Opera = 'isOpera',
Bitski = 'isBitski'
Bitski = 'isBitski',
Enkrypt = 'isEnkrypt'
}

export enum ProviderLabel {
Expand Down Expand Up @@ -87,7 +88,8 @@ export enum ProviderLabel {
GameStop = 'GameStop Wallet',
BitKeep = 'BitKeep',
Sequence = 'Sequence',
Core = 'Core'
Core = 'Core',
Enkrypt = 'Enkrypt'
}

export interface MeetOneProvider extends ExternalProvider {
Expand All @@ -110,7 +112,8 @@ export enum InjectedNameSpace {
GameStop = 'gamestop',
BitKeep = 'bitkeep',
Avalanche = 'avalanche',
Bitski = 'Bitski'
Bitski = 'Bitski',
Enkrypt = 'enkrypt'
}

export interface CustomWindow extends Window {
Expand All @@ -130,6 +133,11 @@ export interface CustomWindow extends Window {
Bitski: {
getProvider(): InjectedProvider
}
enkrypt: {
providers: {
ethereum: InjectedProvider
}
}
}

export type InjectedProvider = ExternalProvider &
Expand Down
Loading