diff --git a/.circleci/config.yml b/.circleci/config.yml index f6d2ae80a7..d265af2cb4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,6 +11,9 @@ jobs: - checkout - restore_cache: key: dependency-cache-{{ checksum "yarn.lock" }} + - run: + name: install-apt + command: sudo apt-get install libusb-1.0.0 - run: name: install-deps command: yarn install --frozen-lockfile diff --git a/package.json b/package.json index 3b9ed139c1..7f9fb58967 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,10 @@ "packages/*" ], "resolutions": { - "@polkadot/api": "^0.93.0-beta.3", - "@polkadot/api-contract": "^0.93.0-beta.3", + "@polkadot/api": "^0.93.0-beta.7", + "@polkadot/api-contract": "^0.93.0-beta.7", "@polkadot/keyring": "^1.4.1", - "@polkadot/types": "^0.93.0-beta.3", + "@polkadot/types": "^0.93.0-beta.7", "@polkadot/util": "^1.4.1", "@polkadot/util-crypto": "^1.4.1", "@types/styled-components": "4.1.8", diff --git a/packages/app-accounts/package.json b/packages/app-accounts/package.json index ed158f5528..4bfe493bbc 100644 --- a/packages/app-accounts/package.json +++ b/packages/app-accounts/package.json @@ -12,7 +12,7 @@ "dependencies": { "@babel/runtime": "^7.6.0", "@polkadot/react-components": "^0.36.0-beta.12", - "@polkadot/react-qr": "^0.45.0-beta.8", + "@polkadot/react-qr": "^0.45.0-beta.12", "@types/file-saver": "^2.0.0", "@types/yargs": "^13.0.2", "babel-plugin-module-resolver": "^3.1.1", diff --git a/packages/app-accounts/src/Account.tsx b/packages/app-accounts/src/Account.tsx index 9a4106d76e..c6f9407e8c 100644 --- a/packages/app-accounts/src/Account.tsx +++ b/packages/app-accounts/src/Account.tsx @@ -33,7 +33,7 @@ function Account ({ address, className, t }: Props): React.ReactElement { const account = keyring.getAccount(address); setGenesisHash((account && account.meta.genesisHash) || null); - setIsEditable((account && !(account.meta.isInjected)) || false); + setIsEditable((account && !(account.meta.isInjected || account.meta.isHardware)) || false); setIsExternal((account && account.meta.isExternal) || false); }, [address]); diff --git a/packages/app-accounts/src/Overview.tsx b/packages/app-accounts/src/Overview.tsx index 1020cea8f7..618093d024 100644 --- a/packages/app-accounts/src/Overview.tsx +++ b/packages/app-accounts/src/Overview.tsx @@ -7,8 +7,9 @@ import { SubjectInfo } from '@polkadot/ui-keyring/observable/types'; import { ComponentProps } from './types'; import React, { useState } from 'react'; +import keyring from '@polkadot/ui-keyring'; import accountObservable from '@polkadot/ui-keyring/observable/accounts'; -import { withMulti, withObservable } from '@polkadot/react-api'; +import { getLedger, isLedger, withMulti, withObservable } from '@polkadot/react-api'; import { Button, CardGrid } from '@polkadot/react-components'; import CreateModal from './modals/Create'; @@ -22,6 +23,19 @@ interface Props extends ComponentProps, I18nProps { accounts?: SubjectInfo[]; } +// query the ledger for the address, adding it to the keyring +async function queryLedger (): Promise { + const ledger = getLedger(); + + try { + const { address } = await ledger.getAddress(); + + keyring.addHardware(address, 'ledger', { name: 'ledger' }); + } catch (error) { + console.error(error); + } +} + function Overview ({ accounts = [], onStatusChange, t }: Props): React.ReactElement { const [isCreateOpen, setIsCreateOpen] = useState(false); const [isImportOpen, setIsImportOpen] = useState(false); @@ -54,6 +68,16 @@ function Overview ({ accounts = [], onStatusChange, t }: Props): React.ReactElem label={t('Add via Qr')} onClick={_toggleQr} /> + {isLedger() && ( + <> + +