Compare commits

...
32 Commits
Author SHA1 Message Date
github-actions[bot] 75507c5fa7 [CI Skip] release/stable 2.4.1
skip-checks: true
2022-06-04 06:28:48 +00:00
Jaco d1c265130e 2.4.1 (#648) 2022-06-04 09:26:22 +03:00
github-actions[bot] 0eb4663442 [CI Skip] release/beta 2.3.2-1
skip-checks: true
2022-06-04 04:49:49 +00:00
Jaco 9e134ff95e Bump deps (#647) 2022-06-04 07:47:13 +03:00
github-actions[bot] c09d58bba1 [CI Skip] release/beta 2.3.2-0
skip-checks: true
2022-05-30 07:27:38 +00:00
Jaco fdc2b5011b Bump TS (#645) 2022-05-30 10:24:01 +03:00
github-actions[bot] 420ad06a7e [CI Skip] release/stable 2.3.1
skip-checks: true
2022-05-30 06:16:17 +00:00
Jaco 28988479c5 2.3.1 (#644) 2022-05-30 09:13:48 +03:00
github-actions[bot] 700b04e2ec [CI Skip] release/stable 2.2.1
skip-checks: true
2022-05-14 05:13:26 +00:00
Jaco b092fe8c6d 2.2.1 (#641) 2022-05-14 08:10:34 +03:00
github-actions[bot] b25f6e46d8 [CI Skip] release/stable 2.1.1
skip-checks: true
2022-04-30 05:52:47 +00:00
Jaco 62e934dba7 2.1.1 (#638) 2022-04-30 08:49:49 +03:00
github-actions[bot] cb073d755d [CI Skip] release/beta 2.0.2-2
skip-checks: true
2022-04-29 11:36:13 +00:00
Jaco c9cd6898fe Bump TS (#637) 2022-04-29 14:33:40 +03:00
github-actions[bot] 106f2aac72 [CI Skip] release/beta 2.0.2-1
skip-checks: true
2022-04-27 07:41:11 +00:00
Jaco 16dbecf0d2 Bump @polkadot/dev (#636)
* Bump @polkadot/dev

* Rebump dev

* Add crypto polyfill

* Adjust expectations
2022-04-27 10:38:13 +03:00
github-actions[bot] dc023fe2c6 [CI Skip] release/beta 2.0.2-0
skip-checks: true
2022-04-23 07:00:05 +00:00
Jaco 6c2d03a6c5 Remove jsx-runtime alias for React 18 (#635)
* Remove jsx-runtime alias for React 18

* Adjust override

* s/cb/fn/
2022-04-23 09:57:36 +03:00
github-actions[bot] e4787f1b25 [CI Skip] release/stable 2.0.1
skip-checks: true
2022-04-09 08:00:12 +00:00
Jaco 779fedd4ae 2.0.1 (#633) 2022-04-09 10:57:41 +03:00
github-actions[bot] 08d71f0675 [CI Skip] release/beta 1.4.2-2
skip-checks: true
2022-04-06 13:03:58 +00:00
Jaco e598c7bb42 Make icon generation more robust (#632)
* Make icon generation more robust

* Update packages/ui-shared/src/icons/polkadot.ts
2022-04-06 16:00:26 +03:00
github-actions[bot] fb360420e5 [CI Skip] release/beta 1.4.2-1
skip-checks: true
2022-04-06 12:51:35 +00:00
Jaco 2184bb5adc Bump deps (#631) 2022-04-06 15:48:56 +03:00
github-actions[bot] 854e812ef3 [CI Skip] release/beta 1.4.2-0
skip-checks: true
2022-04-05 06:34:05 +00:00
Jaco cc17aa3fc3 Bump @polkadot/dev (#630) 2022-04-05 09:31:31 +03:00
github-actions[bot] d57a700d40 [CI Skip] release/stable 1.4.1
skip-checks: true
2022-03-27 08:52:24 +00:00
Jaco 37c398b1a7 1.4.1 (#629) 2022-03-27 11:49:56 +03:00
github-actions[bot] 2f27f2bac9 [CI Skip] release/beta 1.3.2-1
skip-checks: true
2022-03-27 06:27:47 +00:00
Jaco 090218d0b9 Bump TypeScript (#628) 2022-03-27 09:24:50 +03:00
github-actions[bot] 4799a69823 [CI Skip] release/beta 1.3.2-0
skip-checks: true
2022-03-23 05:55:21 +00:00
Jaco 6548982bb5 Bump dev (#627) 2022-03-23 07:52:25 +02:00
41 changed files with 2521 additions and 2155 deletions
+1
View File
@@ -7,6 +7,7 @@ module.exports = {
...base, ...base,
ignorePatterns: [ ignorePatterns: [
...base.ignorePatterns, ...base.ignorePatterns,
'jest/**/*',
'**/*.d.ts' '**/*.d.ts'
], ],
parserOptions: { parserOptions: {
+2
View File
@@ -1,4 +1,6 @@
build/ build/
build-cjs/
build-esm/
build-docs/ build-docs/
coverage/ coverage/
node_modules/ node_modules/
+47
View File
@@ -1,5 +1,52 @@
# CHANGELOG # CHANGELOG
## 2.4.1 Jun 4, 2022
Changes:
- Upgrade to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 9.4.1
## 2.3.1 May 30, 2022
Changes:
- Upgrade to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 9.3.1
## 2.2.1 May 14, 2022
Changes:
- Upgrade to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 9.2.1
## 2.1.1 Apr 30, 2022
Changes:
- Upgrade to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 9.1.1
- Adjust Jest test init for latest `@polkadot/dev`
## 2.0.1 Apr 9, 2022
- **Breaking change** In this major version the commonjs outputs are moved to a sub-folder. Since the export map and main field in package.json does reflect this change, there should be no usage changes. However the packages here will all need to be on the same version for internal linkage.
Changes:
- Adjust Polkadot icon generation with lazy init
- Output commonjs files under the `cjs/**` root
- Upgrade to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 9.0.1
## 1.4.1 Mar 27, 2022
Changes:
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 8.7.1
## 1.3.1 Mar 19, 2022 ## 1.3.1 Mar 19, 2022
Changes: Changes:
+1 -1
View File
@@ -1,4 +1,4 @@
599 Jaco 1.3.1 (#626) 615 Jaco 2.4.1 (#648)
7 YJ fix #224: decrease frame size to 1024, set multipart bool (#225) 7 YJ fix #224: decrease frame size to 1024, set multipart bool (#225)
4 Antoine Estienne Refactor logic to better use prefix (#491) 4 Antoine Estienne Refactor logic to better use prefix (#491)
4 kwingram25 fix ff api url issue (#289) 4 kwingram25 fix ff api url issue (#289)
+1
View File
@@ -12,5 +12,6 @@ module.exports = {
'\\.(css|less)$': 'empty/object', '\\.(css|less)$': 'empty/object',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': 'empty/object' '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': 'empty/object'
}, },
setupFilesAfterEnv: ['<rootDir>/jest/setupEnv.js'],
testEnvironment: 'jsdom' testEnvironment: 'jsdom'
}; };
+10
View File
@@ -0,0 +1,10 @@
// Copyright 2017-2022 @polkadot/ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
const nodeCrypto = require('crypto');
window.crypto = {
getRandomValues: function (buffer) {
return nodeCrypto.randomFillSync(buffer);
}
};
+13 -13
View File
@@ -10,7 +10,7 @@
"url": "https://github.com/polkadot-js/ui.git" "url": "https://github.com/polkadot-js/ui.git"
}, },
"sideEffects": false, "sideEffects": false,
"version": "1.3.1", "version": "2.4.1",
"workspaces": [ "workspaces": [
"packages/*" "packages/*"
], ],
@@ -27,26 +27,26 @@
"test:one": "polkadot-dev-run-test" "test:one": "polkadot-dev-run-test"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.17.8", "@babel/core": "^7.18.2",
"@babel/runtime": "^7.17.8", "@babel/runtime": "^7.18.3",
"@polkadot/dev": "^0.65.97", "@polkadot/dev": "^0.66.34",
"@polkadot/x-bundle": "^8.6.1", "@polkadot/x-bundle": "^9.4.1",
"@types/jest": "^27.4.1", "@types/jest": "^28.1.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.5",
"babel-plugin-transform-vue-template": "^0.4.2", "babel-plugin-transform-vue-template": "^0.4.2",
"empty": "^0.10.1", "empty": "^0.10.1",
"process": "^0.11.10", "process": "^0.11.10",
"react": "^17.0.2", "react": "^18.1.0",
"react-dom": "^17.0.2", "react-dom": "^18.1.0",
"react-is": "^17.0.2", "react-is": "^18.1.0",
"react-native": "^0.67.4", "react-native": "^0.68.2",
"stream-browserify": "^3.0.0", "stream-browserify": "^3.0.0",
"vue-template-compiler": "^2.6.14", "vue-template-compiler": "^2.6.14",
"webpack": "^5.70.0", "webpack": "^5.73.0",
"webpack-cli": "^4.9.2", "webpack-cli": "^4.9.2",
"webpack-serve": "^4.0.0" "webpack-serve": "^4.0.0"
}, },
"resolutions": { "resolutions": {
"typescript": "^4.6.2" "typescript": "^4.7.3"
} }
} }
+2 -2
View File
@@ -14,9 +14,9 @@
"url": "https://github.com/polkadot-js/ui.git" "url": "https://github.com/polkadot-js/ui.git"
}, },
"sideEffects": false, "sideEffects": false,
"version": "1.3.1", "version": "2.4.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.17.8" "@babel/runtime": "^7.18.3"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/example-react', path: 'auto', type: 'auto', version: '1.3.1' }; export const packageInfo = { name: '@polkadot/example-react', path: 'auto', type: 'auto', version: '2.4.1' };
+1 -2
View File
@@ -43,8 +43,7 @@ module.exports = {
'@polkadot/react-identicon': path.resolve(__dirname, '../react-identicon/build'), '@polkadot/react-identicon': path.resolve(__dirname, '../react-identicon/build'),
'@polkadot/ui-keyring': path.resolve(__dirname, '../ui-keyring/build'), '@polkadot/ui-keyring': path.resolve(__dirname, '../ui-keyring/build'),
'@polkadot/ui-settings': path.resolve(__dirname, '../ui-settings/build'), '@polkadot/ui-settings': path.resolve(__dirname, '../ui-settings/build'),
'@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build'), '@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build')
'react/jsx-runtime': require.resolve('react/jsx-runtime')
}, },
extensions: ['.js', '.ts', '.tsx'], extensions: ['.js', '.ts', '.tsx'],
fallback: {} fallback: {}
+2 -2
View File
@@ -14,9 +14,9 @@
"url": "https://github.com/polkadot-js/ui.git" "url": "https://github.com/polkadot-js/ui.git"
}, },
"sideEffects": false, "sideEffects": false,
"version": "1.3.1", "version": "2.4.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.17.8" "@babel/runtime": "^7.18.3"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/example-vue', path: 'auto', type: 'auto', version: '1.3.1' }; export const packageInfo = { name: '@polkadot/example-vue', path: 'auto', type: 'auto', version: '2.4.1' };
+12 -12
View File
@@ -17,26 +17,26 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "1.3.1", "version": "2.4.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.17.8", "@babel/runtime": "^7.18.3",
"@polkadot/keyring": "^8.6.1", "@polkadot/keyring": "^9.4.1",
"@polkadot/ui-settings": "1.3.1", "@polkadot/ui-settings": "2.4.1",
"@polkadot/ui-shared": "1.3.1", "@polkadot/ui-shared": "2.4.1",
"@polkadot/util": "^8.6.1", "@polkadot/util": "^9.4.1",
"@polkadot/util-crypto": "^8.6.1", "@polkadot/util-crypto": "^9.4.1",
"color": "^3.2.1", "color": "^3.2.1",
"ethereum-blockies-base64": "^1.0.2", "ethereum-blockies-base64": "^1.0.2",
"jdenticon": "3.1.1", "jdenticon": "3.1.1",
"react-copy-to-clipboard": "^5.0.4", "react-copy-to-clipboard": "^5.1.0",
"styled-components": "^5.3.3" "styled-components": "^5.3.5"
}, },
"devDependencies": { "devDependencies": {
"@types/react-copy-to-clipboard": "^5.0.2", "@types/react-copy-to-clipboard": "^5.0.2",
"@types/react-dom": "^17.0.14", "@types/react-dom": "^18.0.5",
"@types/styled-components": "^5.1.24", "@types/styled-components": "^5.1.25",
"styled-components": "^5.3.3", "styled-components": "^5.3.5",
"xmlserializer": "^0.6.1" "xmlserializer": "^0.6.1"
}, },
"peerDependencies": { "peerDependencies": {
@@ -4,15 +4,18 @@
import type { Props } from '../types'; import type { Props } from '../types';
import * as jdenticon from 'jdenticon'; import * as jdenticon from 'jdenticon';
import React from 'react'; import React, { useMemo } from 'react';
function Identicon ({ className = '', publicKey, size, style }: Props): React.ReactElement<Props> { function Identicon ({ className = '', publicKey, size, style }: Props): React.ReactElement<Props> {
const html = useMemo(
() => ({ __html: jdenticon.toSvg(publicKey.substr(2), size) }),
[publicKey, size]
);
return ( return (
<div <div
className={className} className={className}
dangerouslySetInnerHTML={{ dangerouslySetInnerHTML={html}
__html: jdenticon.toSvg(publicKey.substr(2), size)
}}
style={style} style={style}
/> />
); );
@@ -19,7 +19,7 @@
import type { Circle } from '@polkadot/ui-shared/icons/types'; import type { Circle } from '@polkadot/ui-shared/icons/types';
import type { Props } from '../types'; import type { Props } from '../types';
import React from 'react'; import React, { useMemo } from 'react';
import { polkadotIcon } from '@polkadot/ui-shared'; import { polkadotIcon } from '@polkadot/ui-shared';
@@ -36,6 +36,11 @@ 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> {
const circles = useMemo(
() => polkadotIcon(address, { isAlternative }),
[address, isAlternative]
);
return ( return (
<svg <svg
className={className} className={className}
@@ -46,7 +51,7 @@ function Identicon ({ address, className = '', isAlternative = false, size, styl
viewBox='0 0 64 64' viewBox='0 0 64 64'
width={size} width={size}
> >
{polkadotIcon(address, { isAlternative }).map(renderCircle)} {circles.map(renderCircle)}
</svg> </svg>
); );
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/react-identicon', path: 'auto', type: 'auto', version: '1.3.1' }; export const packageInfo = { name: '@polkadot/react-identicon', path: 'auto', type: 'auto', version: '2.4.1' };
+7 -7
View File
@@ -17,20 +17,20 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "1.3.1", "version": "2.4.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.17.8", "@babel/runtime": "^7.18.3",
"@polkadot/ui-settings": "1.3.1", "@polkadot/ui-settings": "2.4.1",
"@polkadot/util": "^8.6.1", "@polkadot/util": "^9.4.1",
"@polkadot/util-crypto": "^8.6.1", "@polkadot/util-crypto": "^9.4.1",
"qrcode-generator": "^1.4.4", "qrcode-generator": "^1.4.4",
"react-qr-reader": "^2.2.1", "react-qr-reader": "^2.2.1",
"styled-components": "^5.3.3" "styled-components": "^5.3.5"
}, },
"devDependencies": { "devDependencies": {
"@types/react-qr-reader": "^2.1.4", "@types/react-qr-reader": "^2.1.4",
"@types/styled-components": "^5.1.24" "@types/styled-components": "^5.1.25"
}, },
"peerDependencies": { "peerDependencies": {
"@polkadot/util": "*", "@polkadot/util": "*",
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/react-qr', path: 'auto', type: 'auto', version: '1.3.1' }; export const packageInfo = { name: '@polkadot/react-qr', path: 'auto', type: 'auto', version: '2.4.1' };
+6 -6
View File
@@ -17,17 +17,17 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "1.3.1", "version": "2.4.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.17.8", "@babel/runtime": "^7.18.3",
"@polkadot/ui-shared": "1.3.1", "@polkadot/ui-shared": "2.4.1",
"@polkadot/util": "^8.6.1", "@polkadot/util": "^9.4.1",
"@polkadot/util-crypto": "^8.6.1", "@polkadot/util-crypto": "^9.4.1",
"react-native-svg": "^12.3.0" "react-native-svg": "^12.3.0"
}, },
"devDependencies": { "devDependencies": {
"@types/react-native": "^0.67.3" "@types/react-native": "^0.67.8"
}, },
"peerDependencies": { "peerDependencies": {
"@polkadot/util": "*", "@polkadot/util": "*",
@@ -4,7 +4,7 @@
import type { Circle as CircleType } from '@polkadot/ui-shared/icons/types'; import type { Circle as CircleType } from '@polkadot/ui-shared/icons/types';
import type { Props } from '../types'; import type { Props } from '../types';
import React from 'react'; import React, { useMemo } from 'react';
import { View } from 'react-native'; import { View } from 'react-native';
import Svg, { Circle as SvgCircle } from 'react-native-svg'; import Svg, { Circle as SvgCircle } from 'react-native-svg';
@@ -23,6 +23,11 @@ function renderCircle ({ cx, cy, fill, r }: CircleType, key: number): React.Reac
} }
export default function Identicon ({ address, isAlternative = false, size }: Props): React.ReactElement<Props> { export default function Identicon ({ address, isAlternative = false, size }: Props): React.ReactElement<Props> {
const circles = useMemo(
() => polkadotIcon(address, { isAlternative }),
[address, isAlternative]
);
return ( return (
<View> <View>
<Svg <Svg
@@ -31,7 +36,7 @@ export default function Identicon ({ address, isAlternative = false, size }: Pro
viewBox='0 0 64 64' viewBox='0 0 64 64'
width={size} width={size}
> >
{polkadotIcon(address, { isAlternative }).map(renderCircle)} {circles.map(renderCircle)}
</Svg> </Svg>
</View> </View>
); );
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/reactnative-identicon', path: 'auto', type: 'auto', version: '1.3.1' }; export const packageInfo = { name: '@polkadot/reactnative-identicon', path: 'auto', type: 'auto', version: '2.4.1' };
+3 -3
View File
@@ -13,10 +13,10 @@
"url": "https://github.com/polkadot-js/ui.git" "url": "https://github.com/polkadot-js/ui.git"
}, },
"sideEffects": false, "sideEffects": false,
"version": "1.3.1", "version": "2.4.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.17.8", "@babel/runtime": "^7.18.3",
"@polkadot/util": "^8.6.1" "@polkadot/util": "^9.4.1"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/ui-assets', path: 'auto', type: 'auto', version: '1.3.1' }; export const packageInfo = { name: '@polkadot/ui-assets', path: 'auto', type: 'auto', version: '2.4.1' };
+6 -6
View File
@@ -16,14 +16,14 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "1.3.1", "version": "2.4.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.17.8", "@babel/runtime": "^7.18.3",
"@polkadot/keyring": "^8.6.1", "@polkadot/keyring": "^9.4.1",
"@polkadot/ui-settings": "1.3.1", "@polkadot/ui-settings": "2.4.1",
"@polkadot/util": "^8.6.1", "@polkadot/util": "^9.4.1",
"@polkadot/util-crypto": "^8.6.1", "@polkadot/util-crypto": "^9.4.1",
"mkdirp": "^1.0.4", "mkdirp": "^1.0.4",
"rxjs": "^7.5.5", "rxjs": "^7.5.5",
"store": "^2.0.12" "store": "^2.0.12"
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/ui-keyring', path: 'auto', type: 'auto', version: '1.3.1' }; export const packageInfo = { name: '@polkadot/ui-keyring', path: 'auto', type: 'auto', version: '2.4.1' };
+8 -9
View File
@@ -6,24 +6,23 @@ import type { KeyringJson, KeyringStore } from '../types';
import store from 'store'; import store from 'store';
export class BrowserStore implements KeyringStore { export class BrowserStore implements KeyringStore {
public all (cb: (key: string, value: KeyringJson) => void): void { public all (fn: (key: string, value: KeyringJson) => void): void {
store.each((value: KeyringJson, key: string): void => { store.each((value: KeyringJson, key: string): void => {
cb(key, value); fn(key, value);
}); });
} }
public get (key: string, cb: (value: KeyringJson) => void): void { public get (key: string, fn: (value: KeyringJson) => void): void {
// eslint-disable-next-line node/no-callback-literal fn(store.get(key) as KeyringJson);
cb(store.get(key) as KeyringJson);
} }
public remove (key: string, cb?: () => void): void { public remove (key: string, fn?: () => void): void {
store.remove(key); store.remove(key);
cb && cb(); fn && fn();
} }
public set (key: string, value: KeyringJson, cb?: () => void): void { public set (key: string, value: KeyringJson, fn?: () => void): void {
store.set(key, value); store.set(key, value);
cb && cb(); fn && fn();
} }
} }
+8 -8
View File
@@ -21,33 +21,33 @@ export class FileStore implements KeyringStore {
this.#path = path; this.#path = path;
} }
public all (cb: (key: string, value: KeyringJson) => void): void { public all (fn: (key: string, value: KeyringJson) => void): void {
fs fs
.readdirSync(this.#path) .readdirSync(this.#path)
.filter((key): boolean => !['.', '..', '.DS_Store'].includes(key)) .filter((key): boolean => !['.', '..', '.DS_Store'].includes(key))
.forEach((key): void => { .forEach((key): void => {
const value = this._readKey(key); const value = this._readKey(key);
value?.address && cb(key, value); value?.address && fn(key, value);
}); });
} }
public get (key: string, cb: (value: KeyringJson) => void): void { public get (key: string, fn: (value: KeyringJson) => void): void {
const value = this._readKey(key); const value = this._readKey(key);
assert(value?.address, `Invalid JSON found for ${key}`); assert(value?.address, `Invalid JSON found for ${key}`);
cb(value); fn(value);
} }
public remove (key: string, cb?: () => void): void { public remove (key: string, fn?: () => void): void {
fs.unlinkSync(this._getPath(key)); fs.unlinkSync(this._getPath(key));
cb && cb(); fn && fn();
} }
public set (key: string, value: KeyringJson, cb?: () => void): void { public set (key: string, value: KeyringJson, fn?: () => void): void {
fs.writeFileSync(this._getPath(key), Buffer.from(JSON.stringify(value), 'utf-8')); fs.writeFileSync(this._getPath(key), Buffer.from(JSON.stringify(value), 'utf-8'));
cb && cb(); fn && fn();
} }
private _getPath (key: string): string { private _getPath (key: string): string {
+4 -4
View File
@@ -17,12 +17,12 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "1.3.1", "version": "2.4.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.17.8", "@babel/runtime": "^7.18.3",
"@polkadot/networks": "^8.6.1", "@polkadot/networks": "^9.4.1",
"@polkadot/util": "^8.6.1", "@polkadot/util": "^9.4.1",
"eventemitter3": "^4.0.7", "eventemitter3": "^4.0.7",
"store": "^2.0.12" "store": "^2.0.12"
}, },
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/ui-settings', path: 'auto', type: 'auto', version: '1.3.1' }; export const packageInfo = { name: '@polkadot/ui-settings', path: 'auto', type: 'auto', version: '2.4.1' };
+4 -4
View File
@@ -17,15 +17,15 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "1.3.1", "version": "2.4.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.17.8", "@babel/runtime": "^7.18.3",
"color": "^3.2.1" "color": "^3.2.1"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/util": "^8.6.1", "@polkadot/util": "^9.4.1",
"@polkadot/util-crypto": "^8.6.1", "@polkadot/util-crypto": "^9.4.1",
"@types/color": "^3.0.3", "@types/color": "^3.0.3",
"@types/xmlserializer": "^0.6.2", "@types/xmlserializer": "^0.6.2",
"xmlserializer": "^0.6.1" "xmlserializer": "^0.6.1"
@@ -9,7 +9,8 @@ describe('identicon', (): void => {
it('generates a basic [0,..,0] identicon', (): void => { it('generates a basic [0,..,0] identicon', (): void => {
expect( expect(
xmlserializer.serializeToString( xmlserializer.serializeToString(
beachballIcon(new Uint8Array(32), { isAlternative: false, size: 256 }) // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-explicit-any
beachballIcon(new Uint8Array(32), { isAlternative: false, size: 256 }) as any
) )
).toEqual( ).toEqual(
'<div xmlns="http://www.w3.org/1999/xhtml" class="" style="background: white; border-radius: 128px; display: inline-block; height: 256px; margin: 0px; overflow: hidden; padding: 0px; width: 256px;"><div class="" style="background: rgb(20, 20, 20); border-radius: 128px; display: inline-block; height: 256px; margin: 0px; overflow: hidden; padding: 0px; width: 256px;"><svg xmlns="http://www.w3.org/2000/svg" x="0" y="0" width="256" height="256"><circle cx="128" cy="140.8" r="128" fill="hsl(212.10000000000002, 65.6%, 55.5%)"/><circle cx="128" cy="153.6" r="102.4" fill="hsl(9.800000000000011, 90.7%, 57.6%)"/><circle cx="128" cy="166.4" r="76.8" fill="hsl(345, 85.7%, 86.3%)"/><circle cx="128" cy="179.2" r="51.2" fill="hsl(261.9, 100%, 87.3%)"/><circle cx="128" cy="192" r="25.6" fill="hsl(345, 100%, 25.1%)"/></svg></div></div>' '<div xmlns="http://www.w3.org/1999/xhtml" class="" style="background: white; border-radius: 128px; display: inline-block; height: 256px; margin: 0px; overflow: hidden; padding: 0px; width: 256px;"><div class="" style="background: rgb(20, 20, 20); border-radius: 128px; display: inline-block; height: 256px; margin: 0px; overflow: hidden; padding: 0px; width: 256px;"><svg xmlns="http://www.w3.org/2000/svg" x="0" y="0" width="256" height="256"><circle cx="128" cy="140.8" r="128" fill="hsl(212.10000000000002, 65.6%, 55.5%)"/><circle cx="128" cy="153.6" r="102.4" fill="hsl(9.800000000000011, 90.7%, 57.6%)"/><circle cx="128" cy="166.4" r="76.8" fill="hsl(345, 85.7%, 86.3%)"/><circle cx="128" cy="179.2" r="51.2" fill="hsl(261.9, 100%, 87.3%)"/><circle cx="128" cy="192" r="25.6" fill="hsl(345, 100%, 25.1%)"/></svg></div></div>'
@@ -19,7 +20,8 @@ describe('identicon', (): void => {
it('allows overrides', (): void => { it('allows overrides', (): void => {
expect( expect(
xmlserializer.serializeToString( xmlserializer.serializeToString(
beachballIcon(new Uint8Array(32), { isAlternative: false, size: 100 }, 'testClass', { display: 'block' }) // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-explicit-any
beachballIcon(new Uint8Array(32), { isAlternative: false, size: 100 }, 'testClass', { display: 'block' }) as any
) )
).toEqual( ).toEqual(
'<div xmlns="http://www.w3.org/1999/xhtml" class="testClass" style="background: white; border-radius: 50px; display: block; height: 100px; margin: 0px; overflow: hidden; padding: 0px; width: 100px;"><div class="" style="background: rgb(20, 20, 20); border-radius: 50px; display: inline-block; height: 100px; margin: 0px; overflow: hidden; padding: 0px; width: 100px;"><svg xmlns="http://www.w3.org/2000/svg" x="0" y="0" width="100" height="100"><circle cx="50" cy="55" r="50" fill="hsl(212.10000000000002, 65.6%, 55.5%)"/><circle cx="50" cy="60" r="40" fill="hsl(9.800000000000011, 90.7%, 57.6%)"/><circle cx="50" cy="65" r="30" fill="hsl(345, 85.7%, 86.3%)"/><circle cx="50" cy="70" r="20" fill="hsl(261.9, 100%, 87.3%)"/><circle cx="50" cy="75" r="10" fill="hsl(345, 100%, 25.1%)"/></svg></div></div>' '<div xmlns="http://www.w3.org/1999/xhtml" class="testClass" style="background: white; border-radius: 50px; display: block; height: 100px; margin: 0px; overflow: hidden; padding: 0px; width: 100px;"><div class="" style="background: rgb(20, 20, 20); border-radius: 50px; display: inline-block; height: 100px; margin: 0px; overflow: hidden; padding: 0px; width: 100px;"><svg xmlns="http://www.w3.org/2000/svg" x="0" y="0" width="100" height="100"><circle cx="50" cy="55" r="50" fill="hsl(212.10000000000002, 65.6%, 55.5%)"/><circle cx="50" cy="60" r="40" fill="hsl(9.800000000000011, 90.7%, 57.6%)"/><circle cx="50" cy="65" r="30" fill="hsl(345, 85.7%, 86.3%)"/><circle cx="50" cy="70" r="20" fill="hsl(261.9, 100%, 87.3%)"/><circle cx="50" cy="75" r="10" fill="hsl(345, 100%, 25.1%)"/></svg></div></div>'
@@ -10,7 +10,8 @@ describe('circle', (): void => {
it('creates a circle shape', (): void => { it('creates a circle shape', (): void => {
expect( expect(
xmlserializer.serializeToString( xmlserializer.serializeToString(
circle(seeder(), 'blue', 50, 2) // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-explicit-any
circle(seeder(), 'blue', 50, 2) as any
) )
).toEqual('<circle xmlns="http://www.w3.org/2000/svg" cx="25" cy="32.5" r="15" fill="blue"/>'); ).toEqual('<circle xmlns="http://www.w3.org/2000/svg" cx="25" cy="32.5" r="15" fill="blue"/>');
}); });
@@ -9,7 +9,8 @@ describe('circle', (): void => {
it('creates a basic SVG circle element', (): void => { it('creates a basic SVG circle element', (): void => {
expect( expect(
serializeToString( serializeToString(
circle(123, 12, 34) // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-explicit-any
circle(123, 12, 34) as any
) )
).toEqual('<circle xmlns="http://www.w3.org/2000/svg" cx="12" cy="34" r="123"/>'); ).toEqual('<circle xmlns="http://www.w3.org/2000/svg" cx="12" cy="34" r="123"/>');
}); });
@@ -9,7 +9,8 @@ describe('element', (): void => {
it('creates a basic SVG element', (): void => { it('creates a basic SVG element', (): void => {
expect( expect(
serializeToString( serializeToString(
element(123) // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-explicit-any
element(123) as any
) )
).toEqual('<svg xmlns="http://www.w3.org/2000/svg" x="0" y="0" width="123" height="123"/>'); ).toEqual('<svg xmlns="http://www.w3.org/2000/svg" x="0" y="0" width="123" height="123"/>');
}); });
@@ -9,7 +9,8 @@ describe('rect', (): void => {
it('creates a basic SVG rect element', (): void => { it('creates a basic SVG rect element', (): void => {
expect( expect(
serializeToString( serializeToString(
rect(123) // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-explicit-any
rect(123) as any
) )
).toEqual('<rect xmlns="http://www.w3.org/2000/svg" x="0" y="0" width="123" height="123" rx="7.6875" ry="7.6875"/>'); ).toEqual('<rect xmlns="http://www.w3.org/2000/svg" x="0" y="0" width="123" height="123" rx="7.6875" ry="7.6875"/>');
}); });
@@ -9,7 +9,8 @@ describe('svg', (): void => {
it('creates a basic SVG element', (): void => { it('creates a basic SVG element', (): void => {
expect( expect(
serializeToString( serializeToString(
svg('rect') // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-explicit-any
svg('rect') as any
) )
).toEqual('<rect xmlns="http://www.w3.org/2000/svg"/>'); ).toEqual('<rect xmlns="http://www.w3.org/2000/svg"/>');
}); });
+18 -4
View File
@@ -22,7 +22,6 @@ const blake2 = (value: Uint8Array): Uint8Array =>
const S = 64; const S = 64;
const C = S / 2; const C = S / 2;
const Z = S / 64 * 5; const Z = S / 64 * 5;
const ZERO = blake2(new Uint8Array(32));
/* eslint-disable sort-keys */ /* eslint-disable sort-keys */
const SCHEMA: { [index: string]: Scheme } = { const SCHEMA: { [index: string]: Scheme } = {
@@ -43,6 +42,8 @@ const OUTER_CIRCLE: Circle = {
r: C r: C
}; };
let zeroHash: Uint8Array = new Uint8Array();
function getRotation (isSixPoint: boolean): { r: number; ro2: number; r3o4: number; ro4: number; rroot3o2: number; rroot3o4: number } { function getRotation (isSixPoint: boolean): { r: number; ro2: number; r3o4: number; ro4: number; rroot3o2: number; rroot3o4: number } {
const r = isSixPoint const r = isSixPoint
? (C / 8 * 5) ? (C / 8 * 5)
@@ -98,7 +99,11 @@ function findScheme (d: number): Scheme {
} }
function addressToId (address: string): Uint8Array { function addressToId (address: string): Uint8Array {
return blake2(decodeAddress(address)).map((x, i): number => (x + 256 - ZERO[i]) % 256); if (!zeroHash.length) {
zeroHash = blake2(new Uint8Array(32));
}
return blake2(decodeAddress(address)).map((x, i) => (x + 256 - zeroHash[i]) % 256);
} }
function getColors (address: string): string[] { function getColors (address: string): string[] {
@@ -132,10 +137,19 @@ function getColors (address: string): string[] {
* @description Generate a array of the circles that make up an identicon * @description Generate a array of the circles that make up an identicon
*/ */
export function polkadotIcon (address: string, { isAlternative }: Options): Circle[] { export function polkadotIcon (address: string, { isAlternative }: Options): Circle[] {
const colors = getColors(address); const xy = getCircleXY(isAlternative);
let colors: string[];
try {
// in some cases, e.g. RN where crypto may not be initialized, chaos can
// happen when hashing, in these cases we just fill with a placeholder
colors = getColors(address);
} catch {
colors = new Array<string>(xy.length).fill('#ddd');
}
return [OUTER_CIRCLE].concat( return [OUTER_CIRCLE].concat(
getCircleXY(isAlternative).map(([cx, cy], index): Circle => ({ xy.map(([cx, cy], index): Circle => ({
cx, cy, fill: colors[index], r: Z cx, cy, fill: colors[index], r: Z
})) }))
); );
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/ui-shared', path: 'auto', type: 'auto', version: '1.3.1' }; export const packageInfo = { name: '@polkadot/ui-shared', path: 'auto', type: 'auto', version: '2.4.1' };
+5 -5
View File
@@ -17,13 +17,13 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "1.3.1", "version": "2.4.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.17.8", "@babel/runtime": "^7.18.3",
"@polkadot/ui-shared": "1.3.1", "@polkadot/ui-shared": "2.4.1",
"@polkadot/util": "^8.6.1", "@polkadot/util": "^9.4.1",
"@polkadot/util-crypto": "^8.6.1", "@polkadot/util-crypto": "^9.4.1",
"jdenticon": "3.1.1" "jdenticon": "3.1.1"
}, },
"devDependencies": { "devDependencies": {
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/vue-identicon', path: 'auto', type: 'auto', version: '1.3.1' }; export const packageInfo = { name: '@polkadot/vue-identicon', path: 'auto', type: 'auto', version: '2.4.1' };
+2315 -2042
View File
File diff suppressed because it is too large Load Diff