Skip to content

Support CoolWalletS hardware wallet #8196

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

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion app/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@
"message": "of"
},
"orderOneHere": {
"message": "Order a Trezor or Ledger and keep your funds in cold storage"
"message": "Order a CoolWallet, Trezor or Ledger and keep your funds in cold storage"
},
"origin": {
"message": "Origin"
Expand Down
1 change: 1 addition & 0 deletions app/images/coolwallets-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import seedPhraseVerifier from './lib/seed-phrase-verifier'
import log from 'loglevel'
import TrezorKeyring from 'eth-trezor-keyring'
import LedgerBridgeKeyring from '@metamask/eth-ledger-bridge-keyring'
import CoolWalletKeyring from 'eth-cws-keyring'
import EthQuery from 'eth-query'
import nanoid from 'nanoid'
import contractMap from 'eth-contract-metadata'
Expand Down Expand Up @@ -197,7 +198,12 @@ export default class MetamaskController extends EventEmitter {
this.accountTracker._updateAccounts()
})

const additionalKeyrings = [TrezorKeyring, LedgerBridgeKeyring]
// key mgmt
const additionalKeyrings = [
TrezorKeyring,
LedgerBridgeKeyring,
CoolWalletKeyring,
]
this.keyringController = new KeyringController({
keyringTypes: additionalKeyrings,
initState: initState.KeyringController,
Expand Down Expand Up @@ -740,6 +746,7 @@ export default class MetamaskController extends EventEmitter {
simpleKeyPair: [],
ledger: [],
trezor: [],
coolwallet: [],
}

// transactions
Expand Down Expand Up @@ -828,6 +835,9 @@ export default class MetamaskController extends EventEmitter {
case 'ledger':
keyringName = LedgerBridgeKeyring.type
break
case 'coolwallet':
keyringName = CoolWalletKeyring.type
break
default:
throw new Error('MetamaskController:getKeyringForDevice - Unknown device')
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"end-of-stream": "^1.4.4",
"eth-block-tracker": "^4.4.2",
"eth-contract-metadata": "^1.12.1",
"eth-cws-keyring": "1.2.0",
"eth-ens-namehash": "^2.0.8",
"eth-json-rpc-errors": "^2.0.2",
"eth-json-rpc-filters": "^4.1.1",
Expand Down
23 changes: 22 additions & 1 deletion ui/app/pages/create-account/connect-hardware/connect-screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ class ConnectScreen extends Component {
)
}

renderConnectToCoolWalletButton () {
return (
<button
className={classnames('hw-connect__btn', {
'selected': this.state.selectedDevice === 'coolwallet',
})}
onClick={(_) => this.setState({ selectedDevice: 'coolwallet' })}
>
<img
className="hw-connect__btn__img"
src="images/coolwallets-logo.svg"
alt=""
/>
</button>
)
}

renderConnectToLedgerButton () {
return (
<button
Expand All @@ -65,6 +82,9 @@ class ConnectScreen extends Component {
{this.renderConnectToLedgerButton()}
{this.renderConnectToTrezorButton()}
</div>
<div>
{this.renderConnectToCoolWalletButton()}
</div>
<Button
type="primary"
large
Expand Down Expand Up @@ -111,10 +131,11 @@ class ConnectScreen extends Component {
const links = {
trezor: `<a class='hw-connect__get-hw__link' href='https://shop.trezor.io/?a=metamask' target='_blank'>Trezor</a>`,
ledger: `<a class='hw-connect__get-hw__link' href='https://www.ledger.com/products/ledger-nano-s?r=17c4991a03fa&tracker=MY_TRACKER' target='_blank'>Ledger</a>`,
coolwallet: `<a class='hw-connect__get-hw__link' href='https://www.coolwallet.io/product/coolwallet/' target='_blank'>CoolWallet</a>`,
}

const text = this.context.t('orderOneHere')
const response = text.replace('Trezor', links.trezor).replace('Ledger', links.ledger)
const response = text.replace('Trezor', links.trezor).replace('Ledger', links.ledger).replace('CoolWallet', links.coolwallet)

return (
<div
Expand Down
2 changes: 1 addition & 1 deletion ui/app/pages/create-account/connect-hardware/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ConnectHardwareForm extends Component {
}

async checkIfUnlocked () {
['trezor', 'ledger'].forEach(async (device) => {
['trezor', 'ledger', 'coolwallet'].forEach(async (device) => {
const unlocked = await this.props.checkHardwareStatus(device, this.props.defaultHdPaths[device])
if (unlocked) {
this.setState({ unlocked: true })
Expand Down
28 changes: 13 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10290,6 +10290,15 @@ eth-contract-metadata@^1.11.0, eth-contract-metadata@^1.12.1:
resolved "https://registry.yarnpkg.com/eth-contract-metadata/-/eth-contract-metadata-1.12.1.tgz#41014c8c0123453cee15acbcc14299c4d470c759"
integrity sha512-9u2jUcdxaKIv4RvA9RtjyD4+M2yWt4yCulR5bpdQTiG3HUFnN9lHtNL5NIRDpvQVJKerFhexrgEM2WdGP3a6VA==

[email protected]:
version "1.2.0"
resolved "https://registry.yarnpkg.com/eth-cws-keyring/-/eth-cws-keyring-1.2.0.tgz#01488a51c04d4f7b55faac7448a76901fb354e5e"
integrity sha512-uWy60nQubMxquWZox89nXZL4ihADWw08WUZclvNv4bMu0olRBOTTpjfwhbSOoJmk/Ehb3jY4JR89GBWCRuFx7A==
dependencies:
ethereumjs-util "^5.1.0"
hdkey "^1.1.1"
rlp "^2.0.0"

[email protected], eth-ens-namehash@^2.0.8:
version "2.0.8"
resolved "https://registry.yarnpkg.com/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz#229ac46eca86d52e0c991e7cb2aef83ff0f68bcf"
Expand Down Expand Up @@ -10727,7 +10736,7 @@ ethereumjs-util@^4.0.1, ethereumjs-util@^4.3.0, ethereumjs-util@^4.4.0:
rlp "^2.0.0"
secp256k1 "^3.0.1"

ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumjs-util@^5.1.1, ethereumjs-util@^5.1.2, ethereumjs-util@^5.1.3, ethereumjs-util@^5.1.5, ethereumjs-util@^5.2.0:
ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumjs-util@^5.1.0, ethereumjs-util@^5.1.1, ethereumjs-util@^5.1.2, ethereumjs-util@^5.1.3, ethereumjs-util@^5.1.5, ethereumjs-util@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz#3e0c0d1741471acf1036052d048623dee54ad642"
integrity sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA==
Expand Down Expand Up @@ -13715,7 +13724,7 @@ hdkey@^0.7.0:
coinstring "^2.0.0"
secp256k1 "^3.0.1"

hdkey@^1.1.0:
hdkey@^1.1.0, hdkey@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/hdkey/-/hdkey-1.1.1.tgz#c2b3bfd5883ff9529b72f2f08b28be0972a9f64a"
integrity sha512-DvHZ5OuavsfWs5yfVJZestsnc3wzPvLWNk6c2nRUfo6X+OtxypGt20vDDf7Ba+MJzjL3KS1og2nw2eBbLCOUTA==
Expand Down Expand Up @@ -19646,7 +19655,7 @@ nan@^2.0.5:
resolved "https://registry.yarnpkg.com/nan/-/nan-2.8.0.tgz#ed715f3fe9de02b57a5e6252d90a96675e1f085a"
integrity sha1-7XFfP+neArV6XmJS2QqWZ14fCFo=

nan@^2.0.8, nan@^2.11.0, nan@^2.11.1, nan@^2.12.1, nan@^2.13.2, nan@^2.14.0:
nan@^2.0.8, nan@^2.11.1, nan@^2.12.1, nan@^2.13.2, nan@^2.14.0:
version "2.14.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c"
integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==
Expand Down Expand Up @@ -29131,18 +29140,7 @@ websocket-extensions@>=0.1.1:
resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29"
integrity sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==

[email protected]:
version "1.0.29"
resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.29.tgz#3f83e49d3279657c58b02a22d90749c806101b98"
integrity sha512-WhU8jKXC8sTh6ocLSqpZRlOKMNYGwUvjA5+XcIgIk/G3JCaDfkZUr0zA19sVSxJ0TEvm0i5IBzr54RZC4vzW7g==
dependencies:
debug "^2.2.0"
gulp "^4.0.2"
nan "^2.11.0"
typedarray-to-buffer "^3.1.5"
yaeti "^0.0.6"

"websocket@github:web3-js/WebSocket-Node#polyfill/globalThis":
[email protected], "websocket@github:web3-js/WebSocket-Node#polyfill/globalThis":
version "1.0.29"
resolved "https://codeload.github.com/web3-js/WebSocket-Node/tar.gz/905deb4812572b344f5801f8c9ce8bb02799d82e"
dependencies:
Expand Down