Compare commits

...
34 Commits
Author SHA1 Message Date
Github Actions 95a1a4f9a2 [CI Skip] release/stable 0.54.1
skip-checks: true
2020-06-16 07:06:08 +00:00
Jaco Greeff e142284713 0.54 (#331)
* 0.54

* 0.54
2020-06-16 09:01:20 +02:00
Github Actions be246413fa [CI Skip] release/beta 0.54.0-beta.7
skip-checks: true
2020-06-12 21:00:11 +00:00
Hanwen Cheng c7bf1d2ec9 allow qr to scan seed qr (#330)
* allow qr to scan seed qr

* simplify flow

* use original orders

* remove trailing spaces
2020-06-12 22:54:40 +02:00
Github Actions 48327feb34 [CI Skip] release/beta 0.54.0-beta.6
skip-checks: true
2020-06-05 20:35:31 +00:00
Jaco Greeff afa6950f0c Rewrite yarn (#329) 2020-06-05 22:30:09 +02:00
Github Actions 2adedba064 [CI Skip] release/beta 0.54.0-beta.5
skip-checks: true
2020-06-05 20:24:11 +00:00
Jaco Greeff 2309998889 Bump deps (#328) 2020-06-05 22:19:38 +02:00
Github Actions a8f906a15e [CI Skip] 0.54.0-beta.4
skip-checks: true
2020-05-30 07:08:00 +00:00
Jaco Greeff 990d4394af Rename Substrate entry to "generic" (#327)
* Rename Substrate entry to "generic"

* Rewrite yarn.lock

* Linting (base package update)
2020-05-30 09:03:08 +02:00
Github Actions 66f65052f6 [CI Skip] 0.54.0-beta.3
skip-checks: true
2020-05-27 15:53:51 +00:00
Jaco GreeffandHanwen Cheng 9252de79d4 Add genesisHash to signer payload (#323)
* Add genesisHash to signer payload

* fix order and add tests (#324)

* fix order and add tests

* Update packages/react-qr/src/util.spec.ts

* Update packages/react-qr/src/util.spec.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Apply suggestions from code review

Co-authored-by: Hanwen Cheng <heawen.cheng@gmail.com>
2020-05-27 17:48:32 +02:00
Github Actions a31ef816bd [CI Skip] 0.54.0-beta.2
skip-checks: true
2020-05-24 07:40:05 +00:00
Jaco Greeff 2df46e88ce Bump deps w/ eslint (#322)
* Bump deps w/ eslint

* theme default
2020-05-24 09:35:43 +02:00
Github Actions 050d1966c6 [CI Skip] 0.54.0-beta.1
skip-checks: true
2020-05-19 10:22:31 +00:00
Jaco Greeff b38301efae Ordering for crypto types (#321) 2020-05-19 12:18:06 +02:00
Github Actions 90aa4bad13 [CI Skip] 0.54.0-beta.0
skip-checks: true
2020-05-15 11:02:52 +00:00
Jaco Greeff b6909b132a Bump deps (#320) 2020-05-15 12:57:38 +02:00
Github Actions 47dede29c3 [CI Skip] 0.53.1
skip-checks: true
2020-05-14 14:51:40 +00:00
Jaco Greeff be5ee1a71b 0.53 (#319) 2020-05-14 16:47:09 +02:00
Github Actions 2b1d612528 [CI Skip] 0.53.0-beta.6
skip-checks: true
2020-05-14 09:55:18 +00:00
Alexander Krupenkin 82315bd349 Added ECDSA crypto type (#313) 2020-05-14 11:50:25 +02:00
Github Actions 0fa2fe3b32 [CI Skip] 0.53.0-beta.5
skip-checks: true
2020-05-14 06:08:42 +00:00
Jaco Greeff a60d8fa005 Bump deps (#318)
* Bump deps

* @polkadot/util bump
2020-05-14 08:04:12 +02:00
Github Actions e5b53991f2 [CI Skip] 0.53.0-beta.4
skip-checks: true
2020-05-12 15:37:19 +00:00
Jake Naviasky 8d39fabad7 Add Edgeware chain prefix to settings. (#317) 2020-05-12 17:31:59 +02:00
Github Actions ee6efc5bf8 [CI Skip] 0.53.0-beta.3
skip-checks: true
2020-05-11 09:47:22 +00:00
Jaco Greeff 435a9b3cd4 Bump deps (#316)
* Bump deps

* Remove unused deps

* Bump berry

* Bump berry
2020-05-11 11:43:05 +02:00
Github Actions e84758440f [CI Skip] 0.53.0-beta.2
skip-checks: true
2020-05-06 09:19:02 +00:00
Jaco Greeff e320d943a6 Bump deps (#315) 2020-05-06 11:14:20 +02:00
Github Actions 9b0de9f9fb [CI Skip] 0.53.0-beta.1
skip-checks: true
2020-04-24 17:54:57 +00:00
Jaco Greeff dd55faec48 Sort who on multisig (#312) 2020-04-24 19:50:09 +02:00
Github Actions c32343671a [CI Skip] 0.53.0-beta.0
skip-checks: true
2020-04-24 16:06:56 +00:00
Jaco Greeff e88351e994 addMultisig for ui-keyring (#311)
* addMultisig for ui-keyring

* Bumps

* Spelling.
2020-04-24 18:02:13 +02:00
47 changed files with 5637 additions and 4713 deletions
+1
View File
@@ -1,3 +1,4 @@
.eslintrc.js
**/build/*
**/coverage/*
**/node_modules/*
+2 -5
View File
@@ -10,7 +10,7 @@ jobs:
matrix:
step: ['build:release', 'docs:release']
name: ${{ matrix.step }}
if: "! contains(github.event.head_commit.message, '[CI Skip]') && github.repository == 'polkadot-js/ui'"
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && github.repository == 'polkadot-js/ui'"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
@@ -21,16 +21,13 @@ jobs:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
GH_PAGES_SRC: build-docs
GH_PAT: ${{ secrets.GH_PAT }}
GH_TOKEN: ${{ secrets.GH_PAT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
yarn install --immutable | grep -v 'YN0013'
yarn ${{ matrix.step }}
dummy:
name: Dummy
if: "contains(github.event.head_commit.message, '[CI Skip]')"
runs-on: ubuntu-latest
steps:
- name: dummy
+14 -8
View File
File diff suppressed because one or more lines are too long
+50 -31
View File
@@ -1,4 +1,23 @@
# 0.52.1 Apr 15, 2020
# CHANGELOG
## 0.54.1 Jun 16, 2020
- Add genesisHash to signer payload (Thanks to https://github.com/hanwencheng)
- Allow QR scanning to parse mini keys (Thanks to https://github.com/hanwencheng)
- Adjust ordering of available crypto types (native first)
- Rename Substrate prefix entry (42) to "generic"
- Bump to `@polkadot/api` 1.19.1
- Bump to `@polkadot/util` 2.14.1
## 0.53.1 May 14, 2020
- Add Ecdsa to the supported crypto types options (Thanks to https://github.com/akru)
- Add Egedware to network prefix settings (Thanks to https://github.com/jnaviask)
- Add `addMultisig` into keyring (with all options to re-create address)
- Bump to `@polkadot/api` 1.14.1
- Bump to `@polkadot/util` 2.10.1
## 0.52.1 Apr 15, 2020
- **Breaking change** (TypeScript only) The `*.d.ts` files now contain TypeScript 3.8 features, `#private`, which is not usable in older versions
- Allow for the encoding of chain-settings via QR (Thanks to https://github.com/hanwencheng)
@@ -8,43 +27,43 @@
- Convert `private <field>` to `#<field>`
- Remove internal/duplicated ui-keyring ss58Format mapping, rather set it directly on wrapped keyring
# 0.51.1 Feb 18, 2020
## 0.51.1 Feb 18, 2020
- Support formatting of addresses via createPair base on latest upstream keyring
- Bump to `@polkadot/api` 1.3.1
- Bump to `@polkadot/util` 2.4.1
# 0.50.1 Feb 16, 2020
## 0.50.1 Feb 16, 2020
- ui-settings does not expose pre-configured endpoints by default (only local dev node)
- Bump to `@polkadot/api` 1.2.1
- Bump to `@polkadot/util` 2.3.1
# 0.49.1 Feb 06, 2020
## 0.49.1 Feb 06, 2020
- Add resolver for jest requires (tests from src)
# 0.48.1 Jan 30, 2020
## 0.48.1 Jan 30, 2020
- Add Westend & Kulupulu, remove Alexander
- Update Edgeware wss uri
- Change display name for Kusama
- Mirror QR scanning display
# 0.47.1 Nov 29, 2019
## 0.47.1 Nov 29, 2019
- Support for Kusama CC3 (network endpoints)
- Genesis hashes for accounts can now lookup against a range (so CC2-locked accounts will show on CC3)
- Language options have been removed from settings (these will be app-specific)
- QR display loops now have a timeout decay (slower as it loops)
# 0.46.1 Oct 25, 2019
## 0.46.1 Oct 25, 2019
- Add an example for using React Native (thanks to https://github.com/cameronfr)
- Add base documentation for getting started
- Add camera access to the setting structure
# 0.45.1 Sep 26, 2019
## 0.45.1 Sep 26, 2019
- Support for Kusama CC2
- **Breaking change** The subscription subject for `ui-keyring` does not return a pre-formatted React object anymore. This is SUI-specific, so had limited use and therefore should not even be split into a `react-keyring` component. Rather users of this functionality should construct their own options for their framework.
@@ -54,12 +73,12 @@
- Adjust `react-identicon` highlights (validators)
- Add `example-{react, vue}` highlighting simple use with `ui-keyring`, `ui-settings` & `*-identicon` components
# 0.44.1 Sep 12, 2019
## 0.44.1 Sep 12, 2019
- Update `@polkadot/util` to 1.4.1
- Upddate to Babel 7.6
# 0.43.1 Sep 10, 2019
## 0.43.1 Sep 10, 2019
- Add W3F Node for Kusama
- Add extended info to ui-settings, i.e. info on each option
@@ -67,7 +86,7 @@
- ui-keyring now check the genesisHash on all load operations (if supplied)
- react-qr is now operational and integrated in the polkadot-js/extension and apps repos
# 0.42.1 Aug 24, 2019
## 0.42.1 Aug 24, 2019
- **Breaking Change** The `@polkadot/ui-identicon` package has been renamed to `@polkadot/react-identicon`
- **Breaking change** For `@polkadot/ui-keyring` the stores are now not exported from the index, imports should be changed to either `ui-keyring/stores` or explicitly to `ui-keyring/stores/Extension`
@@ -77,7 +96,7 @@
- `@polkadot/ui-settings` has UNfrastructure added as an RPC provider for Alex
- `@polkadot/ui-settings` exposes a dropdown with address prefix options
# 0.41.1 Jun 14, 2019
## 0.41.1 Jun 14, 2019
- Adapt interface to cater for new `@polkadot/keyring`, where pairs -
- expose `address` getter instead of `address()`
@@ -89,16 +108,16 @@
- Remove previously deprecated kering functions, `createAccount`, `createAccountExternal` & `createAccountMnemonic`
- Remove (previously deprecated), `@polkadot/ui-util`, all these functions have been incorporated in `@polkadot/util`
# 0.40.1 Jun 04, 2019
## 0.40.1 Jun 04, 2019
- Address encoding changes, use encoded address instead of supplied
# 0.39.1 May 22, 2019
## 0.39.1 May 22, 2019
- Allow for externally injected accounts
- @polkadot/util 0.91.1 & @polkadot/api 0.79.1
# 0.38.1 May 08, 2019
## 0.38.1 May 08, 2019
- Sorting of keyring addresses
- Fix JSON import defaults (previously detection was not working for old accounts)
@@ -106,70 +125,70 @@
- Ensure only a single instance of ui-keyring is loaded
- Adjust short address option display (keyring options)
# 0.37.1 Apr 03, 2019
## 0.37.1 Apr 03, 2019
- Add Emberic Elm (Dried Danta discontinued)
- @polkadot/util & @polkadot/api 0.75.1
# 0.36.1 Mar 29, 2019
## 0.36.1 Mar 29, 2019
- Small fixes, latest @polkadot/wasm-* packages
# 0.35.1 Mar 29, 2019
## 0.35.1 Mar 29, 2019
- @polkadot/util & @polkadot/api 0.75.1
# 0.34.1 Mar 28, 2019
## 0.34.1 Mar 28, 2019
- Fix for blake2 in Polkadot identicon generation
# 0.33.1 Mar 23, 2019
## 0.33.1 Mar 23, 2019
- Rename createUri and createExternal to addExternal and addUri
- Rename addAccountPair to addPair
- Add additional createFromUri function to create pair, but not add it
- Latest api, util & util-crypto (this with WASM and JS fallbacks)
# 0.32.1 Mar 20, 2019
## 0.32.1 Mar 20, 2019
- Add createUri to create an account from a path uri
- Add createExternal as an alias for createAccountExternal
- Deprecate createAccount, createAccountExternal and createAccountMnemonic
- Fix styled-component dependencies when used in a non-@polkadot project
# 0.31.1 Mar 18, 2019
## 0.31.1 Mar 18, 2019
- Allow for latest keyring with sr25519 derived support
- When using dev mode, it assumes the substrate node has sr25519 derived keys
# 0.30.1 Mar 14, 2019
## 0.30.1 Mar 14, 2019
- Swap to publishing -beta.x on merge (non-breaking testing)
# 0.29.1 Mar 13, 2019
## 0.29.1 Mar 13, 2019
Swap to using a dev HDKD keyring (only available on latest substrate master, only affects nodes running with --dev, normal operation unaffected)
# 0.28.1 Feb 21, 2019
## 0.28.1 Feb 21, 2019
Default Substrate icon is Jdenticon
# 0.27.1 Feb 20, 2019
## 0.27.1 Feb 20, 2019
Replace Charred Cherry with Dried Danta, remove old decimals and token name configs
# 0.26.1 Feb 14, 2019
## 0.26.1 Feb 14, 2019
Add keyring support for sd25519 (schnorrkel)
# 0.25.1 Jan 09, 2019
## 0.25.1 Jan 09, 2019
Add `@polkadot/{keyring,util,util-crypto,types}` as peerDependencies for the various packages as used. Thie should allow less churn on this repo with version bumps, although it does add some extra effort onto the users of these libraries. (But the assumption is that they use these anyway)
# 0.24.1 Dec 19, 2018
## 0.24.1 Dec 19, 2018
# 0.23.1 Dec 14, 2018
## 0.23.1 Dec 14, 2018
# 0.22.1 Dec 05, 2018
## 0.22.1 Dec 05, 2018
- Split from apps
+1 -1
View File
@@ -10,5 +10,5 @@
"packages": [
"packages/*"
],
"version": "0.52.1"
"version": "0.54.1"
}
+9 -9
View File
@@ -8,8 +8,7 @@
"packages/*"
],
"resolutions": {
"babel-core": "^7.0.0-bridge.0",
"typescript": "^3.8.3"
"babel-core": "^7.0.0-bridge.0"
},
"scripts": {
"build": "polkadot-dev-build-ts",
@@ -30,18 +29,19 @@
"test:one": "polkadot-dev-run-test"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/runtime": "^7.9.2",
"@polkadot/dev": "^0.52.9",
"@polkadot/ts": "^0.3.18",
"@types/jest": "^25.2.1",
"@babel/core": "^7.10.2",
"@babel/runtime": "^7.10.2",
"@polkadot/dev": "^0.55.10",
"@polkadot/ts": "^0.3.26",
"@types/jest": "^26.0.0",
"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.62.1",
"react-native": "^0.62.2",
"vue-template-compiler": "^2.6.11",
"webpack-serve": "^3.2.0"
}
},
"version": "0.54.1"
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/example-react",
"version": "0.52.1",
"version": "0.54.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.9.2"
"@babel/runtime": "^7.10.2"
}
}
+6 -4
View File
@@ -113,7 +113,9 @@ function App ({ className }: Props): React.ReactElement<Props> | null {
);
}
cryptoWaitReady().then((): void => {
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
ReactDOM.render(<App />, rootElement);
});
cryptoWaitReady()
.then((): void => {
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
ReactDOM.render(<App />, rootElement);
})
.catch(console.error);
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/example-vue",
"version": "0.52.1",
"version": "0.54.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.9.2"
"@babel/runtime": "^7.10.2"
}
}
+8 -6
View File
@@ -88,10 +88,12 @@ const Example = Vue.extend({
}
});
cryptoWaitReady().then((): void => {
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
cryptoWaitReady()
.then((): void => {
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
new Vue({
render: (h): VNode => h(Example)
}).$mount('#example');
});
new Vue({
render: (h): VNode => h(Example)
}).$mount('#example');
})
.catch(console.error);
+8 -1
View File
@@ -12,6 +12,7 @@ import { mnemonicGenerate, cryptoWaitReady } from '@polkadot/util-crypto';
const styles = StyleSheet.create({
body: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
backgroundColor: Colors.white
},
buttonContainer: {
@@ -20,11 +21,13 @@ const styles = StyleSheet.create({
flexDirection: 'column'
},
mainTitle: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
color: Colors.black,
fontSize: 28,
fontWeight: '600'
},
scrollView: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
backgroundColor: Colors.lighter
},
sectionContainer: {
@@ -32,12 +35,14 @@ const styles = StyleSheet.create({
paddingHorizontal: 24
},
sectionDescription: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
color: Colors.dark,
fontSize: 18,
fontWeight: '400',
marginTop: 8
},
sectionTitle: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
color: Colors.black,
fontSize: 24,
fontWeight: '600'
@@ -46,7 +51,7 @@ const styles = StyleSheet.create({
const globalAny = global as unknown as Window;
export default function App (): React.ReactElement<{}> | null {
export default function App (): React.ReactElement | null {
const [isReady, setReady] = useState(false);
const [address, setAddress] = useState<string | null>(null);
const [phrase, setPhrase] = useState<string | null>(null);
@@ -80,6 +85,7 @@ export default function App (): React.ReactElement<{}> | null {
console.log('Error loading keyring ', e);
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
await globalAny.localStorage.init();
await cryptoWaitReady();
@@ -88,6 +94,7 @@ export default function App (): React.ReactElement<{}> | null {
};
if (!isReady) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
initialize();
}
+15 -15
View File
@@ -1,6 +1,6 @@
{
"name": "exampleReactNative",
"version": "0.52.1",
"version": "0.54.1",
"private": true,
"workspaces": {
"nohoist": [
@@ -23,29 +23,29 @@
"test": "jest"
},
"dependencies": {
"@polkadot/reactnative-identicon": "0.52.1",
"@polkadot/ui-keyring": "0.52.1",
"@polkadot/ui-settings": "0.52.1",
"@react-native-community/async-storage": "^1.9.0",
"fast-text-encoding": "^1.0.1",
"@polkadot/reactnative-identicon": "0.54.1",
"@polkadot/ui-keyring": "0.54.1",
"@polkadot/ui-settings": "0.54.1",
"@react-native-community/async-storage": "^1.11.0",
"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.62.1",
"react-native": "^0.62.2",
"react-native-crypto": "^2.2.0",
"react-native-randombytes": "^3.5.3",
"stream-http": "^3.1.0"
"stream-http": "^3.1.1"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/runtime": "^7.9.2",
"@polkadot/keyring": "^2.8.1",
"@polkadot/util": "^2.8.1",
"@polkadot/util-crypto": "^2.8.1",
"@react-native-community/cli-platform-ios": "^4.5.0",
"@babel/core": "^7.10.2",
"@babel/runtime": "^7.10.2",
"@polkadot/keyring": "^2.14.1",
"@polkadot/util": "^2.14.1",
"@polkadot/util-crypto": "^2.14.1",
"@react-native-community/cli-platform-ios": "^4.10.0",
"@types/react-test-renderer": "16.9.2",
"babel-jest": "^25.2.6",
"babel-jest": "^26.0.1",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "16.13.1"
},
+10 -10
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/react-identicon",
"version": "0.52.1",
"version": "0.54.1",
"description": "Renders an SVG picture representing an address",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -9,13 +9,13 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/ui-settings": "0.52.1",
"@polkadot/ui-shared": "0.52.1",
"@babel/runtime": "^7.10.2",
"@polkadot/ui-settings": "0.54.1",
"@polkadot/ui-shared": "0.54.1",
"color": "^3.1.2",
"jdenticon": "2.2.0",
"react-copy-to-clipboard": "^5.0.2",
"styled-components": "^5.0.1"
"styled-components": "^5.1.1"
},
"peerDependencies": {
"@polkadot/keyring": "*",
@@ -26,12 +26,12 @@
"react-is": "*"
},
"devDependencies": {
"@polkadot/keyring": "^2.8.1",
"@polkadot/util": "^2.8.1",
"@polkadot/util-crypto": "^2.8.1",
"@polkadot/keyring": "^2.14.1",
"@polkadot/util": "^2.14.1",
"@polkadot/util-crypto": "^2.14.1",
"@types/react-copy-to-clipboard": "^4.3.0",
"@types/react-dom": "^16.9.6",
"@types/styled-components": "^5.0.1",
"@types/react-dom": "^16.9.8",
"@types/styled-components": "^5.1.0",
"xmlserializer": "^0.6.1"
}
}
+1 -1
View File
@@ -117,7 +117,7 @@ class BaseIcon extends React.PureComponent<Props, State> {
return (
<Wrapper
className={`ui--IdentityIcon ${className}`}
className={`ui--IdentityIcon ${className || ''}`}
key={address}
style={style}
>
@@ -7,7 +7,7 @@ import { 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 Beachball ({ address, className = '', size, style }: Props): React.ReactElement<Props> {
const updateElem = useCallback(
(node: HTMLDivElement): void => {
node && node.appendChild(
+1 -1
View File
@@ -6,7 +6,7 @@ import { Props } from '../types';
import React from 'react';
function Empty ({ className, size, style }: Props): React.ReactElement<Props> {
function Empty ({ className = '', size, style }: Props): React.ReactElement<Props> {
return (
<div
className={`container ${className}`}
@@ -7,7 +7,7 @@ import { Props } from '../types';
import React from 'react';
import jdenticon from 'jdenticon';
function Jdenticon ({ className, publicKey, size, style }: Props): React.ReactElement<Props> {
function Jdenticon ({ className = '', publicKey, size, style }: Props): React.ReactElement<Props> {
return (
<div
className={`container ${className}`}
@@ -38,7 +38,7 @@ function renderCircle ({ cx, cy, fill, r }: Circle, key: number): React.ReactNod
);
}
function Identicon ({ address, className, isAlternative = false, size, style }: Props): React.ReactElement<Props> {
function Identicon ({ address, className = '', isAlternative = false, size, style }: Props): React.ReactElement<Props> {
return (
<div
className={`container ${className}`}
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/react-qr",
"version": "0.52.1",
"version": "0.54.1",
"description": "Generates and reads QR codes",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -9,13 +9,13 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.10.2",
"qrcode-generator": "^1.4.4",
"react-qr-reader": "^2.2.1"
},
"devDependencies": {
"@types/react-qr-reader": "^2.1.2",
"@types/styled-components": "^5.0.1"
"@types/react-qr-reader": "^2.1.3",
"@types/styled-components": "^5.1.0"
},
"peerDependencies": {
"@polkadot/util": "*",
+4 -3
View File
@@ -12,15 +12,16 @@ import QrDisplay from './Display';
interface Props extends BaseProps {
address: string;
cmd: number;
genesisHash: Uint8Array | string;
payload: Uint8Array;
}
function DisplayPayload ({ address, className, cmd, payload, size, style }: Props): React.ReactElement<Props> | null {
function DisplayPayload ({ address, className, cmd, genesisHash, payload, size, style }: Props): React.ReactElement<Props> | null {
const [data, setData] = useState<Uint8Array | null>(null);
useEffect((): void => {
setData(createSignPayload(address, cmd, payload));
}, [address, cmd, payload]);
setData(createSignPayload(address, cmd, payload, genesisHash));
}, [address, cmd, payload, genesisHash]);
if (!data) {
return null;
+14 -7
View File
@@ -8,11 +8,12 @@ import React, { useCallback } from 'react';
import { assert } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
import { ADDRESS_PREFIX } from './constants';
import { ADDRESS_PREFIX, SEED_PREFIX } from './constants';
import QrScan from './Scan';
interface ScanType {
address: string;
isAddress: boolean;
content: string;
genesisHash: string;
name?: string;
}
@@ -30,14 +31,20 @@ function ScanAddress ({ className, onError, onScan, size, style }: Props): React
}
try {
const [prefix, address, genesisHash, name] = data.split(':');
const [prefix, content, genesisHash, name] = data.split(':');
const isValidPrefix = prefix === ADDRESS_PREFIX || prefix === SEED_PREFIX;
assert(prefix === ADDRESS_PREFIX, `Invalid address received, expected '${ADDRESS_PREFIX}', found '${prefix}'`);
assert(isValidPrefix, `Invalid prefix received, expected '${ADDRESS_PREFIX}/${SEED_PREFIX}' , found '${prefix}'`);
decodeAddress(address);
onScan({ address, genesisHash, name });
const isAddress = prefix === ADDRESS_PREFIX;
if (isAddress) {
decodeAddress(content);
}
onScan({ content, genesisHash, isAddress, name });
} catch (error) {
console.error('@polkadot/react-qr:QrScanAddress', error.message, data);
console.error('@polkadot/react-qr:QrScanAddress', (error as Error).message, data);
}
},
[onScan]
+2
View File
@@ -3,6 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
const ADDRESS_PREFIX = 'substrate';
const SEED_PREFIX = 'secret';
const FRAME_SIZE = 1024;
const SUBSTRATE_ID = new Uint8Array([0x53]);
const CRYPTO_SR25519 = new Uint8Array([0x01]);
@@ -19,5 +20,6 @@ export {
CMD_SIGN_MSG,
CRYPTO_SR25519,
FRAME_SIZE,
SEED_PREFIX,
SUBSTRATE_ID
};
+1 -1
View File
@@ -9,7 +9,7 @@ const qrcode: typeof _qrcode = _qrcode;
// HACK The default function take string -> number[], the Uint8array is compatible
// with that signature and the use thereof
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access
(qrcode as any).stringToBytes = (data: Uint8Array): Uint8Array =>
data;
+6 -4
View File
@@ -64,7 +64,7 @@ describe('util', (): void => {
it('encodes a payload properly', (): void => {
expect(
u8aToHex(
createSignPayload('5HbgaJEuVN5qGbkhgtuDQANivSWwHXWsC2erP1SQUXgciTVq', 3, 'THIS IS SPARTA!')
createSignPayload('5HbgaJEuVN5qGbkhgtuDQANivSWwHXWsC2erP1SQUXgciTVq', 3, 'THIS IS SPARTA!', '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe')
)
).toEqual(
'0x' + // prefix
@@ -72,7 +72,8 @@ describe('util', (): void => {
'01' + // sr25519
'03' + // sign tx
'f4cd755672a8f9542ca9da4fbf2182e79135d94304002e6a09ffc96fef6e6c4c' + // publickey
'544849532049532053504152544121' // THIS IS SPARTA!
'544849532049532053504152544121' + // THIS IS SPARTA!
'b0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe' // genesisHash
);
});
});
@@ -81,7 +82,7 @@ describe('util', (): void => {
it('encodes frames properly', (): void => {
expect(
createFrames(
createSignPayload('5HbgaJEuVN5qGbkhgtuDQANivSWwHXWsC2erP1SQUXgciTVq', 0, '0x12345678')
createSignPayload('5HbgaJEuVN5qGbkhgtuDQANivSWwHXWsC2erP1SQUXgciTVq', 0, '0x12345678', '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe')
).map((u8a): string => u8aToHex(u8a))
).toEqual([
'0x' +
@@ -90,7 +91,8 @@ describe('util', (): void => {
'0000' + // index
'530100' + // payload info, substrate + sr25519 + signtx
'f4cd755672a8f9542ca9da4fbf2182e79135d94304002e6a09ffc96fef6e6c4c' + // publicKey
'12345678' // data
'12345678' + // data
'b0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe' // genesisHash
]);
});
});
+3 -2
View File
@@ -33,13 +33,14 @@ export function createAddressPayload (address: string, genesisHash: string): Uin
return encodeString(`${ADDRESS_PREFIX}:${address}:${genesisHash}`);
}
export function createSignPayload (address: string, cmd: number, payload: string | Uint8Array): Uint8Array {
export function createSignPayload (address: string, cmd: number, payload: string | Uint8Array, genesisHash: string | Uint8Array): Uint8Array {
return u8aConcat(
SUBSTRATE_ID,
CRYPTO_SR25519,
new Uint8Array([cmd]),
decodeAddress(address),
u8aToU8a(payload)
u8aToU8a(payload),
u8aToU8a(genesisHash)
);
}
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/reactnative-identicon",
"version": "0.52.1",
"version": "0.54.1",
"description": "Renders an SVG picture representing an address",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -9,9 +9,9 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/ui-shared": "0.52.1",
"react-native-svg": "^12.0.3"
"@babel/runtime": "^7.10.2",
"@polkadot/ui-shared": "0.54.1",
"react-native-svg": "^12.1.0"
},
"peerDependencies": {
"@polkadot/util-crypto": "*",
@@ -19,7 +19,7 @@
"react-native": "*"
},
"devDependencies": {
"@polkadot/util-crypto": "^2.8.1",
"@types/react-native": "^0.62.1"
"@polkadot/util-crypto": "^2.14.1",
"@types/react-native": "^0.62.13"
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/ui-assets",
"version": "0.52.1",
"version": "0.54.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.9.2"
"@babel/runtime": "^7.10.2"
}
}
+9 -10
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/ui-keyring",
"version": "0.52.1",
"version": "0.54.1",
"main": "index.js",
"repository": "https://github.com/polkadot-js/apps.git",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -17,25 +17,24 @@
"./ledger/transportsWeb": "./ledger/transportsEmpty"
},
"dependencies": {
"@babel/runtime": "^7.9.2",
"@ledgerhq/hw-transport-u2f": "^5.12.0",
"@ledgerhq/hw-transport-webusb": "^5.12.0",
"@babel/runtime": "^7.10.2",
"@ledgerhq/hw-transport-webusb": "^5.16.0",
"ledger-polkadot": "^0.7.0",
"mkdirp": "^1.0.4",
"rxjs": "^6.5.5",
"store": "^2.0.12"
},
"devDependencies": {
"@polkadot/keyring": "^2.8.1",
"@polkadot/types": "^1.10.1",
"@polkadot/util": "^2.8.1",
"@polkadot/keyring": "^2.14.1",
"@polkadot/types": "^1.19.1",
"@polkadot/util": "^2.14.1",
"@types/ledgerhq__hw-transport-node-hid": "^4.22.1",
"@types/ledgerhq__hw-transport-u2f": "^4.21.1",
"@types/mkdirp": "^1.0.0",
"@types/ledgerhq__hw-transport-webusb": "^4.70.0",
"@types/mkdirp": "^1.0.1",
"@types/store": "^2.0.2"
},
"optionalDependencies": {
"@ledgerhq/hw-transport-node-hid": "^5.12.0"
"@ledgerhq/hw-transport-node-hid": "^5.16.0"
},
"peerDependencies": {
"@polkadot/keyring": "*",
+13 -5
View File
@@ -7,9 +7,11 @@ 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 BN from 'bn.js';
import createPair from '@polkadot/keyring/pair';
import chains from '@polkadot/ui-settings/defaults/chains';
import { hexToU8a, isHex, isString } from '@polkadot/util';
import { bnToBn, hexToU8a, isHex, isString, u8aSorted } from '@polkadot/util';
import { createKeyMulti } from '@polkadot/util-crypto';
import env from './observable/development';
import Base from './Base';
@@ -41,6 +43,15 @@ export class Keyring extends Base implements KeyringStruct {
return this.addExternal(address, { ...meta, hardwareType, isHardware: true });
}
public addMultisig (addresses: (string | Uint8Array)[], threshold: BigInt | BN | number, meta: KeyringPair$Meta = {}): CreateResult {
const address = createKeyMulti(addresses, threshold);
// we could use `sortAddresses`, but rather use internal encode/decode so we are 100%
const who = u8aSorted(addresses.map((who) => this.decodeAddress(who))).map((who) => this.encodeAddress(who));
return this.addExternal(address, { ...meta, isMultisig: true, threshold: bnToBn(threshold).toNumber(), who });
}
public addPair (pair: KeyringPair, password: string): CreateResult {
this.keyring.addPair(pair);
@@ -265,10 +276,7 @@ export class Keyring extends Base implements KeyringStruct {
const type = Array.isArray(json.encoding.content) ? json.encoding.content[1] : 'ed25519';
const pair = createPair(
{ toSS58: this.encodeAddress, type },
{
// FIXME Just for the transition period (ignoreChecksum)
publicKey: this.decodeAddress(json.address, true)
},
{ publicKey: this.decodeAddress(json.address, true) },
json.meta,
hexToU8a(json.encoded)
);
+22 -20
View File
@@ -24,42 +24,44 @@ const transports = allNode.concat(allWeb);
// - it connects automatically, creating an app as required
// - Promises return errors (instead of wrapper errors)
export default class Ledger {
private app: LedgerApp | null = null;
private type: LedgerTypes;
#app: LedgerApp | null = null;
#type: LedgerTypes;
constructor (type: LedgerTypes) {
assert(['hid', 'u2f', 'webusb'].includes(type), `Unsupported transport ${type}`);
// u2f is deprecated
assert(['hid', 'webusb'].includes(type), `Unsupported transport ${type}`);
this.type = type;
this.#type = type;
}
private async getApp (): Promise<LedgerApp> {
if (!this.app) {
const def = transports.find(({ type }): boolean => type === this.type);
private async _getApp (): Promise<LedgerApp> {
if (!this.#app) {
const def = transports.find(({ type }) => type === this.#type);
assert(def, `Unable to find a transport for ${this.type}`);
assert(def, `Unable to find a transport for ${this.#type}`);
const transport = await def.create();
this.app = new LedgerApp(transport);
this.#app = new LedgerApp(transport);
}
return this.app;
return this.#app;
}
private async withApp <T> (fn: (app: LedgerApp) => Promise<T>): Promise<T> {
private async _withApp <T> (fn: (app: LedgerApp) => Promise<T>): Promise<T> {
try {
const app = await this.getApp();
const app = await this._getApp();
return await fn(app);
} catch (error) {
this.app = null;
this.#app = null;
throw error;
}
}
private async wrapError <T extends ResponseBase> (promise: Promise<T>): Promise<T> {
private async _wrapError <T extends ResponseBase> (promise: Promise<T>): Promise<T> {
const result = await promise;
assert(result.return_code === SUCCESS_CODE, result.error_message);
@@ -68,8 +70,8 @@ export default class Ledger {
}
public async getAddress (confirm = false, account = LEDGER_DEFAULT_ACCOUNT, change = LEDGER_DEFAULT_CHANGE, addressIndex = LEDGER_DEFAULT_INDEX): Promise<LedgerAddress> {
return this.withApp(async (app: LedgerApp): Promise<LedgerAddress> => {
const { address, pubKey } = await this.wrapError(app.getAddress(account, change, addressIndex, confirm));
return this._withApp(async (app: LedgerApp): Promise<LedgerAddress> => {
const { address, pubKey } = await this._wrapError(app.getAddress(account, change, addressIndex, confirm));
return {
address,
@@ -79,8 +81,8 @@ export default class Ledger {
}
public async getVersion (): Promise<LedgerVersion> {
return this.withApp(async (app: LedgerApp): Promise<LedgerVersion> => {
const { device_locked: isLocked, major, minor, patch, test_mode: isTestMode } = await this.wrapError(app.getVersion());
return this._withApp(async (app: LedgerApp): Promise<LedgerVersion> => {
const { device_locked: isLocked, major, minor, patch, test_mode: isTestMode } = await this._wrapError(app.getVersion());
return {
isLocked,
@@ -91,9 +93,9 @@ export default class Ledger {
}
public async sign (message: Uint8Array, account = LEDGER_DEFAULT_ACCOUNT, change = LEDGER_DEFAULT_CHANGE, addressIndex = LEDGER_DEFAULT_INDEX): Promise<LedgerSignature> {
return this.withApp(async (app: LedgerApp): Promise<LedgerSignature> => {
return this._withApp(async (app: LedgerApp): Promise<LedgerSignature> => {
const buffer = u8aToBuffer(message);
const { signature } = await this.wrapError(app.sign(account, change, addressIndex, buffer));
const { signature } = await this._wrapError(app.sign(account, change, addressIndex, buffer));
return {
signature: u8aToHex(bufferToU8a(signature))
@@ -1 +0,0 @@
declare module '@ledgerhq/hw-transport-webusb';
@@ -5,15 +5,16 @@
import { TransportDef } from './types';
import Transport from '@ledgerhq/hw-transport';
import LedgerU2F from '@ledgerhq/hw-transport-u2f';
import LedgerWebUSB from '@ledgerhq/hw-transport-webusb';
const transports: TransportDef[] = [
{
create: (): Promise<Transport> =>
LedgerU2F.create(),
type: 'u2f'
},
// deprecated
// import LedgerU2F from '@ledgerhq/hw-transport-u2f';
// {
// create: (): Promise<Transport> =>
// LedgerU2F.create(),
// type: 'u2f'
// },
{
create: (): Promise<Transport> =>
LedgerWebUSB.create(),
+1 -1
View File
@@ -50,6 +50,6 @@ export default class FileStore implements KeyringStore {
private _readKey (key: string): KeyringJson {
return JSON.parse(
fs.readFileSync(this._getPath(key)).toString('utf-8')
);
) as KeyringJson;
}
}
+1 -3
View File
@@ -26,7 +26,6 @@ export interface KeyringOptions extends KeyringOptionsBase {
store?: KeyringStore;
}
// eslint-disable-next-line @typescript-eslint/class-name-casing
export interface KeyringJson$Meta {
contract?: ContractMeta;
genesisHash?: string | null;
@@ -39,8 +38,7 @@ export interface KeyringJson$Meta {
whenCreated?: number;
whenEdited?: number;
whenUsed?: number;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[index: string]: any;
[index: string]: unknown;
}
export interface KeyringJson {
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/ui-settings",
"version": "0.52.1",
"version": "0.54.1",
"description": "Manages app settings",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -9,12 +9,12 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"eventemitter3": "^4.0.0",
"@babel/runtime": "^7.10.2",
"eventemitter3": "^4.0.4",
"store": "^2.0.12"
},
"devDependencies": {
"@polkadot/util": "^2.8.1",
"@polkadot/util": "^2.14.1",
"@types/store": "^2.0.2"
},
"peerDependencies": {
+12 -4
View File
@@ -12,6 +12,14 @@ import { Option, SettingsStruct } from './types';
type ChangeCallback = (settings: SettingsStruct) => void;
type OnTypes = 'change';
function withDefault (options: Option[], option: string | undefined, fallback: string): string {
const _option = option || fallback;
return options.some(({ value }) => value === _option)
? _option
: fallback;
}
export class Settings implements SettingsStruct {
readonly #emitter: EventEmitter;
@@ -34,13 +42,13 @@ export class Settings implements SettingsStruct {
#uiTheme: string;
constructor () {
const settings = store.get('settings') || {};
const settings = (store.get('settings') as SettingsStruct) || {};
this.#emitter = new EventEmitter();
this.#apiUrl = (typeof settings.apiUrl === 'string' && settings.apiUrl) || process.env.WS_URL || ENDPOINT_DEFAULT;
this.#camera = settings.camera || CAMERA_DEFAULT;
this.#ledgerConn = settings.ledgerConn || LEDGER_CONN_DEFAULT;
this.#apiUrl = (typeof settings.apiUrl === 'string' && settings.apiUrl) || process.env.WS_URL || (ENDPOINT_DEFAULT.value as string);
this.#camera = withDefault(CAMERA, settings.camera, CAMERA_DEFAULT);
this.#ledgerConn = withDefault(LEDGER_CONN, settings.ledgerConn, LEDGER_CONN_DEFAULT);
this.#i18nLang = settings.i18nLang || LANGUAGE_DEFAULT;
this.#icon = settings.icon || ICON_DEFAULT;
this.#locking = settings.locking || LOCKING_DEFAULT;
+9 -4
View File
@@ -5,14 +5,19 @@
import { Option } from '../types';
export const CRYPTOS: Option[] = [
{
info: 'sr25519',
text: 'Schnorrkel (sr25519, recommended)',
value: 'sr25519'
},
{
info: 'ed25519',
text: 'Edwards (ed25519)',
text: 'Edwards (ed25519, alternative)',
value: 'ed25519'
},
{
info: 'sr25519',
text: 'Schnorrkel (sr25519)',
value: 'sr25519'
info: 'ecdsa',
text: 'ECDSA (BTC/ETH compatible)',
value: 'ecdsa'
}
];
+6 -5
View File
@@ -12,11 +12,12 @@ export const LEDGER_CONN: Option[] = [
text: 'Do not attach Ledger devices',
value: 'none'
},
{
info: 'u2f',
text: 'Attach Ledger via U2F',
value: 'u2f'
},
// Deprecated
// {
// info: 'u2f',
// text: 'Attach Ledger via U2F',
// value: 'u2f'
// },
{
info: 'webusb',
text: 'Attach Ledger via WebUSB',
+11 -4
View File
@@ -12,19 +12,26 @@ export const PREFIXES: Option[] = [
text: 'Default for the connected node',
value: -1
},
// keep as first (well, after default)
{
info: 'substrate',
text: 'Substrate (development)',
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: 'polkadot',
text: 'Polkadot (live)',
value: 0
info: 'edgeware',
text: 'Edgeware (live)',
value: 7
}
];
+6 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/ui-shared",
"version": "0.52.1",
"version": "0.54.1",
"description": "Shared logic that is usable accross all frameworks-specific areas",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -9,7 +9,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.10.2",
"color": "^3.1.2"
},
"peerDependencies": {
@@ -17,8 +17,9 @@
"@polkadot/util-crypto": "*"
},
"devDependencies": {
"@polkadot/util": "^2.8.1",
"@polkadot/util-crypto": "^2.8.1",
"@types/color": "^3.0.1"
"@polkadot/util": "^2.14.1",
"@polkadot/util-crypto": "^2.14.1",
"@types/color": "^3.0.1",
"@types/xmlserializer": "^0.6.0"
}
}
@@ -7,7 +7,7 @@ import container from './container';
describe('container', (): void => {
it('applies default styles', (): void => {
expect(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access
(container(100).style as any)._values
).toMatchObject({
background: 'white',
@@ -23,7 +23,7 @@ describe('container', (): void => {
it('overrides with supplied styles', (): void => {
expect(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access
(container(50, 'black', '', { display: 'block' }).style as any)._values
).toMatchObject({
background: 'black',
@@ -1,5 +0,0 @@
// Copyright 2017-2020 @polkadot/ui-shared authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
declare module 'xmlserializer';
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/vue-identicon",
"version": "0.52.1",
"version": "0.54.1",
"description": "Renders an SVG picture representing an address",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
@@ -9,8 +9,8 @@
"main": "index.js",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/ui-shared": "0.52.1",
"@babel/runtime": "^7.10.2",
"@polkadot/ui-shared": "0.54.1",
"jdenticon": "2.2.0"
},
"peerDependencies": {
@@ -18,7 +18,7 @@
"vue": "*"
},
"devDependencies": {
"@polkadot/util-crypto": "^2.8.1",
"@polkadot/util-crypto": "^2.14.1",
"vue": "^2.6.11"
}
}
+2 -2
View File
@@ -65,8 +65,8 @@ export const Identicon = Vue.extend({
},
methods: {
createData: function (): void {
this.iconSize = this.size || DEFAULT_SIZE;
this.type = this.theme;
this.iconSize = this.size as number || DEFAULT_SIZE;
this.type = this.theme as 'empty';
this.recodeAddress();
},
@@ -25,7 +25,7 @@ export const Jdenticon = Vue.extend({
},
methods: {
createSvgHtml: function (): void {
this.svgHtml = jdenticon.toSvg(this.publicKey.substr(2), this.size);
this.svgHtml = jdenticon.toSvg((this.publicKey as string).substr(2), this.size);
}
},
props: ['publicKey', 'size'],
+7 -2
View File
@@ -9,6 +9,11 @@ interface Data {
svgHtml: string;
}
interface This {
address: string;
isAlternative?: boolean;
}
/**
* @name Polkadot
* @description The Polkadot default identicon
@@ -25,11 +30,11 @@ export const Polkadot = Vue.extend({
},
methods: {
createSvgHtml: function (): void {
const circles = polkadotIcon(this.address, { isAlternative: this.isAlternative || false }).map(({ cx, cy, fill, r }) =>
const circles = polkadotIcon(this.address, { isAlternative: (this as This).isAlternative || false }).map(({ cx, cy, fill, r }) =>
`<circle cx=${cx} cy=${cy} fill="${fill}" r=${r} />`
).join('');
this.svgHtml = `<svg height=${this.size} viewBox='0 0 64 64' width=${this.size}>${circles}</svg>`;
this.svgHtml = `<svg height=${this.size as number} viewBox='0 0 64 64' width=${this.size as number}>${circles}</svg>`;
}
},
props: ['address', 'isAlternative', 'size'],
+5345 -4497
View File
File diff suppressed because it is too large Load Diff