Compare commits

..
89 Commits
Author SHA1 Message Date
Github Actions b40167c1e2 [CI Skip] release/stable 0.63.1
skip-checks: true
2020-12-14 12:24:30 +00:00
Jaco Greeff 8dd942d070 0.63 (#419) 2020-12-14 13:21:52 +01:00
Github Actions 0e810ba308 [CI Skip] release/beta 0.62.2-28
skip-checks: true
2020-12-12 09:26:15 +00:00
Jaco Greeff 4288680bce Bump deps (#418) 2020-12-12 10:23:14 +01:00
Github Actions 5d82af6912 [CI Skip] release/beta 0.62.2-27
skip-checks: true
2020-12-11 18:11:45 +00:00
Jaco Greeff 7607dc9e9d Bump deps (#417) 2020-12-11 19:08:39 +01:00
Github Actions 0795451801 [CI Skip] release/beta 0.62.2-26
skip-checks: true
2020-12-11 09:49:48 +00:00
Jaco Greeff e061c22ab1 Bump dev 2020-12-11 10:47:03 +01:00
Github Actions 9562762403 [CI Skip] release/beta 0.62.2-25
skip-checks: true
2020-12-10 18:13:33 +00:00
Jaco Greeff c1e961a938 Build esm (don't yet use) (#416)
* Build esm (don't yet use)

* fix ui-assets
2020-12-10 19:10:58 +01:00
Github Actions c48f44830e [CI Skip] release/beta 0.62.2-24
skip-checks: true
2020-12-09 19:49:23 +00:00
Jaco Greeff 558f5b0286 Bump dev (esm alongside cjs) (#415) 2020-12-09 20:46:23 +01:00
Github Actions b1a9cbdabb [CI Skip] release/beta 0.62.2-23
skip-checks: true
2020-12-09 00:44:17 +00:00
Jaco Greeff 7e494673e0 Convert all to named imports (#414) 2020-12-09 01:41:44 +01:00
Github Actions a5434d4428 [CI Skip] release/beta 0.62.2-22
skip-checks: true
2020-12-08 10:26:42 +00:00
Jaco Greeff 582f1ca294 Remove --fix on CI (#412) 2020-12-08 11:23:44 +01:00
Github Actions fcebfeae60 [CI Skip] release/beta 0.62.2-21
skip-checks: true
2020-12-07 15:44:02 +00:00
Jaco Greeff bb308f87e7 Bup dev (import sorting) (#411) 2020-12-07 16:41:26 +01:00
Github Actions 5445177055 [CI Skip] release/beta 0.62.2-20
skip-checks: true
2020-12-05 09:59:25 +00:00
Jaco Greeff b705f2bed1 Bump deps (minor) (#410) 2020-12-05 10:56:37 +01:00
Github Actions 4a79ef073c [CI Skip] release/beta 0.62.2-19
skip-checks: true
2020-12-02 17:39:26 +00:00
Jaco Greeff ce79a80a18 Optional pair type (account-only) (#409) 2020-12-02 18:36:28 +01:00
Github Actions 9c72628a39 [CI Skip] release/beta 0.62.2-18
skip-checks: true
2020-12-01 21:08:07 +00:00
Jaco Greeff 61416c3f23 Bump berry (#407)
* Bump berry

* rewrite
2020-12-01 22:04:57 +01:00
Github Actions 27d7dfda02 [CI Skip] release/beta 0.62.2-17
skip-checks: true
2020-12-01 12:36:39 +00:00
Jaco Greeff 487c638185 Use import type (#406) 2020-12-01 13:33:48 +01:00
Github Actions 57eece03d8 [CI Skip] release/beta 0.62.2-16
skip-checks: true
2020-11-30 12:21:45 +00:00
Jaco Greeff f62f214e88 Bump deps (#405)
* Bump deps

* Dedupe
2020-11-30 13:18:45 +01:00
Github Actions d33504ff72 [CI Skip] release/beta 0.62.2-15
skip-checks: true
2020-11-25 16:17:10 +00:00
Thibaut Sardan fc68b5ae0e export type for icon theme (#404) 2020-11-25 17:14:26 +01:00
Github Actions 55c52ed5ad [CI Skip] release/beta 0.62.2-14
skip-checks: true
2020-11-24 12:43:19 +00:00
Jaco Greeff 923a08f7fc Bumps (#403)
* Bumps

* Remove unneeded dev dep
2020-11-24 13:40:27 +01:00
Github Actions 284d36dd6d [CI Skip] release/beta 0.62.2-13
skip-checks: true
2020-11-20 08:39:25 +00:00
Jaco Greeff f648e6db08 Ledger libs bump (#402) 2020-11-20 09:36:42 +01:00
Github Actions c771560a7c [CI Skip] release/beta 0.62.2-12
skip-checks: true
2020-11-11 16:48:35 +00:00
Jaco Greeff 9b89ac19ba catch, ignore 2020-11-11 17:45:46 +01:00
Jaco Greeff 1d369c13d8 Allow injection failure 2020-11-11 17:44:22 +01:00
Github Actions ad2c3bb12a [CI Skip] release/beta 0.62.2-11
skip-checks: true
2020-11-11 13:06:36 +00:00
Jaco Greeff b951a67b3f Fix Ledger HID imports 2020-11-11 14:03:30 +01:00
Github Actions 17f37f0c05 [CI Skip] release/beta 0.62.2-10
skip-checks: true
2020-11-11 12:39:30 +00:00
Jaco Greeff c71da72328 Dev bump (#401)
* Swap with USB libs

* Update dev

* Bump deps
2020-11-11 13:36:38 +01:00
Github Actions 3c743bd668 [CI Skip] release/beta 0.62.2-9
skip-checks: true
2020-11-10 21:34:34 +00:00
Jaco Greeff 1e2fdfba58 Swap with USB libs (#400) 2020-11-10 22:31:26 +01:00
Github Actions 03db260ed6 [CI Skip] release/beta 0.62.2-8
skip-checks: true
2020-11-10 18:20:11 +00:00
Jaco Greeff d47cdf8a7b keyringOption 2020-11-10 19:17:08 +01:00
Github Actions 8d41ea5eba [CI Skip] release/beta 0.62.2-7
skip-checks: true
2020-11-10 17:44:36 +00:00
Jaco Greeff 573fd7ba6a keyringOption expose 2020-11-10 18:41:27 +01:00
Github Actions 6425131822 [CI Skip] release/beta 0.62.2-6
skip-checks: true
2020-11-10 17:22:38 +00:00
Jaco Greeff d81e91af7b Bumps 2020-11-10 18:19:24 +01:00
Github Actions f1576f280d [CI Skip] release/beta 0.62.2-5
skip-checks: true
2020-11-10 15:14:55 +00:00
Jaco Greeff 2692c90106 Split Ledger (& transports) into package (#399)
* Split Ledger (& transports) into package

* Fix browser/node resolution

* Bump
2020-11-10 16:11:50 +01:00
Github Actions 0da5471b3e [CI Skip] release/beta 0.62.2-4
skip-checks: true
2020-11-10 13:22:40 +00:00
Jaco Greeff e5a8d695bb Re-enable esnext builds (#398) 2020-11-10 14:19:29 +01:00
Github Actions 24b91a73c7 [CI Skip] release/beta 0.62.2-3
skip-checks: true
2020-11-09 22:32:51 +00:00
Jaco Greeff 1ad3b6ab98 Bumps 2020-11-09 23:30:03 +01:00
Github Actions 7fa869d33c [CI Skip] release/beta 0.62.2-2
skip-checks: true
2020-11-09 21:31:15 +00:00
Jaco Greeff 4b95eeae06 unused esnext 2020-11-09 22:28:10 +01:00
Github Actions c7e79d9816 [CI Skip] release/beta 0.62.2-1
skip-checks: true
2020-11-09 20:00:22 +00:00
Jaco Greeff 4d6d9abbc0 Bump common/api (#397) 2020-11-09 20:57:18 +01:00
Github Actions bc5973bdaf [CI Skip] release/beta 0.62.2-0
skip-checks: true
2020-11-09 16:43:35 +00:00
Jaco Greeff f6c7f638a1 Build esnext modules (#396) 2020-11-09 17:40:47 +01:00
Github Actions 0c9412c55f [CI Skip] release/stable 0.62.1
skip-checks: true
2020-11-09 11:27:20 +00:00
Jaco Greeff a3ece8770c 0.62 (#395)
* 0.62

* Fix to 0.62
2020-11-09 12:24:27 +01:00
Github Actions 77a9377503 [CI Skip] release/beta 0.61.2-7
skip-checks: true
2020-11-06 11:13:46 +00:00
Jaco Greeff e63b08f053 Ethereum address encoding (#394)
* Ethereum address encoding

* Remove encode
2020-11-06 12:10:26 +01:00
Github Actions 6356f9d0b7 [CI Skip] release/beta 0.61.2-6
skip-checks: true
2020-11-06 09:50:33 +00:00
Jaco Greeff 01d753ff99 Bump deps (#392) 2020-11-06 10:47:15 +01:00
Github Actions 8e151b721a [CI Skip] release/beta 0.61.2-5
skip-checks: true
2020-11-03 14:38:37 +00:00
Jaco Greeff ff1a31a336 Add ethereum icon type (#391) 2020-11-03 15:35:10 +01:00
Github Actions 2b0dac8097 [CI Skip] release/beta 0.61.2-4
skip-checks: true
2020-10-26 14:52:05 +00:00
Jaco Greeff 7b640d4503 Remove copy-to-apps script 2020-10-26 15:48:39 +01:00
Github Actions f4659fb67c [CI Skip] release/beta 0.61.2-3
skip-checks: true
2020-10-26 11:29:04 +00:00
Jaco Greeff c0393bcc7c Bump GH actions (#389)
* Bump GH actions

* Rewrite
2020-10-26 12:25:42 +01:00
Github Actions 0f5108ca90 [CI Skip] release/beta 0.61.2-2
skip-checks: true
2020-10-23 15:53:46 +00:00
Jaco Greeff fffbbdcb55 Explicit version for styled-components (#388) 2020-10-23 17:49:03 +02:00
Github Actions 16d29df52a [CI Skip] release/beta 0.61.2-1
skip-checks: true
2020-10-23 11:20:00 +00:00
Jaco Greeff 4ba9e97386 Bump deps (#387) 2020-10-23 13:15:54 +02:00
Github Actions 3a8d9c3fcb [CI Skip] release/beta 0.61.2-0
skip-checks: true
2020-10-23 08:23:14 +00:00
Jaco Greeff 15c73e6e07 Add docs redirect to root (#386) 2020-10-23 10:18:44 +02:00
Github Actions 122e2c40ce [CI Skip] release/stable 0.61.1
skip-checks: true
2020-10-19 06:47:04 +00:00
Jaco Greeff 14ac686780 0.61 (#384) 2020-10-19 08:42:35 +02:00
Github Actions 8e4ecac74b [CI Skip] release/beta 0.60.2-3
skip-checks: true
2020-10-17 09:00:30 +00:00
Thibaut Sardan a1808f590e Use @polkadot/networks (#382)
* adapt ss58

* fix yarn.lock ?

* cater for kusama hashes

* yarn update-interactive

* much nicer chains
2020-10-17 10:56:12 +02:00
Github Actions 72127121ca [CI Skip] release/beta 0.60.2-2
skip-checks: true
2020-10-17 08:16:14 +00:00
Jaco Greeff d77dddfda0 Remove (unused) typedoc (#383)
* Remove (unused) typedoc

* rm typedoc package
2020-10-17 10:11:46 +02:00
Github Actions 42877edd0b [CI Skip] release/beta 0.60.2-1
skip-checks: true
2020-10-16 13:49:47 +00:00
Jaco Greeff c077dfe24e List both deps & peers (optional with default) (#381)
* List both deps & peers (optional with default)

* Apply suggestions from code review
2020-10-16 15:45:22 +02:00
Github Actions 7f4e90a2cf [CI Skip] release/beta 0.60.2-0
skip-checks: true
2020-10-14 12:29:42 +00:00
WoeOm 4d7b19e64b add darwinia ss58 (#379) 2020-10-14 14:25:08 +02:00
139 changed files with 3452 additions and 2868 deletions
-4
View File
@@ -1,4 +0,0 @@
// Copyright 2017-2020 @polkadot/ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = require('./babel.config.js');
-5
View File
@@ -1,5 +0,0 @@
.eslintrc.js
**/build/*
**/coverage/*
**/node_modules/*
**/*.d.ts
+11 -1
View File
@@ -1,10 +1,20 @@
// Copyright 2017-2020 @polkadot/ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
const base = require('@polkadot/dev/config/eslint');
const base = require('@polkadot/dev/config/eslint.cjs');
module.exports = {
...base,
ignorePatterns: [
'.eslintrc.js',
'.github/**',
'.vscode/**',
'.yarn/**',
'**/build/*',
'**/coverage/*',
'**/node_modules/*',
'**/*.d.ts'
],
parserOptions: {
...base.parserOptions,
project: [
+1 -1
View File
@@ -9,7 +9,7 @@ jobs:
name: ${{ matrix.step }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: ${{ matrix.step }}
run: |
yarn install --immutable | grep -v 'YN0013'
+1 -1
View File
@@ -13,7 +13,7 @@ jobs:
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && github.repository == 'polkadot-js/ui'"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_PAT }}
- name: ${{ matrix.step }}
+1 -1
View File
@@ -1 +1 @@
10.13.0
12
-11
View File
@@ -1,11 +0,0 @@
{
"editor.tabSize": 2,
"files.eol": "\n",
"npm.packageManager": "yarn",
"eslint.enable": true,
"eslint.validate": [
"javascript",
"typescript",
"typescriptreact"
]
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-55
View File
File diff suppressed because one or more lines are too long
+55
View File
File diff suppressed because one or more lines are too long
+1 -3
View File
@@ -9,7 +9,5 @@ plugins:
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
yarnPath: .yarn/releases/yarn-2.2.2.cjs
yarnPath: .yarn/releases/yarn-2.4.0.cjs
+43
View File
@@ -1,5 +1,48 @@
# CHANGELOG
## 0.63.1 Dec 14, 2020
Contributed:
- Export types for icons (Thanks to https://github.com/Tbaut)
Changes:
- Bump to latest WebUSB from Ledger
- Swap Ledger functionality to dedicated packages
- Build esm packages alongside cjs
- Convert all imports/exports to named
- Pass pair type through to all creation actions
- Allow for transparent failures on account injection
- Swap to using `import type { ... }`
- Updated to `@polkadot/{keyring, util, util-crypto}` 5.0.1
- Updated to `@polkadot/api` 3.0.1
## 0.62.1 Nov 9, 2020
Changes:
- Update address checks to allow for Ethereum-compatible chains
- Add Ethereum icon type (uses blockies underneath)
- Updated to `@polkadot/{keyring, util, util-crypto}` 4.0.1
- Updated to `@polkadot/api` 2.6.1
## 0.61.1 Oct 19, 2020
Contributed:
- Add Darwinia ss58 (Thanks to https://github.com/WoeOm)
- Swap network identifiers to `@polkadot/networks` (Thanks to https://github.com/Tbaut)
Changes:
- Explicit deps versions (with peerDependencies as provided)
- Bump to `@polkadot/api` 2.3.1
- Bump to `@polkadot/util` 3.6.1
## 0.60.1 Oct 7, 2020
Changes:
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
const base = require('@polkadot/dev/config/babel');
const base = require('@polkadot/dev/config/babel-config-cjs.cjs');
module.exports = Object.keys(base).reduce((config, key) => {
config[key] = base[key];
-22
View File
@@ -1,22 +0,0 @@
#!/bin/bash
# Copyright 2017-2020 @polkadot/ui authors & contributors
# SPDX-License-Identifier: Apache-2.0
function copy_folder () {
SRC="packages/$1/build"
DST="../apps/node_modules/@polkadot/$1"
echo "** Copying $SRC to $DST"
rm -rf $DST
cp -r $SRC $DST
}
yarn polkadot-dev-build-ts
copy_folder "react-identicon"
copy_folder "react-qr"
copy_folder "ui-assets"
copy_folder "ui-keyring"
copy_folder "ui-settings"
copy_folder "ui-shared"
-22
View File
@@ -1,22 +0,0 @@
#!/bin/bash
# Copyright 2017-2020 @polkadot/ui authors & contributors
# SPDX-License-Identifier: Apache-2.0
function copy_folder () {
SRC="packages/$1/build"
DST="../extension/node_modules/@polkadot/$1"
echo "** Copying $SRC to $DST"
rm -rf $DST
cp -r $SRC $DST
}
yarn polkadot-dev-build-ts
copy_folder "react-identicon"
copy_folder "react-qr"
copy_folder "ui-assets"
copy_folder "ui-keyring"
copy_folder "ui-settings"
copy_folder "ui-shared"
View File
+12
View File
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=0.5, maximum-scale=1">
<meta http-equiv="refresh" content="0;URL='https://polkadot.js.org/docs/'" />
<title>Redirecting to https://polkadot.js.org/docs/</title>
</head>
<body>
Redirecting to <a href="https://polkadot.js.org/docs/">https://polkadot.js.org/docs/</a>
</body>
</html>
+12
View File
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=0.5, maximum-scale=1">
<meta http-equiv="refresh" content="0;URL='https://polkadot.js.org/docs/'" />
<title>Redirecting to https://polkadot.js.org/docs/</title>
</head>
<body>
Redirecting to <a href="https://polkadot.js.org/docs/">https://polkadot.js.org/docs/</a>
</body>
</html>
+5 -2
View File
@@ -1,15 +1,18 @@
// Copyright 2017-2020 @polkadot/ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
const config = require('@polkadot/dev/config/jest');
const config = require('@polkadot/dev/config/jest.cjs');
module.exports = Object.assign({}, config, {
moduleNameMapper: {
'@polkadot/ledger-transports(.*)$': '<rootDir>/packages/ledger-transports/src/node',
// eslint-disable-next-line sort-keys
'@polkadot/ledger(.*)$': '<rootDir>/packages/ledger/src/$1',
'@polkadot/react-(identicon|qr)(.*)$': '<rootDir>/packages/react-$1/src/$2',
'@polkadot/reactnative-(identicon)(.*)$': '<rootDir>/packages/reactnative-$1/src/$2',
'@polkadot/ui-(assets|keyring|settings|shared)(.*)$': '<rootDir>/packages/ui-$1/src/$2',
'\\.(css|less)$': 'empty/object',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': 'empty/object'
},
resolver: './jest.resolver.js'
resolver: '@polkadot/dev/config/jest-resolver.cjs'
});
-10
View File
@@ -1,10 +0,0 @@
// Copyright 2017-2020 @polkadot/ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
const path = require('path');
module.exports = function resolver (file, config) {
return file.includes('package.json')
? path.join(config.basedir.replace('/src', '/'), file)
: config.defaultResolver(file, config);
};
+13 -15
View File
@@ -8,8 +8,7 @@
"packages/*"
],
"resolutions": {
"babel-core": "^7.0.0-bridge.0",
"typescript": "^4.0.3"
"typescript": "^4.1.3"
},
"scripts": {
"build": "polkadot-dev-build-ts",
@@ -28,22 +27,21 @@
"test:one": "polkadot-dev-run-test"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/runtime": "^7.11.2",
"@polkadot/dev": "^0.58.1",
"@polkadot/ts": "^0.3.49",
"@types/jest": "^26.0.14",
"@babel/core": "^7.12.10",
"@babel/runtime": "^7.12.5",
"@polkadot/dev": "^0.61.2",
"@polkadot/ts": "^0.3.58",
"@types/jest": "^26.0.19",
"babel-plugin-transform-vue-template": "^0.4.2",
"empty": "^0.10.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-is": "^16.13.1",
"react-native": "^0.63.3",
"typedoc": "^0.19.2",
"typedoc-plugin-markdown": "^3.0.7",
"typedoc-plugin-no-inherit": "^1.2.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-is": "^17.0.1",
"react-native": "^0.63.4",
"vue-template-compiler": "^2.6.12",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12",
"webpack-serve": "^3.2.0"
},
"version": "0.60.1"
"version": "0.63.1"
}
+3 -5
View File
@@ -1,14 +1,12 @@
{
"name": "@polkadot/example-react",
"version": "0.60.1",
"version": "0.63.1",
"description": "A very basic example with ui-* & react-* packages",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"maintainers": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.11.2"
"@babel/runtime": "^7.12.5"
}
}
+5 -4
View File
@@ -3,10 +3,11 @@
import React, { useCallback, useEffect, useState } from 'react';
import ReactDOM from 'react-dom';
import Identicon from '@polkadot/react-identicon';
import keyring from '@polkadot/ui-keyring';
import settings from '@polkadot/ui-settings';
import { mnemonicGenerate, cryptoWaitReady } from '@polkadot/util-crypto';
import { Identicon } from '@polkadot/react-identicon';
import { keyring } from '@polkadot/ui-keyring';
import { settings } from '@polkadot/ui-settings';
import { cryptoWaitReady, mnemonicGenerate } from '@polkadot/util-crypto';
interface Props {
className?: string;
+3 -5
View File
@@ -1,14 +1,12 @@
{
"name": "@polkadot/example-vue",
"version": "0.60.1",
"version": "0.63.1",
"description": "A very basic example with ui-* & vue-* packages",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"maintainers": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.11.2"
"@babel/runtime": "^7.12.5"
}
}
+5 -4
View File
@@ -1,12 +1,13 @@
// Copyright 2017-2020 @polkadot/example-vue authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Prefix } from '@polkadot/util-crypto/address/types';
import type { Prefix } from '@polkadot/util-crypto/address/types';
import Vue, { VNode } from 'vue';
import keyring from '@polkadot/ui-keyring';
import settings from '@polkadot/ui-settings';
import { mnemonicGenerate, cryptoWaitReady } from '@polkadot/util-crypto';
import { keyring } from '@polkadot/ui-keyring';
import { settings } from '@polkadot/ui-settings';
import { cryptoWaitReady, mnemonicGenerate } from '@polkadot/util-crypto';
import Identicon from '@polkadot/vue-identicon';
interface Account {
+4 -3
View File
@@ -4,10 +4,11 @@
import React, { useEffect, useState } from 'react';
import { Button, SafeAreaView, ScrollView, StatusBar, StyleSheet, Text, View } from 'react-native';
import { Colors } from 'react-native/Libraries/NewAppScreen';
import Identicon from '@polkadot/reactnative-identicon';
import keyring from '@polkadot/ui-keyring';
import settings from '@polkadot/ui-settings';
import { mnemonicGenerate, cryptoWaitReady } from '@polkadot/util-crypto';
import { keyring } from '@polkadot/ui-keyring';
import { settings } from '@polkadot/ui-settings';
import { cryptoWaitReady, mnemonicGenerate } from '@polkadot/util-crypto';
const styles = StyleSheet.create({
body: {
+1
View File
@@ -4,6 +4,7 @@
import './nodeGlobalsShim.js';
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
@@ -4,6 +4,7 @@
/* eslint-disable no-global-assign */
import 'fast-text-encoding';
import AsyncStorage from '@react-native-community/async-storage';
class Storage {
+16 -21
View File
@@ -1,6 +1,6 @@
{
"name": "exampleReactNative",
"version": "0.60.1",
"version": "0.63.1",
"private": true,
"scripts": {
"copy-workspace-packages": "yarn copy-identicon && yarn copy-ui-shared",
@@ -12,36 +12,31 @@
"test": "jest"
},
"dependencies": {
"@polkadot/reactnative-identicon": "0.60.1",
"@polkadot/ui-keyring": "0.60.1",
"@polkadot/ui-settings": "0.60.1",
"@polkadot/keyring": "^5.0.1",
"@polkadot/reactnative-identicon": "0.63.1",
"@polkadot/ui-keyring": "0.63.1",
"@polkadot/ui-settings": "0.63.1",
"@polkadot/util": "^5.0.1",
"@polkadot/util-crypto": "^5.0.1",
"@react-native-community/async-storage": "^1.12.1",
"fast-text-encoding": "^1.0.3",
"get-yarn-workspaces": "^1.0.2",
"os-browserify": "^0.3.0",
"process": "^0.11.10",
"react": "16.13.1",
"react-native": "^0.63.3",
"react": "^17.0.1",
"react-native": "^0.63.4",
"react-native-crypto": "^2.2.0",
"react-native-randombytes": "^3.5.3",
"react-native-randombytes": "^3.6.0",
"stream-http": "^3.1.1"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/runtime": "^7.11.2",
"@polkadot/keyring": "^3.5.1",
"@polkadot/util": "^3.5.1",
"@polkadot/util-crypto": "^3.5.1",
"@babel/core": "^7.12.10",
"@babel/runtime": "^7.12.5",
"@react-native-community/cli-platform-ios": "^4.13.0",
"@types/react-test-renderer": "16.9.3",
"babel-jest": "^26.5.2",
"metro-react-native-babel-preset": "^0.63.0",
"react-test-renderer": "16.13.1"
},
"peerDependencies": {
"@polkadot/keyring": "*",
"@polkadot/util": "*",
"@polkadot/util-crypto": "*"
"@types/react-test-renderer": "17.0.0",
"babel-jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.64.0",
"react-test-renderer": "17.0.1"
},
"jest": {
"preset": "react-native",
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+2
View File
@@ -0,0 +1,2 @@
# @polkadot/ledger-transports
+23
View File
@@ -0,0 +1,23 @@
{
"name": "@polkadot/ledger-transports",
"version": "0.63.1",
"repository": "github:polkadot-js/ui",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"main": "node.js",
"browser": "browser.js",
"react-native": "react-native.js",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@ledgerhq/hw-transport-webusb": "^5.34.1"
},
"devDependencies": {
"@types/ledgerhq__hw-transport-node-hid": "^4.22.2",
"@types/ledgerhq__hw-transport-webusb": "^4.70.1"
},
"optionalDependencies": {
"@ledgerhq/hw-transport-node-hid-singleton": "^5.34.0"
}
}
@@ -1,9 +1,9 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// Copyright 2017-2020 @polkadot/ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { TransportDef } from './types';
import type Transport from '@ledgerhq/hw-transport';
import type { TransportDef } from './types';
import Transport from '@ledgerhq/hw-transport';
import LedgerWebUSB from '@ledgerhq/hw-transport-webusb';
const transports: TransportDef[] = [
@@ -21,4 +21,4 @@ const transports: TransportDef[] = [
}
];
export default transports;
export { transports };
+15
View File
@@ -0,0 +1,15 @@
// Copyright 2017-2020 @polkadot/ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
declare module '@ledgerhq/hw-transport-node-hid-noevents' {
import Transport from '@ledgerhq/hw-transport';
export default class TransportNodeHidNoEvents extends Transport<string> {}
export function getDevices(): Array<unknown>
}
declare module '@ledgerhq/hw-transport-node-hid-singleton' {
import TransportNodeHidNoEvents, { getDevices } from '@ledgerhq/hw-transport-node-hid-noevents';
export default class TransportNodeHid extends TransportNodeHidNoEvents { }
}
+17
View File
@@ -0,0 +1,17 @@
// Copyright 2017-2020 @polkadot/ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type Transport from '@ledgerhq/hw-transport';
import type { TransportDef } from './types';
import LedgerHid from '@ledgerhq/hw-transport-node-hid-singleton';
const transports: TransportDef[] = [
{
create: (): Promise<Transport> =>
LedgerHid.create(),
type: 'hid'
}
];
export { transports };
@@ -0,0 +1,8 @@
// Copyright 2017-2020 @polkadot/ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { TransportDef } from './types';
const transports: TransportDef[] = [];
export { transports };
+11
View File
@@ -0,0 +1,11 @@
// Copyright 2017-2020 @polkadot/ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import Transport from '@ledgerhq/hw-transport';
export type LedgerTypes = 'hid' | 'u2f' | 'webusb';
export interface TransportDef {
create (): Promise<Transport>;
type: LedgerTypes;
}
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+2
View File
@@ -0,0 +1,2 @@
# @polkadot/ledger
+20
View File
@@ -0,0 +1,20 @@
{
"name": "@polkadot/ledger",
"version": "0.63.1",
"repository": "github:polkadot-js/ui",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"main": "index.js",
"sideEffects": false,
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/ledger-transports": "0.63.1",
"@polkadot/util": "^5.0.1",
"@zondax/ledger-polkadot": "^0.12.0"
},
"peerDependencies": {
"@polkadot/util": "*"
}
}
@@ -1,15 +1,14 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// Copyright 2017-2020 @polkadot/ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import Transport from '@ledgerhq/hw-transport';
import { AccountOptions, LedgerAddress, LedgerSignature, LedgerTypes, LedgerVersion } from './types';
import type Transport from '@ledgerhq/hw-transport';
import type { AccountOptions, LedgerAddress, LedgerSignature, LedgerTypes, LedgerVersion } from './types';
import { ResponseBase, SubstrateApp, newKusamaApp, newPolkadotApp } from '@zondax/ledger-polkadot';
import { newKusamaApp, newPolkadotApp, ResponseBase, SubstrateApp } from '@zondax/ledger-polkadot';
import { transports } from '@polkadot/ledger-transports';
import { assert, bufferToU8a, u8aToBuffer, u8aToHex } from '@polkadot/util';
import allNode from './transportsNode';
import allWeb from './transportsWeb';
export const LEDGER_DEFAULT_ACCOUNT = 0x80000000;
export const LEDGER_DEFAULT_CHANGE = 0x80000000;
@@ -18,8 +17,6 @@ export const LEDGER_DEFAULT_INDEX = 0x80000000;
const SUCCESS_CODE = 0x9000;
const transports = allNode.concat(allWeb);
const APPS: Record<string, (transport: Transport) => SubstrateApp> = {
kusama: newKusamaApp,
polkadot: newPolkadotApp
@@ -30,7 +27,7 @@ type Chain = keyof typeof APPS;
// A very basic wrapper for a ledger app -
// - it connects automatically, creating an app as required
// - Promises return errors (instead of wrapper errors)
export default class Ledger {
export class Ledger {
#app: SubstrateApp | null = null;
#chain: Chain;
@@ -46,7 +43,41 @@ export default class Ledger {
this.#transport = transport;
}
private async _getApp (): Promise<SubstrateApp> {
public async getAddress (confirm = false, accountOffset = 0, addressOffset = 0, { account = LEDGER_DEFAULT_ACCOUNT, addressIndex = LEDGER_DEFAULT_INDEX, change = LEDGER_DEFAULT_CHANGE }: Partial<AccountOptions> = {}): Promise<LedgerAddress> {
return this.#withApp(async (app: SubstrateApp): Promise<LedgerAddress> => {
const { address, pubKey } = await this.#wrapError(app.getAddress(account + accountOffset, change, addressIndex + addressOffset, confirm));
return {
address,
publicKey: `0x${pubKey}`
};
});
}
public async getVersion (): Promise<LedgerVersion> {
return this.#withApp(async (app: SubstrateApp): Promise<LedgerVersion> => {
const { device_locked: isLocked, major, minor, patch, test_mode: isTestMode } = await this.#wrapError(app.getVersion());
return {
isLocked,
isTestMode,
version: [major, minor, patch]
};
});
}
public async sign (message: Uint8Array, accountOffset = 0, addressOffset = 0, { account = LEDGER_DEFAULT_ACCOUNT, addressIndex = LEDGER_DEFAULT_INDEX, change = LEDGER_DEFAULT_CHANGE }: Partial<AccountOptions> = {}): Promise<LedgerSignature> {
return this.#withApp(async (app: SubstrateApp): Promise<LedgerSignature> => {
const buffer = u8aToBuffer(message);
const { signature } = await this.#wrapError(app.sign(account + accountOffset, change, addressIndex + addressOffset, buffer));
return {
signature: u8aToHex(bufferToU8a(signature))
};
});
}
#getApp = async (): Promise<SubstrateApp> => {
if (!this.#app) {
const def = transports.find(({ type }) => type === this.#transport);
@@ -58,11 +89,11 @@ export default class Ledger {
}
return this.#app;
}
};
private async _withApp <T> (fn: (app: SubstrateApp) => Promise<T>): Promise<T> {
#withApp = async <T> (fn: (app: SubstrateApp) => Promise<T>): Promise<T> => {
try {
const app = await this._getApp();
const app = await this.#getApp();
return await fn(app);
} catch (error) {
@@ -70,47 +101,13 @@ export default class Ledger {
throw error;
}
}
};
private async _wrapError <T extends ResponseBase> (promise: Promise<T>): Promise<T> {
#wrapError = async <T extends ResponseBase> (promise: Promise<T>): Promise<T> => {
const result = await promise;
assert(result.return_code === SUCCESS_CODE, result.error_message);
return result;
}
public async getAddress (confirm = false, accountOffset = 0, addressOffset = 0, { account = LEDGER_DEFAULT_ACCOUNT, addressIndex = LEDGER_DEFAULT_INDEX, change = LEDGER_DEFAULT_CHANGE }: Partial<AccountOptions> = {}): Promise<LedgerAddress> {
return this._withApp(async (app: SubstrateApp): Promise<LedgerAddress> => {
const { address, pubKey } = await this._wrapError(app.getAddress(account + accountOffset, change, addressIndex + addressOffset, confirm));
return {
address,
publicKey: `0x${pubKey}`
};
});
}
public async getVersion (): Promise<LedgerVersion> {
return this._withApp(async (app: SubstrateApp): Promise<LedgerVersion> => {
const { device_locked: isLocked, major, minor, patch, test_mode: isTestMode } = await this._wrapError(app.getVersion());
return {
isLocked,
isTestMode,
version: [major, minor, patch]
};
});
}
public async sign (message: Uint8Array, accountOffset = 0, addressOffset = 0, { account = LEDGER_DEFAULT_ACCOUNT, addressIndex = LEDGER_DEFAULT_INDEX, change = LEDGER_DEFAULT_CHANGE }: Partial<AccountOptions> = {}): Promise<LedgerSignature> {
return this._withApp(async (app: SubstrateApp): Promise<LedgerSignature> => {
const buffer = u8aToBuffer(message);
const { signature } = await this._wrapError(app.sign(account + accountOffset, change, addressIndex + addressOffset, buffer));
return {
signature: u8aToHex(bufferToU8a(signature))
};
});
}
};
}
@@ -1,8 +1,6 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// Copyright 2017-2020 @polkadot/ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import Transport from '@ledgerhq/hw-transport';
export type LedgerTypes = 'hid' | 'u2f' | 'webusb';
export interface AccountOptions {
@@ -25,8 +23,3 @@ export interface LedgerVersion {
isTestMode: boolean;
version: [number, number, number];
}
export interface TransportDef {
create (): Promise<Transport>;
type: LedgerTypes;
}
+16 -15
View File
@@ -1,20 +1,24 @@
{
"name": "@polkadot/react-identicon",
"version": "0.60.1",
"version": "0.63.1",
"description": "Renders an SVG picture representing an address",
"main": "index.js",
"sideEffects": false,
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"maintainers": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.11.2",
"@polkadot/ui-settings": "0.60.1",
"@polkadot/ui-shared": "0.60.1",
"color": "^3.1.2",
"@babel/runtime": "^7.12.5",
"@polkadot/keyring": "^5.0.1",
"@polkadot/ui-settings": "0.63.1",
"@polkadot/ui-shared": "0.63.1",
"@polkadot/util": "^5.0.1",
"@polkadot/util-crypto": "^5.0.1",
"color": "^3.1.3",
"ethereum-blockies-base64": "^1.0.2",
"jdenticon": "2.2.0",
"react-copy-to-clipboard": "^5.0.2"
"react-copy-to-clipboard": "^5.0.2",
"styled-components": "^5.2.1"
},
"peerDependencies": {
"@polkadot/keyring": "*",
@@ -26,13 +30,10 @@
"styled-components": "*"
},
"devDependencies": {
"@polkadot/keyring": "^3.5.1",
"@polkadot/util": "^3.5.1",
"@polkadot/util-crypto": "^3.5.1",
"@types/react-copy-to-clipboard": "^4.3.0",
"@types/react-dom": "^16.9.8",
"@types/styled-components": "^5.1.3",
"styled-components": "^5.2.0",
"@types/react-dom": "^17.0.0",
"@types/styled-components": "^5.1.5",
"styled-components": "^5.2.1",
"xmlserializer": "^0.6.1"
}
}
+4 -3
View File
@@ -3,9 +3,10 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { encodeAddress, randomAsU8a } from '@polkadot/util-crypto';
import IdentityIcon from '.';
import { Identicon } from '.';
const THEMES = ['beachball', 'polkadot', 'substrate'];
@@ -23,7 +24,7 @@ export default class Demo extends React.PureComponent {
<div>
<div>
{identities.map((value, index): React.ReactNode => (
<IdentityIcon
<Identicon
key={value.toString()}
theme={THEMES[index % THEMES.length] as 'empty'}
value={value}
@@ -32,7 +33,7 @@ export default class Demo extends React.PureComponent {
</div>
<div>
{THEMES.map((theme): React.ReactNode => (
<IdentityIcon
<Identicon
key={theme}
theme={theme as 'empty'}
value='5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'
+19 -9
View File
@@ -1,17 +1,18 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Prefix } from '@polkadot/util-crypto/address/types';
import { IdentityProps as Props, Props as ComponentProps } from './types';
import type { Prefix } from '@polkadot/util-crypto/address/types';
import type { IdentityProps as Props, Props as ComponentProps } from './types';
import React from 'react';
import CopyToClipboard from 'react-copy-to-clipboard';
import styled from 'styled-components';
import settings, { ICON_DEFAULT_HOST } from '@polkadot/ui-settings';
import { isHex, isU8a, u8aToHex } from '@polkadot/util';
import { decodeAddress, encodeAddress } from '@polkadot/util-crypto';
import { Beachball, Empty, Jdenticon, Polkadot } from './icons';
import { ICON_DEFAULT_HOST, settings } from '@polkadot/ui-settings';
import { isHex, isU8a, u8aToHex } from '@polkadot/util';
import { decodeAddress, encodeAddress, ethereumEncode } from '@polkadot/util-crypto';
import { Beachball, Empty, Ethereum, Jdenticon, Polkadot } from './icons';
const Fallback = Beachball;
@@ -24,6 +25,7 @@ const DEFAULT_SIZE = 64;
const Components: Record<string, React.ComponentType<ComponentProps>> = {
beachball: Beachball,
empty: Empty,
ethereum: Ethereum,
jdenticon: Jdenticon,
polkadot: Polkadot,
substrate: Jdenticon
@@ -67,7 +69,15 @@ class BaseIcon extends React.PureComponent<Props, State> {
BaseIcon.prefix = prefix;
}
public static getDerivedStateFromProps ({ prefix = BaseIcon.prefix, value }: Props, prevState: State): State | null {
public static getDerivedStateFromProps ({ prefix = BaseIcon.prefix, theme, value }: Props, prevState: State): State | null {
if (theme === 'ethereum') {
const address = isU8a(value)
? ethereumEncode(value)
: value || '';
return { address, publicKey: '' };
}
try {
const address = isU8a(value) || isHex(value)
? encodeAddress(value, prefix)
@@ -137,8 +147,8 @@ class BaseIcon extends React.PureComponent<Props, State> {
}
}
function Identicon (props: Props): React.ReactElement<Props> {
function Icon (props: Props): React.ReactElement<Props> {
return <BaseIcon {...props} />;
}
export default React.memo(Identicon);
export const Identicon = React.memo(Icon);
@@ -1,12 +1,13 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Props } from '../types';
import type { Props } from '../types';
import React, { useCallback } from 'react';
import { beachballIcon } from '@polkadot/ui-shared';
function Beachball ({ address, className = '', size, style }: Props): React.ReactElement<Props> {
function Identicon ({ address, className = '', size, style }: Props): React.ReactElement<Props> {
const updateElem = useCallback(
(node: HTMLDivElement): void => {
node && node.appendChild(
@@ -25,4 +26,4 @@ function Beachball ({ address, className = '', size, style }: Props): React.Reac
);
}
export default React.memo(Beachball);
export const Beachball = React.memo(Identicon);
+3 -3
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Props } from '../types';
import type { Props } from '../types';
import React from 'react';
function Empty ({ className = '', size, style }: Props): React.ReactElement<Props> {
function Identicon ({ className = '', size, style }: Props): React.ReactElement<Props> {
return (
<svg
className={className}
@@ -17,4 +17,4 @@ function Empty ({ className = '', size, style }: Props): React.ReactElement<Prop
);
}
export default React.memo(Empty);
export const Empty = React.memo(Identicon);
@@ -0,0 +1,29 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Props } from '../types';
import makeBlockie from 'ethereum-blockies-base64';
import React, { useMemo } from 'react';
import styled from 'styled-components';
function Identicon ({ address, className = '', style }: Props): React.ReactElement<Props> {
const imgSrc = useMemo(
() => makeBlockie(address),
[address]
);
return (
<img
className={className}
src={imgSrc}
style={style}
/>
);
}
export const Ethereum = React.memo(styled(Identicon)(({ size }: Props) => `
display: block;
height: ${size}px;
width: ${size}px;
`));
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Props } from '../types';
import type { Props } from '../types';
import React from 'react';
import jdenticon from 'jdenticon';
import React from 'react';
function Jdenticon ({ className = '', publicKey, size, style }: Props): React.ReactElement<Props> {
function Identicon ({ className = '', publicKey, size, style }: Props): React.ReactElement<Props> {
return (
<div
className={className}
@@ -18,4 +18,4 @@ function Jdenticon ({ className = '', publicKey, size, style }: Props): React.Re
);
}
export default React.memo(Jdenticon);
export const Jdenticon = React.memo(Identicon);
@@ -1,5 +1,6 @@
// Copyright 2018-2020 @polkadot/react-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Copyright 2018 Paritytech via paritytech/oo7/polkadot-identicon
// This has been converted from the original version that can be found at
@@ -15,10 +16,11 @@
// - Move constants to file-level
// - Overall it is now just a static component, expecting an address as an input value
import { Circle } from '@polkadot/ui-shared/icons/types';
import { Props } from '../types';
import type { Circle } from '@polkadot/ui-shared/icons/types';
import type { Props } from '../types';
import React from 'react';
import { polkadotIcon } from '@polkadot/ui-shared';
function renderCircle ({ cx, cy, fill, r }: Circle, key: number): React.ReactNode {
@@ -49,4 +51,4 @@ function Identicon ({ address, className = '', isAlternative = false, size, styl
);
}
export default React.memo(Identicon);
export const Polkadot = React.memo(Identicon);
+5 -4
View File
@@ -1,7 +1,8 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { default as Beachball } from './Beachball';
export { default as Empty } from './Empty';
export { default as Jdenticon } from './Jdenticon';
export { default as Polkadot } from './Polkadot';
export { Beachball } from './Beachball';
export { Empty } from './Empty';
export { Ethereum } from './Ethereum';
export { Jdenticon } from './Jdenticon';
export { Polkadot } from './Polkadot';
+4 -1
View File
@@ -1,7 +1,10 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
import Identicon from './Identicon';
import { Identicon } from './Identicon';
export * from './icons';
export { Identicon };
export default Identicon;
+5 -2
View File
@@ -1,7 +1,8 @@
// Copyright 2018-2020 @polkadot/react-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Prefix } from '@polkadot/util-crypto/address/types';
import type { Prefix } from '@polkadot/util-crypto/address/types';
import React from 'react';
export interface BaseProps {
@@ -25,6 +26,8 @@ export interface IdentityProps extends BaseProps {
onCopy?: (value: string) => void;
prefix?: Prefix;
size?: number;
theme?: 'beachball' | 'empty' | 'jdenticon' | 'polkadot' | 'substrate';
theme?: IconTheme;
value?: string | Uint8Array | null;
}
export type IconTheme = 'beachball' | 'empty' | 'ethereum' | 'jdenticon' | 'polkadot' | 'substrate';
+9 -7
View File
@@ -1,21 +1,23 @@
{
"name": "@polkadot/react-qr",
"version": "0.60.1",
"version": "0.63.1",
"description": "Generates and reads QR codes",
"main": "index.js",
"sideEffects": false,
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"maintainers": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.11.2",
"@babel/runtime": "^7.12.5",
"@polkadot/util": "^5.0.1",
"@polkadot/util-crypto": "^5.0.1",
"qrcode-generator": "^1.4.4",
"react-qr-reader": "^2.2.1"
"react-qr-reader": "^2.2.1",
"styled-components": "^5.2.1"
},
"devDependencies": {
"@types/react-qr-reader": "^2.1.3",
"@types/styled-components": "^5.1.3"
"@types/styled-components": "^5.1.5"
},
"peerDependencies": {
"@polkadot/util": "*",
+5 -4
View File
@@ -3,9 +3,10 @@
import React, { useEffect, useMemo, useRef, useState } from 'react';
import styled from 'styled-components';
import { xxhashAsHex } from '@polkadot/util-crypto';
import qrcode from './qrcode';
import { qrcode } from './qrcode';
import { createFrames, createImgSize } from './util';
interface Props {
@@ -34,8 +35,8 @@ const TIMER_INC = 500;
function getDataUrl (value: Uint8Array): string {
const qr = qrcode(0, 'M');
// HACK See out qrcode stringToBytes override as used internally. This
// will only work for the case where we actuall pass `Bytes` in here
// HACK See our qrcode stringToBytes override as used internally. This
// will only work for the case where we actually pass `Bytes` in here
// eslint-disable-next-line @typescript-eslint/no-explicit-any
qr.addData(value as any, 'Byte');
qr.make();
@@ -130,7 +131,7 @@ function Display ({ className, size, skipEncoding, style, value }: Props): React
);
}
export default React.memo(styled(Display)`
export const QrDisplay = React.memo(styled(Display)`
.ui--qr-Display {
height: 100%;
width: 100%;
+3 -3
View File
@@ -3,8 +3,8 @@
import React, { useMemo } from 'react';
import { QrDisplay } from './Display';
import { createAddressPayload } from './util';
import QrDisplay from './Display';
interface Props {
address: string;
@@ -14,7 +14,7 @@ interface Props {
style?: React.CSSProperties;
}
function DisplayExtrinsic ({ address, className, genesisHash, size, style }: Props): React.ReactElement<Props> | null {
function DisplayAddress ({ address, className, genesisHash, size, style }: Props): React.ReactElement<Props> | null {
const data = useMemo(
() => createAddressPayload(address, genesisHash),
[address, genesisHash]
@@ -35,4 +35,4 @@ function DisplayExtrinsic ({ address, className, genesisHash, size, style }: Pro
);
}
export default React.memo(DisplayExtrinsic);
export const QrDisplayAddress = React.memo(DisplayAddress);
+2 -2
View File
@@ -3,8 +3,8 @@
import React, { useMemo } from 'react';
import { QrDisplay } from './Display';
import { createSignPayload } from './util';
import QrDisplay from './Display';
interface Props {
address: string;
@@ -36,4 +36,4 @@ function DisplayPayload ({ address, className, cmd, genesisHash, payload, size,
);
}
export default React.memo(DisplayPayload);
export const QrDisplayPayload = React.memo(DisplayPayload);
+4 -4
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
// SPDX-License-Identifier: Apache-2.0
import React, { useMemo } from 'react';
import { NetworkSpecsStruct } from '@polkadot/ui-settings';
import React, { useMemo } from 'react';
import QrDisplay from './Display';
import { QrDisplay } from './Display';
import { encodeString } from './util';
interface Props {
@@ -36,4 +36,4 @@ function DisplayNetworkSpecs ({ className, networkSpecs, size, style }: Props):
);
}
export default React.memo(DisplayNetworkSpecs);
export const QrNetworkSpecs = React.memo(DisplayNetworkSpecs);
+1 -1
View File
@@ -54,7 +54,7 @@ function Scan ({ className, delay = DEFAULT_DELAY, onError = DEFAULT_ERROR, onSc
);
}
export default React.memo(styled(Scan)`
export const QrScan = React.memo(styled(Scan)`
.ui--qr-Scan {
display: inline-block;
height: 100%;
+3 -2
View File
@@ -2,11 +2,12 @@
// SPDX-License-Identifier: Apache-2.0
import React, { useCallback } from 'react';
import { assert } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
import { ADDRESS_PREFIX, SEED_PREFIX } from './constants';
import QrScan from './Scan';
import { QrScan } from './Scan';
interface ScanType {
isAddress: boolean;
@@ -59,4 +60,4 @@ function ScanAddress ({ className, onError, onScan, size, style }: Props): React
);
}
export default React.memo(ScanAddress);
export const QrScanAddress = React.memo(ScanAddress);
+2 -2
View File
@@ -3,7 +3,7 @@
import React, { useCallback } from 'react';
import QrScan from './Scan';
import { QrScan } from './Scan';
interface ScanType {
signature: string;
@@ -34,4 +34,4 @@ function ScanSignature ({ className, onError, onScan, size, style }: Props): Rea
);
}
export default React.memo(ScanSignature);
export const QrScanSignature = React.memo(ScanSignature);
+5 -5
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { default as QrDisplayAddress } from './DisplayAddress';
export { default as QrDisplayPayload } from './DisplayPayload';
export { default as QrScanAddress } from './ScanAddress';
export { default as QrScanSignature } from './ScanSignature';
export { default as QrNetworkSpecs } from './NetworkSpecs';
export { QrDisplayAddress } from './DisplayAddress';
export { QrDisplayPayload } from './DisplayPayload';
export { QrScanAddress } from './ScanAddress';
export { QrScanSignature } from './ScanSignature';
export { QrNetworkSpecs } from './NetworkSpecs';
+1 -1
View File
@@ -12,4 +12,4 @@ const qrcode: typeof _qrcode = _qrcode;
(qrcode as any).stringToBytes = (data: Uint8Array): Uint8Array =>
data;
export default qrcode;
export { qrcode };
+2 -2
View File
@@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0
import { u8aConcat, u8aToHex, u8aToString } from '@polkadot/util';
import { createAddressPayload, createSignPayload, createFrames, decodeString, encodeNumber, encodeString } from './util';
import { randomAsU8a } from '@polkadot/util-crypto';
import { createAddressPayload, createFrames, createSignPayload, decodeString, encodeNumber, encodeString } from './util';
describe('util', (): void => {
describe('Uint8Array <-> string', (): void => {
let u8a: Uint8Array;
+9 -8
View File
@@ -1,25 +1,26 @@
{
"name": "@polkadot/reactnative-identicon",
"version": "0.60.1",
"version": "0.63.1",
"description": "Renders an SVG picture representing an address",
"main": "index.js",
"sideEffects": false,
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"maintainers": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.11.2",
"@polkadot/ui-shared": "0.60.1",
"@babel/runtime": "^7.12.5",
"@polkadot/ui-shared": "0.63.1",
"@polkadot/util": "^5.0.1",
"@polkadot/util-crypto": "^5.0.1",
"react-native-svg": "^12.1.0"
},
"peerDependencies": {
"@polkadot/util": "*",
"@polkadot/util-crypto": "*",
"react": "*",
"react-native": "*"
},
"devDependencies": {
"@polkadot/util-crypto": "^3.5.1",
"@types/react-native": "^0.63.25"
"@types/react-native": "^0.63.40"
}
}
@@ -1,10 +1,11 @@
// Copyright 2017-2020 @polkadot/reactnative-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Prefix } from '@polkadot/util-crypto/address/types';
import { Props as ComponentProps } from './types';
import type { Prefix } from '@polkadot/util-crypto/address/types';
import type { Props as ComponentProps } from './types';
import React from 'react';
import { isHex, isU8a, u8aToHex } from '@polkadot/util';
import { decodeAddress, encodeAddress } from '@polkadot/util-crypto';
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/reactnative-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Props } from '../types';
import type { Props } from '../types';
import React from 'react';
import { View } from 'react-native';
@@ -1,12 +1,13 @@
// Copyright 2018-2020 @polkadot/reactnative-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Circle as CircleType } from '@polkadot/ui-shared/icons/types';
import { Props } from '../types';
import type { Circle as CircleType } from '@polkadot/ui-shared/icons/types';
import type { Props } from '../types';
import React from 'react';
import { View } from 'react-native';
import Svg, { Circle as SvgCircle } from 'react-native-svg';
import { polkadotIcon } from '@polkadot/ui-shared';
function renderCircle ({ cx, cy, fill, r }: CircleType, key: number): React.ReactNode {
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import Identicon from './Identicon';
export * from './icons';
export default Identicon;
+3 -5
View File
@@ -1,14 +1,12 @@
{
"name": "@polkadot/ui-assets",
"version": "0.60.1",
"version": "0.63.1",
"description": "Static assets shared accross projects",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"maintainers": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.11.2"
"@babel/runtime": "^7.12.5"
}
}
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2020 @polkadot/ui-assets authors & contributors
// SPDX-License-Identifier: Apache-2.0
// empty
+11 -24
View File
@@ -1,41 +1,28 @@
{
"name": "@polkadot/ui-keyring",
"version": "0.60.1",
"version": "0.63.1",
"main": "index.js",
"repository": "https://github.com/polkadot-js/apps.git",
"sideEffects": false,
"repository": "github:polkadot-js/apps",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"browser": {
"./ledger/transportsNode": "./ledger/transportsEmpty"
},
"react-native": {
"./ledger/transportsNode": "./ledger/transportsEmpty",
"./ledger/transportsWeb": "./ledger/transportsEmpty"
},
"dependencies": {
"@babel/runtime": "^7.11.2",
"@ledgerhq/hw-transport-webusb": "^5.25.0",
"@zondax/ledger-polkadot": "^0.11.0",
"@babel/runtime": "^7.12.5",
"@polkadot/keyring": "^5.0.1",
"@polkadot/ledger": "^0.63.1",
"@polkadot/ui-settings": "0.63.1",
"@polkadot/util": "^5.0.1",
"@polkadot/x-rxjs": "^3.0.1",
"mkdirp": "^1.0.4",
"rxjs": "^6.6.3",
"store": "^2.0.12"
},
"devDependencies": {
"@polkadot/keyring": "^3.5.1",
"@polkadot/types": "^2.1.2-1",
"@polkadot/util": "^3.5.1",
"@types/ledgerhq__hw-transport-node-hid": "^4.22.2",
"@types/ledgerhq__hw-transport-webusb": "^4.70.1",
"@polkadot/types": "^3.0.1",
"@types/mkdirp": "^1.0.1",
"@types/store": "^2.0.2"
},
"optionalDependencies": {
"@ledgerhq/hw-transport-node-hid": "^5.25.0"
},
"peerDependencies": {
"@polkadot/keyring": "*",
"@polkadot/ui-settings": "*",
+12 -12
View File
@@ -1,21 +1,21 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeyringInstance, KeyringPair } from '@polkadot/keyring/types';
import { Prefix } from '@polkadot/util-crypto/address/types';
import { AddressSubject } from './observable/types';
import { KeyringOptions, KeyringStore } from './types';
import type { KeyringInstance, KeyringPair } from '@polkadot/keyring/types';
import type { Prefix } from '@polkadot/util-crypto/address/types';
import type { AddressSubject } from './observable/types';
import type { KeyringOptions, KeyringStore } from './types';
import testKeyring from '@polkadot/keyring/testing';
import { createTestKeyring } from '@polkadot/keyring/testing';
import { isBoolean, isString } from '@polkadot/util';
import accounts from './observable/accounts';
import addresses from './observable/addresses';
import contracts from './observable/contracts';
import env from './observable/development';
import BrowserStore from './stores/Browser'; // direct import (skip index with all)
import { accounts } from './observable/accounts';
import { addresses } from './observable/addresses';
import { contracts } from './observable/contracts';
import { env } from './observable/env';
import { BrowserStore } from './stores/Browser'; // direct import (skip index with all)
export default class Base {
export class Base {
#accounts: AddressSubject;
#addresses: AddressSubject;
@@ -103,7 +103,7 @@ export default class Base {
}
protected initKeyring (options: KeyringOptions): void {
const keyring = testKeyring(options, true);
const keyring = createTestKeyring(options, true);
if (isBoolean(options.isDevelopment)) {
this.setDevMode(options.isDevelopment);
+47 -35
View File
@@ -1,21 +1,22 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeyringPair, KeyringPair$Meta, KeyringPair$Json } from '@polkadot/keyring/types';
import { KeypairType } from '@polkadot/util-crypto/types';
import { AddressSubject, SingleAddress } from './observable/types';
import { CreateResult, KeyringAddress, KeyringAddressType, KeyringItemType, KeyringJson, KeyringJson$Meta, KeyringOptions, KeyringStruct } from './types';
import type { KeyringPair, KeyringPair$Json, KeyringPair$Meta } from '@polkadot/keyring/types';
import type { KeypairType } from '@polkadot/util-crypto/types';
import type { AddressSubject, SingleAddress } from './observable/types';
import type { CreateResult, KeyringAddress, KeyringAddressType, KeyringItemType, KeyringJson, KeyringJson$Meta, KeyringOptions, KeyringStruct } from './types';
import BN from 'bn.js';
import createPair from '@polkadot/keyring/pair';
import chains from '@polkadot/ui-settings/defaults/chains';
import { createPair } from '@polkadot/keyring/pair';
import { chains } from '@polkadot/ui-settings/defaults/chains';
import { bnToBn, hexToU8a, isHex, isString, u8aSorted } from '@polkadot/util';
import { base64Decode, createKeyMulti } from '@polkadot/util-crypto';
import env from './observable/development';
import Base from './Base';
import { accountKey, addressKey, accountRegex, addressRegex, contractKey, contractRegex } from './defaults';
import keyringOption from './options';
import { env } from './observable/env';
import { Base } from './Base';
import { accountKey, accountRegex, addressKey, addressRegex, contractKey, contractRegex } from './defaults';
import { KeyringOption } from './options';
const RECENT_EXPIRY = 24 * 60 * 60;
@@ -23,6 +24,8 @@ const RECENT_EXPIRY = 24 * 60 * 60;
// Chain determination occurs outside of Keyring. Loading `keyring.loadAll({ type: 'ed25519' | 'sr25519' })` is triggered
// from the API after the chain is received
export class Keyring extends Base implements KeyringStruct {
public readonly keyringOption = new KeyringOption();
#stores = {
account: (): AddressSubject => this.accounts,
address: (): AddressSubject => this.addresses,
@@ -93,7 +96,7 @@ export class Keyring extends Base implements KeyringStruct {
json.meta.whenEdited = Date.now();
this.keyring.addFromJson(json);
this.accounts.add(this._store, pair.address, json);
this.accounts.add(this._store, pair.address, json, pair.type);
}
public forgetAccount (address: string): void {
@@ -119,7 +122,7 @@ export class Keyring extends Base implements KeyringStruct {
return Object
.keys(available)
.map((address): KeyringAddress => this.getAddress(address, 'account') as KeyringAddress)
.filter((account): boolean => env.isDevelopment() || account.meta.isTesting !== true);
.filter((account) => env.isDevelopment() || account.meta.isTesting !== true);
}
public getAddress (_address: string | Uint8Array, type: KeyringItemType | null = null): KeyringAddress | undefined {
@@ -178,7 +181,7 @@ export class Keyring extends Base implements KeyringStruct {
// FIXME Just for the transition period (ignoreChecksum)
const pair = this.keyring.addFromJson(json as KeyringPair$Json, true);
this.accounts.add(this._store, pair.address, json);
this.accounts.add(this._store, pair.address, json, pair.type);
}
const [, hexAddr] = key.split(':');
@@ -195,12 +198,17 @@ export class Keyring extends Base implements KeyringStruct {
return;
}
const address = this.encodeAddress(
isHex(json.address)
? hexToU8a(json.address)
// FIXME Just for the transition period (ignoreChecksum)
: this.decodeAddress(json.address, true)
);
// We assume anything hex that is not 32bytes (64 + 2 bytes hex) is an Ethereum-like address
// (this caters for both H160 addresses as well as full or compressed publicKeys) - in the case
// of both ecdsa and ethereum, we keep it as-is
const address = isHex(json.address) && json.address.length !== 66
? json.address
: this.encodeAddress(
isHex(json.address)
? hexToU8a(json.address)
// FIXME Just for the transition period (ignoreChecksum)
: this.decodeAddress(json.address, true)
);
const [, hexAddr] = key.split(':');
this.addresses.add(this._store, address, json);
@@ -230,7 +238,7 @@ export class Keyring extends Base implements KeyringStruct {
};
const pair = this.keyring.addFromAddress(address, json.meta);
this.accounts.add(this._store, pair.address, json);
this.accounts.add(this._store, pair.address, json, pair.type);
}
private allowGenesis (json?: KeyringJson | { meta: KeyringJson$Meta } | null): boolean {
@@ -254,25 +262,33 @@ export class Keyring extends Base implements KeyringStruct {
this._store.all((key: string, json: KeyringJson): void => {
if (options.filter ? options.filter(json) : true) {
if (this.allowGenesis(json)) {
if (accountRegex.test(key)) {
this.loadAccount(json, key);
} else if (addressRegex.test(key)) {
this.loadAddress(json, key);
} else if (contractRegex.test(key)) {
this.loadContract(json, key);
try {
if (this.allowGenesis(json)) {
if (accountRegex.test(key)) {
this.loadAccount(json, key);
} else if (addressRegex.test(key)) {
this.loadAddress(json, key);
} else if (contractRegex.test(key)) {
this.loadContract(json, key);
}
}
} catch (error) {
// ignore
}
}
});
injected.forEach((account): void => {
if (this.allowGenesis(account)) {
this.loadInjected(account.address, account.meta);
try {
this.loadInjected(account.address, account.meta);
} catch (error) {
// ignore
}
}
});
keyringOption.init(this);
this.keyringOption.init(this);
}
public restoreAccount (json: KeyringPair$Json, password: string): KeyringPair {
@@ -300,7 +316,7 @@ export class Keyring extends Base implements KeyringStruct {
const json = pair.toJson(password);
this.keyring.addFromJson(json);
this.accounts.add(this._store, pair.address, json);
this.accounts.add(this._store, pair.address, json, pair.type);
return json;
}
@@ -312,7 +328,7 @@ export class Keyring extends Base implements KeyringStruct {
pair.setMeta(meta);
json.meta = pair.meta;
this.accounts.add(this._store, address, json);
this.accounts.add(this._store, address, json, pair.type);
});
}
@@ -359,7 +375,3 @@ export class Keyring extends Base implements KeyringStruct {
return this.addresses.subject.getValue()[address];
}
}
const keyringInstance = new Keyring();
export default keyringInstance;
+1 -1
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { u8aToHex } from '@polkadot/util';
import { decodeAddress } from '@polkadot/keyring';
import { u8aToHex } from '@polkadot/util';
const ACCOUNT_PREFIX = 'account:';
const ADDRESS_PREFIX = 'address:';
+7
View File
@@ -0,0 +1,7 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { detectPackage } from '@polkadot/util';
// eslint-disable-next-line @typescript-eslint/no-var-requires
detectPackage(require('./package.json'), typeof __dirname !== 'undefined' && __dirname);
+7 -10
View File
@@ -1,17 +1,14 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { detectPackage } from '@polkadot/util';
import './detectPackage';
import keyring, { Keyring } from './Keyring';
import Ledger from './ledger';
import { Keyring } from './Keyring';
// eslint-disable-next-line @typescript-eslint/no-var-requires
detectPackage(require('./package.json'), typeof __dirname !== 'undefined' && __dirname);
export { Ledger } from '@polkadot/ledger';
const keyring = new Keyring();
export { Keyring, keyring };
export default keyring;
export {
Keyring,
Ledger
};
@@ -1,8 +0,0 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { TransportDef } from './types';
const transports: TransportDef[] = [];
export default transports;
@@ -1,17 +0,0 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { TransportDef } from './types';
import Transport from '@ledgerhq/hw-transport';
import LedgerHid from '@ledgerhq/hw-transport-node-hid';
const transports: TransportDef[] = [
{
create: (): Promise<Transport> =>
LedgerHid.create(),
type: 'hid'
}
];
export default transports;
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
import { accountKey } from '../defaults';
import { genericSubject } from './genericSubject';
import genericSubject from './genericSubject';
export default genericSubject(accountKey, true);
export const accounts = genericSubject(accountKey, true);
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
import { addressKey } from '../defaults';
import { genericSubject } from './genericSubject';
import genericSubject from './genericSubject';
export default genericSubject(addressKey);
export const addresses = genericSubject(addressKey);
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
import { contractKey } from '../defaults';
import { genericSubject } from './genericSubject';
import genericSubject from './genericSubject';
export default genericSubject(contractKey);
export const contracts = genericSubject(contractKey);
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BehaviorSubject } from 'rxjs';
import { BehaviorSubject } from '@polkadot/x-rxjs';
const subject = new BehaviorSubject(false);
export default {
export const env = {
isDevelopment: (): boolean =>
subject.getValue(),
set: (isDevelopment: boolean): void => {
@@ -1,16 +1,17 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { SubjectInfo, AddressSubject, SingleAddress } from './types';
import { KeyringJson, KeyringStore } from '../types';
import type { KeypairType } from '@polkadot/util-crypto/types';
import type { KeyringJson, KeyringStore } from '../types';
import type { AddressSubject, SingleAddress, SubjectInfo } from './types';
import { BehaviorSubject } from 'rxjs';
import { BehaviorSubject } from '@polkadot/x-rxjs';
import createOptionItem from '../options/item';
import development from './development';
import { createOptionItem } from '../options/item';
import { env } from './env';
function callNext (current: SubjectInfo, subject: BehaviorSubject<SubjectInfo>, withTest: boolean): void {
const isDevMode = development.isDevelopment();
const isDevMode = env.isDevelopment();
const filtered: SubjectInfo = {};
Object.keys(current).forEach((key): void => {
@@ -24,24 +25,25 @@ function callNext (current: SubjectInfo, subject: BehaviorSubject<SubjectInfo>,
subject.next(filtered);
}
export default function genericSubject (keyCreator: (address: string) => string, withTest = false): AddressSubject {
export function genericSubject (keyCreator: (address: string) => string, withTest = false): AddressSubject {
let current: SubjectInfo = {};
const subject = new BehaviorSubject({});
const next = (): void => callNext(current, subject, withTest);
development.subject.subscribe(next);
env.subject.subscribe(next);
return {
add: (store: KeyringStore, address: string, json: KeyringJson): SingleAddress => {
add: (store: KeyringStore, address: string, json: KeyringJson, type?: KeypairType): SingleAddress => {
current = { ...current };
current[address] = {
json: { ...json, address },
option: createOptionItem(address, json.meta.name)
option: createOptionItem(address, json.meta.name),
type
};
// we do not store dev accounts, injected or hardware (the latter two are external/transient)
if (!json.meta.isInjected && !json.meta.isHardware && (!json.meta.isTesting || development.isDevelopment())) {
if (!json.meta.isInjected && !json.meta.isHardware && (!json.meta.isTesting || env.isDevelopment())) {
store.set(keyCreator(address), json);
}
+7 -7
View File
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { SubjectInfo } from './types';
import type { SubjectInfo } from './types';
import { combineLatest } from 'rxjs';
import { map } from 'rxjs/operators';
import { combineLatest } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import accounts from './accounts';
import addresses from './addresses';
import contracts from './contracts';
import { accounts } from './accounts';
import { addresses } from './addresses';
import { contracts } from './contracts';
interface Result {
accounts: SubjectInfo;
@@ -16,7 +16,7 @@ interface Result {
contracts: SubjectInfo;
}
export default combineLatest(
export const obervableAll = combineLatest(
accounts.subject,
addresses.subject,
contracts.subject
+6 -4
View File
@@ -1,13 +1,15 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BehaviorSubject } from 'rxjs';
import { KeyringSectionOption } from '../options/types';
import { KeyringJson, KeyringStore } from '../types';
import type { KeypairType } from '@polkadot/util-crypto/types';
import type { BehaviorSubject } from '@polkadot/x-rxjs';
import type { KeyringSectionOption } from '../options/types';
import type { KeyringJson, KeyringStore } from '../types';
export interface SingleAddress {
json: KeyringJson;
option: KeyringSectionOption;
type?: KeypairType;
}
export interface SubjectInfo {
@@ -15,7 +17,7 @@ export interface SubjectInfo {
}
export interface AddressSubject {
add: (store: KeyringStore, address: string, json: KeyringJson) => SingleAddress;
add: (store: KeyringStore, address: string, json: KeyringJson, type?: KeypairType) => SingleAddress;
remove: (store: KeyringStore, address: string) => void;
subject: BehaviorSubject<SubjectInfo>;
}
@@ -1,19 +1,22 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeyringStruct } from '../types';
import keyringOptionInstance from '.';
import type { KeyringStruct } from '../types';
import { KeyringOption } from '.';
const keyringOption = new KeyringOption();
describe('KeyringOption', (): void => {
it('should not allow initOptions to be called more than once', (): void => {
const state: Partial<KeyringStruct> = {};
// first call
keyringOptionInstance.init(state as KeyringStruct);
keyringOption.init(state as KeyringStruct);
// second call
expect((): void => {
keyringOptionInstance.init(state as KeyringStruct);
keyringOption.init(state as KeyringStruct);
}).toThrowError('Unable to initialise options more than once');
});
});
+7 -11
View File
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeyringStruct } from '../types';
import { SingleAddress } from '../observable/types';
import { KeyringOptions, KeyringOptionInstance, KeyringSectionOption, KeyringSectionOptions } from './types';
import type { SingleAddress } from '../observable/types';
import type { KeyringStruct } from '../types';
import type { KeyringOptionInstance, KeyringOptions, KeyringSectionOption, KeyringSectionOptions } from './types';
import { BehaviorSubject } from 'rxjs';
import { assert } from '@polkadot/util';
import { BehaviorSubject } from '@polkadot/x-rxjs';
import observableAll from '../observable';
import { obervableAll } from '../observable';
let hasCalledInitOptions = false;
@@ -34,7 +34,7 @@ const sortByCreated = (a: SingleAddress, b: SingleAddress): number => {
return 0;
};
class KeyringOption implements KeyringOptionInstance {
export class KeyringOption implements KeyringOptionInstance {
public readonly optionsSubject: BehaviorSubject<KeyringOptions> = new BehaviorSubject(this.emptyOptions());
public createOptionHeader (name: string): KeyringSectionOption {
@@ -48,7 +48,7 @@ class KeyringOption implements KeyringOptionInstance {
public init (keyring: KeyringStruct): void {
assert(!hasCalledInitOptions, 'Unable to initialise options more than once');
observableAll.subscribe((): void => {
obervableAll.subscribe((): void => {
const opts = this.emptyOptions();
this.addAccounts(keyring, opts);
@@ -138,7 +138,3 @@ class KeyringOption implements KeyringOptionInstance {
};
}
}
const keyringOptionInstance = new KeyringOption();
export default keyringOptionInstance;
+2 -2
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeyringSectionOption } from './types';
import type { KeyringSectionOption } from './types';
import { isUndefined } from '@polkadot/util';
export default function createItem (address: string, _name?: string): KeyringSectionOption {
export function createOptionItem (address: string, _name?: string): KeyringSectionOption {
const name = isUndefined(_name)
? (
(address.length > 15)
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeyringItemType, KeyringStruct } from '../types';
import type { KeyringItemType, KeyringStruct } from '../types';
export interface KeyringSectionOption {
key: string | null;
+2 -2
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeyringStore, KeyringJson } from '../types';
import type { KeyringJson, KeyringStore } from '../types';
import store from 'store';
export default class BrowserStore implements KeyringStore {
export class BrowserStore implements KeyringStore {
public all (cb: (key: string, value: KeyringJson) => void): void {
store.each((value: KeyringJson, key: string): void => {
cb(key, value);
+3 -2
View File
@@ -1,15 +1,16 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { KeyringStore, KeyringJson } from '../types';
import type { KeyringJson, KeyringStore } from '../types';
import fs from 'fs';
import mkdirp from 'mkdirp';
import path from 'path';
import { assert } from '@polkadot/util';
// NOTE untested and unused by any known apps, probably broken in various mysterious ways
export default class FileStore implements KeyringStore {
export class FileStore implements KeyringStore {
#path: string;
constructor (path: string) {
+2 -2
View File
@@ -1,5 +1,5 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { default as BrowserStore } from './Browser';
export { default as FileStore } from './File';
export { BrowserStore } from './Browser';
export { FileStore } from './File';
+4 -4
View File
@@ -1,10 +1,10 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Hash } from '@polkadot/types/interfaces';
import { KeyringInstance as BaseKeyringInstance, KeyringPair, KeyringPair$Meta, KeyringPair$Json, KeyringOptions as KeyringOptionsBase } from '@polkadot/keyring/types';
import { KeypairType } from '@polkadot/util-crypto/types';
import { AddressSubject, SingleAddress } from './observable/types';
import type { KeyringInstance as BaseKeyringInstance, KeyringOptions as KeyringOptionsBase, KeyringPair, KeyringPair$Json, KeyringPair$Meta } from '@polkadot/keyring/types';
import type { Hash } from '@polkadot/types/interfaces';
import type { KeypairType } from '@polkadot/util-crypto/types';
import type { AddressSubject, SingleAddress } from './observable/types';
export interface ContractMeta {
abi: string;
+7 -6
View File
@@ -1,23 +1,24 @@
{
"name": "@polkadot/ui-settings",
"version": "0.60.1",
"version": "0.63.1",
"description": "Manages app settings",
"main": "index.js",
"sideEffects": false,
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"maintainers": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.11.2",
"@babel/runtime": "^7.12.5",
"@polkadot/networks": "^5.0.1",
"@polkadot/util": "^5.0.1",
"eventemitter3": "^4.0.7",
"store": "^2.0.12"
},
"devDependencies": {
"@polkadot/util": "^3.5.1",
"@types/store": "^2.0.2"
},
"peerDependencies": {
"@polkadot/networks": "*",
"@polkadot/util": "*"
}
}
+5 -5
View File
@@ -1,12 +1,14 @@
// Copyright 2017-2020 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Option, SettingsStruct } from './types';
import EventEmitter from 'eventemitter3';
import store from 'store';
import { isUndefined } from '@polkadot/util';
import { CAMERA_DEFAULT, CAMERA, CRYPTOS, CRYPTOS_ETH, ENDPOINT_DEFAULT, ENDPOINTS, ICON_DEFAULT, ICONS, LANGUAGE_DEFAULT, LEDGER_CONN, LEDGER_CONN_DEFAULT, LOCKING_DEFAULT, LOCKING, PREFIX_DEFAULT, PREFIXES, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from './defaults';
import { Option, SettingsStruct } from './types';
import { CAMERA, CAMERA_DEFAULT, CRYPTOS, CRYPTOS_ETH, ENDPOINT_DEFAULT, ENDPOINTS, ICON_DEFAULT, ICONS, LANGUAGE_DEFAULT, LEDGER_CONN, LEDGER_CONN_DEFAULT, LOCKING, LOCKING_DEFAULT, PREFIX_DEFAULT, PREFIXES, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from './defaults';
type ChangeCallback = (settings: SettingsStruct) => void;
type OnTypes = 'change';
@@ -168,6 +170,4 @@ export class Settings implements SettingsStruct {
}
}
const settings = new Settings();
export default settings;
export const settings = new Settings();
+6 -11
View File
@@ -1,17 +1,12 @@
// Copyright 2017-2020 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
import known from '@polkadot/networks';
type ChainDef = string[];
const chains: Record<string, ChainDef> = {
kusama: [
'0x3fd7b9eb6a00376e5be61f01abb429ffb0b104be05eaff4d458da48fcd425baf', // Kusama CC1
'0xe3777fa922cafbff200cadeaea1a76bd7898ad5b89f7848999058b50e715f636', // Kusama CC2
'0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe' // Kusama CC3
],
polkadot: [
'0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3' // Polkadot CC1
]
};
const chains: Record <string, ChainDef> = known
.filter(({ genesisHash }) => genesisHash.length > 1)
.reduce((chains, { genesisHash, network }) => ({ ...chains, [network]: genesisHash }), {});
export default chains;
export { chains };
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Option } from '../types';
import type { Option } from '../types';
export const CRYPTOS: Option[] = [
{

Some files were not shown because too many files have changed in this diff Show More