Compare commits

..
28 Commits
Author SHA1 Message Date
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
40 changed files with 2073 additions and 1906 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
+10
View File
@@ -5,6 +5,16 @@ const base = require('@polkadot/dev/config/eslint');
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"
]
}
-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 -1
View File
@@ -12,4 +12,4 @@ plugins:
- 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.3.3.cjs
+24
View File
@@ -1,5 +1,29 @@
# CHANGELOG
## 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:
-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>
+1 -1
View File
@@ -11,5 +11,5 @@ module.exports = Object.assign({}, config, {
'\\.(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'
});
-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);
};
+12 -14
View File
@@ -8,8 +8,7 @@
"packages/*"
],
"resolutions": {
"babel-core": "^7.0.0-bridge.0",
"typescript": "^4.0.3"
"typescript": "^4.0.5"
},
"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.3",
"@babel/runtime": "^7.12.5",
"@polkadot/dev": "^0.59.20",
"@polkadot/ts": "^0.3.53",
"@types/jest": "^26.0.15",
"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": "^17.0.1",
"react-dom": "^17.0.1",
"react-is": "^17.0.1",
"react-native": "^0.63.3",
"typedoc": "^0.19.2",
"typedoc-plugin-markdown": "^3.0.7",
"typedoc-plugin-no-inherit": "^1.2.0",
"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.62.1"
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/example-react",
"version": "0.60.1",
"version": "0.62.1",
"description": "A very basic example with ui-* & react-* packages",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -9,6 +9,6 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.11.2"
"@babel/runtime": "^7.12.5"
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/example-vue",
"version": "0.60.1",
"version": "0.62.1",
"description": "A very basic example with ui-* & vue-* packages",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -9,6 +9,6 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.11.2"
"@babel/runtime": "^7.12.5"
}
}
+14 -19
View File
@@ -1,6 +1,6 @@
{
"name": "exampleReactNative",
"version": "0.60.1",
"version": "0.62.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": "^4.0.1",
"@polkadot/reactnative-identicon": "0.62.1",
"@polkadot/ui-keyring": "0.62.1",
"@polkadot/ui-settings": "0.62.1",
"@polkadot/util": "^4.0.1",
"@polkadot/util-crypto": "^4.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": "^17.0.1",
"react-native": "^0.63.3",
"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.3",
"@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": "*"
"babel-jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.64.0",
"react-test-renderer": "17.0.1"
},
"jest": {
"preset": "react-native",
+14 -12
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/react-identicon",
"version": "0.60.1",
"version": "0.62.1",
"description": "Renders an SVG picture representing an address",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -9,12 +9,17 @@
],
"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": "^4.0.1",
"@polkadot/ui-settings": "0.62.1",
"@polkadot/ui-shared": "0.62.1",
"@polkadot/util": "^4.0.1",
"@polkadot/util-crypto": "^4.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 +31,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": "^16.9.9",
"@types/styled-components": "^5.1.4",
"styled-components": "^5.2.1",
"xmlserializer": "^0.6.1"
}
}
+12 -3
View File
@@ -9,9 +9,9 @@ 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 { decodeAddress, encodeAddress, ethereumEncode } from '@polkadot/util-crypto';
import { Beachball, Empty, Jdenticon, Polkadot } from './icons';
import { Beachball, Empty, Ethereum, Jdenticon, Polkadot } from './icons';
const Fallback = Beachball;
@@ -24,6 +24,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 +68,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)
@@ -0,0 +1,29 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Props } from '../types';
import makeBlockie from 'ethereum-blockies-base64';
import React, { useMemo } from 'react';
import styled from 'styled-components';
function Ethereum ({ address, className = '', style }: Props): React.ReactElement<Props> {
const imgSrc = useMemo(
() => makeBlockie(address),
[address]
);
return (
<img
className={className}
src={imgSrc}
style={style}
/>
);
}
export default React.memo(styled(Ethereum)(({ size }: Props) => `
display: block;
height: ${size}px;
width: ${size}px;
`));
@@ -3,5 +3,6 @@
export { default as Beachball } from './Beachball';
export { default as Empty } from './Empty';
export { default as Ethereum } from './Ethereum';
export { default as Jdenticon } from './Jdenticon';
export { default as Polkadot } from './Polkadot';
+1 -1
View File
@@ -25,6 +25,6 @@ export interface IdentityProps extends BaseProps {
onCopy?: (value: string) => void;
prefix?: Prefix;
size?: number;
theme?: 'beachball' | 'empty' | 'jdenticon' | 'polkadot' | 'substrate';
theme?: 'beachball' | 'empty' | 'ethereum' | 'jdenticon' | 'polkadot' | 'substrate';
value?: string | Uint8Array | null;
}
+7 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/react-qr",
"version": "0.60.1",
"version": "0.62.1",
"description": "Generates and reads QR codes",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -9,13 +9,16 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.11.2",
"@babel/runtime": "^7.12.5",
"@polkadot/util": "^4.0.1",
"@polkadot/util-crypto": "^4.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.4"
},
"peerDependencies": {
"@polkadot/util": "*",
+7 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/reactnative-identicon",
"version": "0.60.1",
"version": "0.62.1",
"description": "Renders an SVG picture representing an address",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -9,17 +9,19 @@
],
"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.62.1",
"@polkadot/util": "^4.0.1",
"@polkadot/util-crypto": "^4.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.32"
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/ui-assets",
"version": "0.60.1",
"version": "0.62.1",
"description": "Static assets shared accross projects",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -9,6 +9,6 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.11.2"
"@babel/runtime": "^7.12.5"
}
}
+8 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/ui-keyring",
"version": "0.60.1",
"version": "0.62.1",
"main": "index.js",
"repository": "https://github.com/polkadot-js/apps.git",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -17,24 +17,25 @@
"./ledger/transportsWeb": "./ledger/transportsEmpty"
},
"dependencies": {
"@babel/runtime": "^7.11.2",
"@ledgerhq/hw-transport-webusb": "^5.25.0",
"@babel/runtime": "^7.12.5",
"@ledgerhq/hw-transport-webusb": "^5.28.0",
"@polkadot/keyring": "^4.0.1",
"@polkadot/ui-settings": "0.62.1",
"@polkadot/util": "^4.0.1",
"@zondax/ledger-polkadot": "^0.11.0",
"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",
"@polkadot/types": "^2.6.1",
"@types/ledgerhq__hw-transport-node-hid": "^4.22.2",
"@types/ledgerhq__hw-transport-webusb": "^4.70.1",
"@types/mkdirp": "^1.0.1",
"@types/store": "^2.0.2"
},
"optionalDependencies": {
"@ledgerhq/hw-transport-node-hid": "^5.25.0"
"@ledgerhq/hw-transport-node-hid": "^5.28.0"
},
"peerDependencies": {
"@polkadot/keyring": "*",
+11 -6
View File
@@ -195,12 +195,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);
+41 -41
View File
@@ -46,7 +46,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 +92,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 +104,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))
};
});
}
};
}
+5 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/ui-settings",
"version": "0.60.1",
"version": "0.62.1",
"description": "Manages app settings",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -9,15 +9,17 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.11.2",
"@babel/runtime": "^7.12.5",
"@polkadot/networks": "^4.0.1",
"@polkadot/util": "^4.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 -10
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;
+14 -39
View File
@@ -2,45 +2,20 @@
// SPDX-License-Identifier: Apache-2.0
import { Option } from '../types';
import { available } from '@polkadot/networks';
export const PREFIX_DEFAULT = -1;
export const PREFIXES: Option[] = [
{
info: 'default',
text: 'Default for the connected node',
value: -1
},
// keep as first (well, after default)
{
info: 'substrate',
text: 'Substrate (generic)',
value: 42
},
// all in ascending order based on value
{
info: 'polkadot',
text: 'Polkadot (live)',
value: 0
},
{
info: 'kusama',
text: 'Kusama (canary)',
value: 2
},
{
info: 'edgeware',
text: 'Edgeware (live)',
value: 7
},
{
info: 'kulupu',
text: 'Kulupu (live)',
value: 16
},
{
info: 'subsocial',
text: 'Subsocial (live)',
value: 28
}
];
const defaultNetwork: Option = {
info: 'default',
text: 'Default for the connected node',
value: -1
};
const networks = available.map(({ displayName, network, prefix }) => ({
info: network,
text: displayName,
value: prefix
}));
export const PREFIXES: Option[] = [defaultNetwork, ...networks];
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/ui-shared",
"version": "0.60.1",
"version": "0.62.1",
"description": "Shared logic that is usable accross all frameworks-specific areas",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -9,16 +9,16 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.11.2",
"color": "^3.1.2"
"@babel/runtime": "^7.12.5",
"color": "^3.1.3"
},
"peerDependencies": {
"@polkadot/util": "*",
"@polkadot/util-crypto": "*"
},
"devDependencies": {
"@polkadot/util": "^3.5.1",
"@polkadot/util-crypto": "^3.5.1",
"@polkadot/util": "^4.0.1",
"@polkadot/util-crypto": "^4.0.1",
"@types/color": "^3.0.1",
"@types/xmlserializer": "^0.6.1"
}
+6 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/vue-identicon",
"version": "0.60.1",
"version": "0.62.1",
"description": "Renders an SVG picture representing an address",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
@@ -9,16 +9,18 @@
"main": "index.js",
"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.62.1",
"@polkadot/util": "^4.0.1",
"@polkadot/util-crypto": "^4.0.1",
"jdenticon": "2.2.0"
},
"peerDependencies": {
"@polkadot/util": "*",
"@polkadot/util-crypto": "*",
"vue": "*"
},
"devDependencies": {
"@polkadot/util-crypto": "^3.5.1",
"vue": "^2.6.12"
}
}
-18
View File
@@ -1,18 +0,0 @@
// Copyright 2017-2020 @polkadot/ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = {
exclude: '**/*+(index|e2e|spec).ts',
excludeExternals: true,
excludeNotExported: true,
excludePrivate: true,
excludeProtected: true,
hideGenerator: true,
includeDeclarations: false,
module: 'commonjs',
moduleResolution: 'node',
name: 'Polkadot JS UI libraries',
out: 'docs',
stripInternal: 'true',
theme: 'markdown'
};
+1757 -1575
View File
File diff suppressed because it is too large Load Diff