Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6a46f2d33 | ||
|
|
2b71f0164c | ||
|
|
6381e571cf | ||
|
|
d5bbee2bad | ||
|
|
e8df066f50 | ||
|
|
b3bef159dd | ||
|
|
2f28f04b22 | ||
|
|
0a96372186 | ||
|
|
41edf711ec | ||
|
|
d38a8dfd96 | ||
|
|
465152698d | ||
|
|
84a18f3c0b | ||
|
|
f222cbb6c0 | ||
|
|
6ceb397c87 | ||
|
|
bd7fa3db34 | ||
|
|
f6e6c83950 | ||
|
|
2910128399 | ||
|
|
58ad6efadb | ||
|
|
5c0f70a4a2 | ||
|
|
921bb0a4a0 | ||
|
|
10450a350b | ||
|
|
60bce7c0fa | ||
|
|
aa36e56ff6 | ||
|
|
653a4a8f39 | ||
|
|
9b9fa77bc8 | ||
|
|
0427f8e2af | ||
|
|
7b45a86daa | ||
|
|
c94427d150 | ||
|
|
b9179a391e | ||
|
|
ade03fcc7e | ||
|
|
dc2c83d21c | ||
|
|
9c012e02d2 | ||
|
|
47576d50e0 | ||
|
|
782f87fc17 | ||
|
|
bc4b5090b4 | ||
|
|
24dc52741b | ||
|
|
725feb2528 | ||
|
|
196e851fa3 | ||
|
|
633ca5fd2e | ||
|
|
5f0c9889c5 | ||
|
|
1e95898bd5 | ||
|
|
f069f4997a | ||
|
|
4451c5e984 | ||
|
|
1830a32e77 | ||
|
|
b910a2e335 | ||
|
|
4ae5d9495f | ||
|
|
2aa64b62a9 | ||
|
|
c8f2f119f0 | ||
|
|
eeca1f8f50 | ||
|
|
b74034a809 | ||
|
|
b356f26e08 | ||
|
|
c9c3011441 | ||
|
|
d2fcebd84a | ||
|
|
9c47628233 | ||
|
|
28956664cc | ||
|
|
994f303064 | ||
|
|
52a09f4364 | ||
|
|
6abb0f79b6 | ||
|
|
2afd941483 | ||
|
|
fd43c16853 | ||
|
|
c27f971878 | ||
|
|
e48115c557 | ||
|
|
3f0c2d82e8 | ||
|
|
544fbb5e6d | ||
|
|
dfde4d7989 | ||
|
|
d80f0ce906 | ||
|
|
6a6a247b1f | ||
|
|
b7c5a9a509 | ||
|
|
8694cb45e3 | ||
|
|
c075950e93 | ||
|
|
3e555546cd | ||
|
|
63440d051f | ||
|
|
0cd16ee2d7 | ||
|
|
3803286251 | ||
|
|
2d801b535e | ||
|
|
f2189f3780 | ||
|
|
be251919d6 | ||
|
|
bdec479885 | ||
|
|
ed56f21bcb | ||
|
|
76e1248c5f | ||
|
|
b6f12ba822 | ||
|
|
0892532f5c | ||
|
|
99ea536891 | ||
|
|
ad59098b70 | ||
|
|
8f4e839d21 | ||
|
|
994e0f1ee4 | ||
|
|
d0016d6672 | ||
|
|
3c3cd43bf6 | ||
|
|
4cb7e0e239 | ||
|
|
5f00d9f310 | ||
|
|
9393bb9b3f | ||
|
|
120fe69329 | ||
|
|
fd9fdf37d9 | ||
|
|
b857ce4614 | ||
|
|
78450918dc | ||
|
|
3b0b86c4b7 | ||
|
|
335296bc56 | ||
|
|
beca59750a | ||
|
|
a5dc09f7e7 | ||
|
|
2e892c00cd | ||
|
|
d168127e23 | ||
|
|
6ae99fa573 | ||
|
|
d7a30db878 | ||
|
|
8acd7d49a8 | ||
|
|
c65e7a28c7 | ||
|
|
106784d5b4 | ||
|
|
bcbfa193f5 | ||
|
|
0fb6b0a21a | ||
|
|
26e0ecbbd1 | ||
|
|
4c097c5001 | ||
|
|
851c452782 | ||
|
|
f345a70b9f | ||
|
|
8866703ad2 | ||
|
|
0adac5f9fa | ||
|
|
b19e20c82a | ||
|
|
eef76f5734 | ||
|
|
6e3243cde7 | ||
|
|
48292b06d8 | ||
|
|
da1203125e | ||
|
|
e0fcfd2d1d | ||
|
|
b02a3ba421 | ||
|
|
f41c1516ed | ||
|
|
f7d9737950 | ||
|
|
6ab36a36c5 | ||
|
|
640065171b | ||
|
|
b9ac67f6a8 | ||
|
|
def168928c | ||
|
|
db67cf32b1 | ||
|
|
e134e707c9 | ||
|
|
f174bb188e | ||
|
|
c487a0acf4 | ||
|
|
d152a182f3 | ||
|
|
660f65dab6 | ||
|
|
841d44180f | ||
|
|
7c64e75648 | ||
|
|
b6ac318e95 | ||
|
|
b99c316fe0 | ||
|
|
b069b69bcf | ||
|
|
805c2088aa | ||
|
|
baf6c58280 | ||
|
|
dd21ee2eb4 | ||
|
|
d3e5ba557d | ||
|
|
8d10679cac | ||
|
|
8eab5c731e | ||
|
|
93107eb800 | ||
|
|
7c17d9a304 | ||
|
|
3cb7b9ec17 | ||
|
|
9fed78b350 | ||
|
|
c01135f515 | ||
|
|
6bf0c428d5 | ||
|
|
0dbcd23747 | ||
|
|
fdc1834491 | ||
|
|
b684af3f50 | ||
|
|
24b76e63f8 | ||
|
|
d7fd57c431 | ||
|
|
7da91dba9b | ||
|
|
b8e78ccb99 | ||
|
|
8b7494699a | ||
|
|
3b221f7a5a | ||
|
|
ab5ae15257 | ||
|
|
9f2921791d | ||
|
|
200f12803a | ||
|
|
a8e6f90fbf | ||
|
|
8f6ad2fc5e | ||
|
|
4c24f08e73 | ||
|
|
c1c185fc25 | ||
|
|
325217736e | ||
|
|
71b16b5036 | ||
|
|
abc50b3e30 | ||
|
|
44690ffe3b | ||
|
|
153852c87b | ||
|
|
cfc219702c | ||
|
|
623a264cbe | ||
|
|
a616ee7146 | ||
|
|
e3719881e7 | ||
|
|
1cbad7a0df | ||
|
|
a3beb29c82 | ||
|
|
d4882d8add | ||
|
|
56969e32cb | ||
|
|
1015b30a22 | ||
|
|
99ee4afaf8 | ||
|
|
db2647aada | ||
|
|
3543bd1d24 | ||
|
|
da7e070261 | ||
|
|
b107e72459 | ||
|
|
95bfbfcab9 | ||
|
|
887fb80d83 | ||
|
|
efa068c189 | ||
|
|
f368fa077e | ||
|
|
4b6e7678ad | ||
|
|
e1b31afafd | ||
|
|
f875934459 | ||
|
|
e9ab4e1186 | ||
|
|
7278364873 | ||
|
|
291a478290 | ||
|
|
4768817661 | ||
|
|
ebf561f48c | ||
|
|
8bdfd18e1f | ||
|
|
5e48c1036f | ||
|
|
4370e87fea | ||
|
|
0864aef698 | ||
|
|
b898dff53f | ||
|
|
15056a5a6c | ||
|
|
2f5df3e46f | ||
|
|
fd3176c36e | ||
|
|
942bd2baf5 | ||
|
|
db67b97b7a | ||
|
|
c45d42f606 | ||
|
|
401e55a7bd | ||
|
|
5a0158c372 | ||
|
|
2509347330 | ||
|
|
a5bc4bc902 | ||
|
|
7588f21b8f | ||
|
|
78ca8b86a8 | ||
|
|
fc9cb7da9e | ||
|
|
70dacc878c | ||
|
|
0eebd52577 | ||
|
|
100f22bcfe | ||
|
|
36d479380f | ||
|
|
aff728dd5e | ||
|
|
a0c8fa1a84 | ||
|
|
a88990cc73 | ||
|
|
15c03c0aff | ||
|
|
aa3d6803f7 | ||
|
|
0bf8b0a35b | ||
|
|
3fd29ee299 | ||
|
|
1fb62d2964 | ||
|
|
756af81132 | ||
|
|
0ebce80650 | ||
|
|
743311ec19 | ||
|
|
d8237f0687 | ||
|
|
68f3d13d09 | ||
|
|
b9194310a9 | ||
|
|
670078158c | ||
|
|
0f0bea2624 | ||
|
|
82bd15b09c | ||
|
|
9e3b69931f | ||
|
|
b8ed514ca8 | ||
|
|
079ebdb39b | ||
|
|
230a35faf0 | ||
|
|
943e60b47b | ||
|
|
cc67d386b8 | ||
|
|
54384279b2 | ||
|
|
83fcb1fa7b | ||
|
|
a83e2802ed | ||
|
|
27d524c758 | ||
|
|
262e010a08 | ||
|
|
c3a8f0c3d7 | ||
|
|
b045104c3e | ||
|
|
12bc342cc6 | ||
|
|
1a1f351207 | ||
|
|
510d33fd89 | ||
|
|
19c68dada7 | ||
|
|
089b24f505 | ||
|
|
3f6a37a535 | ||
|
|
596331daf3 | ||
|
|
f665d0a590 | ||
|
|
0c6c6c9a91 | ||
|
|
9abdd88a3d | ||
|
|
cdb927da2a | ||
|
|
214fa1538a | ||
|
|
97d74944cb | ||
|
|
f003063b94 | ||
|
|
08132ef566 | ||
|
|
1fbbc0500d | ||
|
|
708ee3b7bd | ||
|
|
3d0afd017a | ||
|
|
bf67852b59 | ||
|
|
105fb61f71 | ||
|
|
d4f81a92e0 | ||
|
|
353a15827b | ||
|
|
6a3bf8c0b3 | ||
|
|
9a20feb417 | ||
|
|
a25ae21074 | ||
|
|
f9428ee6d2 | ||
|
|
3746b608b2 | ||
|
|
769995549d | ||
|
|
98c497b0aa | ||
|
|
96a1c981bc | ||
|
|
82fc187983 | ||
|
|
fc22cc0456 | ||
|
|
b40167c1e2 | ||
|
|
8dd942d070 | ||
|
|
0e810ba308 | ||
|
|
4288680bce | ||
|
|
5d82af6912 | ||
|
|
7607dc9e9d | ||
|
|
0795451801 | ||
|
|
e061c22ab1 | ||
|
|
9562762403 | ||
|
|
c1e961a938 | ||
|
|
c48f44830e | ||
|
|
558f5b0286 | ||
|
|
b1a9cbdabb | ||
|
|
7e494673e0 | ||
|
|
a5434d4428 | ||
|
|
582f1ca294 | ||
|
|
fcebfeae60 | ||
|
|
bb308f87e7 | ||
|
|
5445177055 | ||
|
|
b705f2bed1 | ||
|
|
4a79ef073c | ||
|
|
ce79a80a18 | ||
|
|
9c72628a39 | ||
|
|
61416c3f23 | ||
|
|
27d7dfda02 | ||
|
|
487c638185 | ||
|
|
57eece03d8 | ||
|
|
f62f214e88 | ||
|
|
d33504ff72 | ||
|
|
fc68b5ae0e | ||
|
|
55c52ed5ad | ||
|
|
923a08f7fc | ||
|
|
284d36dd6d | ||
|
|
f648e6db08 | ||
|
|
c771560a7c | ||
|
|
9b89ac19ba | ||
|
|
1d369c13d8 | ||
|
|
ad2c3bb12a | ||
|
|
b951a67b3f | ||
|
|
17f37f0c05 | ||
|
|
c71da72328 | ||
|
|
3c743bd668 | ||
|
|
1e2fdfba58 | ||
|
|
03db260ed6 | ||
|
|
d47cdf8a7b | ||
|
|
8d41ea5eba | ||
|
|
573fd7ba6a | ||
|
|
6425131822 | ||
|
|
d81e91af7b | ||
|
|
f1576f280d | ||
|
|
2692c90106 | ||
|
|
0da5471b3e | ||
|
|
e5a8d695bb | ||
|
|
24b91a73c7 | ||
|
|
1ad3b6ab98 | ||
|
|
7fa869d33c | ||
|
|
4b95eeae06 | ||
|
|
c7e79d9816 | ||
|
|
4d6d9abbc0 | ||
|
|
bc5973bdaf | ||
|
|
f6c7f638a1 |
+19
-2
@@ -1,2 +1,19 @@
|
||||
1
|
||||
0.57.20.57.3
|
||||
2
|
||||
0.57.20.57.3
|
||||
0.66.2
|
||||
0.66.3
|
||||
0.71.2
|
||||
0.71.3
|
||||
|
||||
0.84.2
|
||||
0.84.3
|
||||
0.85.2
|
||||
0.85.3
|
||||
0.85.4
|
||||
0.85.5
|
||||
0.86.2
|
||||
0.86.3
|
||||
0.86.4
|
||||
0.86.5
|
||||
0.86.6
|
||||
0.86.7
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/ui authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const base = require('@polkadot/dev/config/eslint');
|
||||
const base = require('@polkadot/dev/config/eslint.cjs');
|
||||
|
||||
module.exports = {
|
||||
...base,
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
name: 'Lock Threads'
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '25 2 * * *'
|
||||
|
||||
jobs:
|
||||
lock:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/lock-threads@v2
|
||||
with:
|
||||
github-token: ${{ secrets.GH_PAT_BOT }}
|
||||
issue-lock-inactive-days: '7'
|
||||
issue-lock-comment: >
|
||||
This thread has been automatically locked since there has not been
|
||||
any recent activity after it was closed. Please open a new issue
|
||||
if you think you have a related problem or query.
|
||||
pr-lock-inactive-days: '2'
|
||||
pr-lock-comment: >
|
||||
This pull request has been automatically locked since there
|
||||
has not been any recent activity after it was closed.
|
||||
Please open a new issue for related bugs.
|
||||
@@ -6,11 +6,11 @@ on:
|
||||
|
||||
jobs:
|
||||
master:
|
||||
if: "! startsWith(github.event.head_commit.message, '[CI Skip]')"
|
||||
strategy:
|
||||
matrix:
|
||||
step: ['build:release']
|
||||
name: ${{ matrix.step }}
|
||||
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && github.repository == 'polkadot-js/ui'"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -25,10 +25,3 @@ jobs:
|
||||
run: |
|
||||
yarn install --immutable | grep -v 'YN0013'
|
||||
yarn ${{ matrix.step }}
|
||||
|
||||
dummy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: dummy
|
||||
run: |
|
||||
echo "Dummy skip step"
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
name: Semgrep
|
||||
on:
|
||||
pull_request: {}
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
check:
|
||||
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && (!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository)"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: returntocorp/semgrep-action@v1
|
||||
with:
|
||||
auditOn: push
|
||||
publishToken: ${{ secrets.SEMGREP_APP_TOKEN }}
|
||||
publishDeployment: 1395
|
||||
@@ -0,0 +1,17 @@
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '2 40 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GH_PAT_BOT }}
|
||||
stale-issue-message: 'This issue has been open for 21 days with no activity and is not labelled as an enhancement. It will be closed in 7 days.'
|
||||
stale-issue-label: 'stale'
|
||||
exempt-issue-labels: '-size-l,-size-m,-size-s,-size-xl,-size-xs,[bug]'
|
||||
days-before-stale: 21
|
||||
days-before-close: 7
|
||||
@@ -0,0 +1,3 @@
|
||||
build
|
||||
coverage
|
||||
packages
|
||||
@@ -0,0 +1,4 @@
|
||||
// Copyright 2017-2021 @polkadot/ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
module.exports = require('@polkadot/dev/config/prettier.cjs');
|
||||
+46
-9
File diff suppressed because one or more lines are too long
+46
-23
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Vendored
-55
File diff suppressed because one or more lines are too long
+631
File diff suppressed because one or more lines are too long
+1
-3
@@ -9,7 +9,5 @@ plugins:
|
||||
spec: "@yarnpkg/plugin-interactive-tools"
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
|
||||
spec: "@yarnpkg/plugin-version"
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
|
||||
spec: "@yarnpkg/plugin-workspace-tools"
|
||||
|
||||
yarnPath: .yarn/releases/yarn-2.3.3.cjs
|
||||
yarnPath: .yarn/releases/yarn-3.0.1.cjs
|
||||
|
||||
+340
@@ -1,5 +1,345 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 0.87.1 Nov 28, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 8.0.2
|
||||
|
||||
|
||||
## 0.86.7 Nov 22, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 7.9.2
|
||||
|
||||
|
||||
## 0.86.6 Nov 21, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 7.9.1
|
||||
|
||||
|
||||
## 0.86.5 Nov 6, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 7.8.2
|
||||
|
||||
|
||||
## 0.86.4 Nov 6, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 7.8.1
|
||||
|
||||
|
||||
## 0.86.3 Nov 1, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Add publish skip to all examples
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 7.7.1
|
||||
|
||||
|
||||
## 0.86.2 Oct 24, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 7.6.1
|
||||
|
||||
|
||||
## 0.86.1 Oct 16, 2021
|
||||
|
||||
Contributed:
|
||||
|
||||
- Check for existence of `process` before using (Thanks to https://github.com/wirednkod)
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 7.5.1
|
||||
|
||||
|
||||
## 0.85.5 Oct 10, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Update rxjs to 7.4 (aligning with use in API)
|
||||
|
||||
|
||||
## 0.85.4 Sep 17, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 7.4.1
|
||||
|
||||
|
||||
## 0.85.3 Aug 29, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Revert color bump to 4.0.1, keep at 3.2.1 (numeric separators on Vue & react-native)
|
||||
|
||||
|
||||
## 0.85.2 Aug 28, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 7.3.1
|
||||
|
||||
|
||||
## 0.85.1 Aug 15, 2021
|
||||
|
||||
Contributed:
|
||||
|
||||
- Always use `bigint` type to indicate instance (Thanks to https://github.com/ntduan)
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 7.2.1
|
||||
|
||||
|
||||
## 0.84.3 Aug 2, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 7.1.1
|
||||
|
||||
|
||||
## 0.84.2 Jul 26, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 7.0.3
|
||||
|
||||
|
||||
## 0.84.1 Jul 11, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Internal RxJs usage has been bumped to the 7.2 version
|
||||
- Allow building as a completely stand-alone browser bundle (experimental)
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 7.0.1
|
||||
|
||||
|
||||
## 0.83.1 Jul 5, 2021
|
||||
|
||||
Contributed:
|
||||
|
||||
- Add support for notifications setting (Thanks to https://github.com/shawntabrizi)
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 6.11.1
|
||||
|
||||
|
||||
## 0.82.1 Jun 26, 2021
|
||||
|
||||
Contributed:
|
||||
|
||||
- Adjust Qr address imports (Thanks to https://github.com/joelamouche)
|
||||
- Bubble errors on Qr scanning (Thanks to https://github.com/joelamouche)
|
||||
|
||||
Changes:
|
||||
|
||||
- Fix `keyring.setSS58Format` to correctly set for prefix 0
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 6.10.1
|
||||
|
||||
|
||||
## 0.81.1 Jun 20, 2021
|
||||
|
||||
Contributed:
|
||||
|
||||
- Import `ethereum` addresses via QR (Thanks to https://github.com/joelamouche)
|
||||
- Support settings for non-RPC connectors (Thanks to https://github.com/wirednkod)
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 6.9.1
|
||||
- Fix webpack demo import locations
|
||||
|
||||
|
||||
## 0.80.1 Jun 14, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 6.8.1
|
||||
|
||||
|
||||
## 0.79.1 Jun 6, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Add support for WebHID selection (as exposed by ledger packages)
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 6.7.1
|
||||
|
||||
|
||||
## 0.78.1 May 29, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 6.6.1
|
||||
|
||||
|
||||
## 0.77.1 May 25, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 6.5.1
|
||||
|
||||
|
||||
## 0.76.1 May 16, 2021
|
||||
|
||||
Contributed:
|
||||
|
||||
- Pass through injected account types (Thanks to https://github.com/joelamouche)
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 6.4.1
|
||||
|
||||
|
||||
## 0.75.1 Apr 25, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 6.3.1
|
||||
|
||||
|
||||
## 0.74.1 Apr 18, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 6.2.1
|
||||
|
||||
|
||||
## 0.73.1 Apr 12, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 6.1.1
|
||||
|
||||
|
||||
## 0.72.1 Mar 15, 2021
|
||||
|
||||
Contributed:
|
||||
|
||||
- Added support for batch import/export functionality (Thanks to https://github.com/BubbleBear)
|
||||
|
||||
|
||||
## 0.71.3 Mar 8, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 6.0.5
|
||||
|
||||
|
||||
## 0.71.2 Mar 6, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 6.0.4
|
||||
|
||||
|
||||
## 0.71.1 Mar 6, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Build to ESM by default (with cjs versions via export map)
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 6.0.3
|
||||
|
||||
|
||||
## 0.70.1 Feb 28, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Use `detectPackage` with `packageInfo` & check for monorepo dependencies
|
||||
- Remove `mkdirp` resolution to ensure local views work with Webpack
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 5.9.2
|
||||
|
||||
|
||||
## 0.69.1 Feb 7, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 5.6.1
|
||||
|
||||
|
||||
## 0.68.1 Feb 1, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 5.5.1
|
||||
- Added `ed25519-ledger` option for `hdLedger` from `@polkadot/util-crypto`
|
||||
|
||||
|
||||
## 0.67.1 Jan 24, 2021
|
||||
|
||||
Contributed:
|
||||
|
||||
- Store hardware accounts (Thanks to https://github.com/Tbaut)
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 5.4.4
|
||||
- Cleanup dependencies to only have common (no api repo)
|
||||
|
||||
|
||||
## 0.66.1 Jan 17, 2021
|
||||
|
||||
- **Important** Users of the `@polkadot/ledger` package should now import `@polkadot/hw-wallet`
|
||||
|
||||
Contributed:
|
||||
|
||||
- Dock Ledger integration (Thanks to https://github.com/lovesh, moved to common)
|
||||
- Polymesh Ledger integration (https://github.com/adamdossa, moved to common)
|
||||
|
||||
Changes:
|
||||
|
||||
- Remove `@polkadot/ledger` package (Moved to common as `@polkadot/hw-ledger`)
|
||||
- Keyring options genesis allows a `string` | `Hash` (e.g. `api.genesisHash`) input
|
||||
- Updated to `@polkadot/{hw-ledger, keyring, util, util-crypto}` 5.3.1
|
||||
- Removed `@polkadot/types` dependencies (only interface needed, supplied)
|
||||
|
||||
|
||||
## 0.65.1 Dec 28, 2020
|
||||
|
||||
Changes:
|
||||
|
||||
- Updated to `@polkadot/{keyring, util, util-crypto}` 5.2.2
|
||||
- Updated to `@polkadot/api` 3.2.2
|
||||
|
||||
|
||||
## 0.64.1 Dec 21, 2020
|
||||
|
||||
Changes:
|
||||
|
||||
- Don't re-export types from index (esm build compat)
|
||||
- Correctly mark `detectPackage` as a side-effect
|
||||
- Updated to `@polkadot/{keyring, util, util-crypto}` 5.1.1
|
||||
- Updated to `@polkadot/api` 3.1.1
|
||||
|
||||
|
||||
## 0.63.1 Dec 14, 2020
|
||||
|
||||
Contributed:
|
||||
|
||||
- Export types for icons (Thanks to https://github.com/Tbaut)
|
||||
|
||||
Changes:
|
||||
|
||||
- Bump to latest WebUSB from Ledger
|
||||
- Swap Ledger functionality to dedicated packages
|
||||
- Build esm packages alongside cjs
|
||||
- Convert all imports/exports to named
|
||||
- Pass pair type through to all creation actions
|
||||
- Allow for transparent failures on account injection
|
||||
- Swap to using `import type { ... }`
|
||||
- Updated to `@polkadot/{keyring, util, util-crypto}` 5.0.1
|
||||
- Updated to `@polkadot/api` 3.0.1
|
||||
|
||||
|
||||
## 0.62.1 Nov 9, 2020
|
||||
|
||||
Changes:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/ui authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const base = require('@polkadot/dev/config/babel');
|
||||
const base = require('@polkadot/dev/config/babel-config-cjs.cjs');
|
||||
|
||||
module.exports = Object.keys(base).reduce((config, key) => {
|
||||
config[key] = base[key];
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright 2017-2020 @polkadot/ui authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const config = require('@polkadot/dev/config/jest');
|
||||
const config = require('@polkadot/dev/config/jest.cjs');
|
||||
|
||||
module.exports = Object.assign({}, config, {
|
||||
module.exports = {
|
||||
...config,
|
||||
moduleNameMapper: {
|
||||
'@polkadot/react-(identicon|qr)(.*)$': '<rootDir>/packages/react-$1/src/$2',
|
||||
'@polkadot/reactnative-(identicon)(.*)$': '<rootDir>/packages/reactnative-$1/src/$2',
|
||||
@@ -11,5 +12,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: '@polkadot/dev/config/jest-resolver'
|
||||
});
|
||||
testEnvironment: 'jsdom'
|
||||
};
|
||||
+29
-21
@@ -1,47 +1,55 @@
|
||||
{
|
||||
"repository": "https://github.com/polkadot-js/ui",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/ui/issues",
|
||||
"homepage": "https://github.com/polkadot-js/ui#readme",
|
||||
"license": "Apache-2",
|
||||
"packageManager": "yarn@3.0.1",
|
||||
"private": true,
|
||||
"homepage": ".",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/ui.git"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"version": "0.87.1",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"resolutions": {
|
||||
"typescript": "^4.0.5"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "polkadot-dev-build-ts",
|
||||
"build:release": "polkadot-ci-ghact-build",
|
||||
"lint": "polkadot-dev-run-lint",
|
||||
"build:rollup": "polkadot-exec-rollup --config",
|
||||
"clean": "polkadot-dev-clean-build",
|
||||
"demo:identicon:react": "yarn build && webpack-serve --config packages/react-identicon/webpack.config.js --content packages/react-identicon --port 8080",
|
||||
"demo:identicon:vue": "yarn build && webpack-serve --config packages/vue-identicon/webpack.config.js --content packages/vue-identicon --port 8080",
|
||||
"example:rn:packager": "yarn build && cd packages/exampleReactNative && yarn copy-workspace-packages && yarn start",
|
||||
"example:rn:ios": "cd packages/exampleReactNative && cd ios && pod install && cd .. && yarn ios",
|
||||
"example:rn:android": "cd packages/exampleReactNative && yarn android",
|
||||
"example:react": "yarn build && cd packages/example-react && webpack --config webpack.config.js",
|
||||
"example:rn:android": "cd packages/exampleReactNative && yarn android",
|
||||
"example:rn:ios": "cd packages/exampleReactNative && cd ios && pod install && cd .. && yarn ios",
|
||||
"example:rn:packager": "yarn build && cd packages/exampleReactNative && yarn copy-workspace-packages && yarn start",
|
||||
"example:vue": "yarn build && cd packages/example-vue && webpack --config webpack.config.js",
|
||||
"lint": "polkadot-dev-run-lint",
|
||||
"postinstall": "polkadot-dev-yarn-only",
|
||||
"test": "polkadot-dev-run-test --coverage --runInBand",
|
||||
"test:one": "polkadot-dev-run-test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@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/core": "^7.16.0",
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@polkadot/dev": "^0.63.33",
|
||||
"@polkadot/ts": "^0.4.15",
|
||||
"@polkadot/x-bundle": "^8.0.2",
|
||||
"@types/jest": "^27.0.3",
|
||||
"babel-plugin-transform-vue-template": "^0.4.2",
|
||||
"empty": "^0.10.1",
|
||||
"react": "^17.0.1",
|
||||
"react-dom": "^17.0.1",
|
||||
"react-is": "^17.0.1",
|
||||
"react-native": "^0.63.3",
|
||||
"vue-template-compiler": "^2.6.12",
|
||||
"webpack": "^4.44.2",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-is": "^17.0.2",
|
||||
"react-native": "^0.66.3",
|
||||
"vue-template-compiler": "^2.6.14",
|
||||
"webpack": "^4.46.0",
|
||||
"webpack-cli": "^3.3.12",
|
||||
"webpack-serve": "^3.2.0"
|
||||
},
|
||||
"version": "0.62.1"
|
||||
"resolutions": {
|
||||
"typescript": "^4.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
{
|
||||
"name": "@polkadot/example-react",
|
||||
"version": "0.62.1",
|
||||
"description": "A very basic example with ui-* & react-* packages",
|
||||
"main": "index.js",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"bugs": "https://github.com/polkadot-js/ui/issues",
|
||||
"contributors": [],
|
||||
"description": "A very basic example with ui-* & react-* packages",
|
||||
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/example-react#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/example-react",
|
||||
"private": true,
|
||||
"repository": {
|
||||
"directory": "packages/example-react",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/ui.git"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"version": "0.87.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5"
|
||||
"@babel/runtime": "^7.16.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// Copyright 2017-2020 @polkadot/example-react authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/example-react authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import Identicon from '@polkadot/react-identicon';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import settings from '@polkadot/ui-settings';
|
||||
import { mnemonicGenerate, cryptoWaitReady } from '@polkadot/util-crypto';
|
||||
|
||||
import { Identicon } from '@polkadot/react-identicon';
|
||||
import { keyring } from '@polkadot/ui-keyring';
|
||||
import { settings } from '@polkadot/ui-settings';
|
||||
import { cryptoWaitReady, mnemonicGenerate } from '@polkadot/util-crypto';
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/example-react authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/example-react', version: '0.87.1' };
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/example-react authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/example-react authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const path = require('path');
|
||||
@@ -17,7 +17,7 @@ module.exports = {
|
||||
use: [
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: require('../../babel.config.js')
|
||||
options: require('../../babel.config.cjs')
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
{
|
||||
"name": "@polkadot/example-vue",
|
||||
"version": "0.62.1",
|
||||
"description": "A very basic example with ui-* & vue-* packages",
|
||||
"main": "index.js",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"bugs": "https://github.com/polkadot-js/ui/issues",
|
||||
"contributors": [],
|
||||
"description": "A very basic example with ui-* & vue-* packages",
|
||||
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/example-vue#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/example-vue",
|
||||
"private": true,
|
||||
"repository": {
|
||||
"directory": "packages/example-vue",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/ui.git"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"version": "0.87.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5"
|
||||
"@babel/runtime": "^7.16.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// Copyright 2017-2020 @polkadot/example-vue authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/example-vue authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { Prefix } from '@polkadot/util-crypto/address/types';
|
||||
import type { Prefix } from '@polkadot/util-crypto/address/types';
|
||||
|
||||
import Vue, { VNode } from 'vue';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import settings from '@polkadot/ui-settings';
|
||||
import { mnemonicGenerate, cryptoWaitReady } from '@polkadot/util-crypto';
|
||||
|
||||
import { keyring } from '@polkadot/ui-keyring';
|
||||
import { settings } from '@polkadot/ui-settings';
|
||||
import { cryptoWaitReady, mnemonicGenerate } from '@polkadot/util-crypto';
|
||||
import Identicon from '@polkadot/vue-identicon';
|
||||
|
||||
interface Account {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/example-vue authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/example-vue', version: '0.87.1' };
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/example-vue authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/example-vue authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const path = require('path');
|
||||
@@ -18,7 +18,7 @@ module.exports = {
|
||||
use: [
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: require('../../babel.config.js')
|
||||
options: require('../../babel.config.cjs')
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
// Copyright 2017-2020 @polkadot/example-react authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/example-react authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { Button, SafeAreaView, ScrollView, StatusBar, StyleSheet, Text, View } from 'react-native';
|
||||
import { Colors } from 'react-native/Libraries/NewAppScreen';
|
||||
|
||||
import Identicon from '@polkadot/reactnative-identicon';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import settings from '@polkadot/ui-settings';
|
||||
import { mnemonicGenerate, cryptoWaitReady } from '@polkadot/util-crypto';
|
||||
import { keyring } from '@polkadot/ui-keyring';
|
||||
import { settings } from '@polkadot/ui-settings';
|
||||
import { cryptoWaitReady, mnemonicGenerate } from '@polkadot/util-crypto';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
body: {
|
||||
@@ -56,17 +57,22 @@ export default function App (): React.ReactElement | null {
|
||||
const [phrase, setPhrase] = useState<string | null>(null);
|
||||
const [ss58Format, setSS58Format] = useState(42);
|
||||
|
||||
const _onClickNew = (): void => {
|
||||
const phrase = mnemonicGenerate(12);
|
||||
const { address } = keyring.createFromUri(phrase);
|
||||
const _onClickNew = useCallback(
|
||||
(): void => {
|
||||
const phrase = mnemonicGenerate(12);
|
||||
const { address } = keyring.createFromUri(phrase);
|
||||
|
||||
setAddress(keyring.encodeAddress(address, ss58Format));
|
||||
setPhrase(phrase);
|
||||
};
|
||||
setAddress(keyring.encodeAddress(address, ss58Format));
|
||||
setPhrase(phrase);
|
||||
},
|
||||
[ss58Format]
|
||||
);
|
||||
|
||||
const _onChangeSS58Format = (value: string): void => {
|
||||
setSS58Format(parseInt(value, 10));
|
||||
};
|
||||
const _onChangeSS58Format = useCallback(
|
||||
(value: string) =>
|
||||
() => setSS58Format(parseInt(value, 10)),
|
||||
[]
|
||||
);
|
||||
|
||||
useEffect((): void => {
|
||||
isReady && _onClickNew();
|
||||
@@ -107,7 +113,8 @@ export default function App (): React.ReactElement | null {
|
||||
<SafeAreaView>
|
||||
<ScrollView
|
||||
contentInsetAdjustmentBehavior='automatic'
|
||||
style={styles.scrollView}>
|
||||
style={styles.scrollView}
|
||||
>
|
||||
<View style={styles.body}>
|
||||
<View style={styles.sectionContainer}>
|
||||
<Text style={styles.mainTitle}>React-Native Example</Text>
|
||||
@@ -143,7 +150,7 @@ export default function App (): React.ReactElement | null {
|
||||
.map(({ text, value }): React.ReactNode => (
|
||||
<Button
|
||||
key={value}
|
||||
onPress={(): void => _onChangeSS58Format(value.toString())}
|
||||
onPress={_onChangeSS58Format(value.toString())}
|
||||
title={text}
|
||||
/>
|
||||
))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/example-reactnative authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/example-reactnative authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright 2017-2020 @polkadot/example-react authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/example-react authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import './nodeGlobalsShim.js';
|
||||
|
||||
import { AppRegistry } from 'react-native';
|
||||
|
||||
import App from './App';
|
||||
import { name as appName } from './app.json';
|
||||
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
platform :ios, '9.0'
|
||||
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
|
||||
require_relative '../../../node_modules/@react-native-community/cli-platform-ios/native_modules'
|
||||
|
||||
target 'exampleReactNative' do
|
||||
# Pods for exampleReactNative
|
||||
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
|
||||
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
|
||||
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
|
||||
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
|
||||
pod 'React', :path => '../node_modules/react-native/'
|
||||
pod 'React-Core', :path => '../node_modules/react-native/'
|
||||
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
|
||||
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
|
||||
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
|
||||
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
|
||||
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
|
||||
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
|
||||
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
|
||||
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
|
||||
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
|
||||
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
|
||||
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
|
||||
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
|
||||
pod 'FBLazyVector', :path => "../../../node_modules/react-native/Libraries/FBLazyVector"
|
||||
pod 'FBReactNativeSpec', :path => "../../../node_modules/react-native/Libraries/FBReactNativeSpec"
|
||||
pod 'RCTRequired', :path => "../../../node_modules/react-native/Libraries/RCTRequired"
|
||||
pod 'RCTTypeSafety', :path => "../../../node_modules/react-native/Libraries/TypeSafety"
|
||||
pod 'React', :path => '../../../node_modules/react-native/'
|
||||
pod 'React-Core', :path => '../../../node_modules/react-native/'
|
||||
pod 'React-CoreModules', :path => '../../../node_modules/react-native/React/CoreModules'
|
||||
pod 'React-Core/DevSupport', :path => '../../../node_modules/react-native/'
|
||||
pod 'React-RCTActionSheet', :path => '../../../node_modules/react-native/Libraries/ActionSheetIOS'
|
||||
pod 'React-RCTAnimation', :path => '../../../node_modules/react-native/Libraries/NativeAnimation'
|
||||
pod 'React-RCTBlob', :path => '../../../node_modules/react-native/Libraries/Blob'
|
||||
pod 'React-RCTImage', :path => '../../../node_modules/react-native/Libraries/Image'
|
||||
pod 'React-RCTLinking', :path => '../../../node_modules/react-native/Libraries/LinkingIOS'
|
||||
pod 'React-RCTNetwork', :path => '../../../node_modules/react-native/Libraries/Network'
|
||||
pod 'React-RCTSettings', :path => '../../../node_modules/react-native/Libraries/Settings'
|
||||
pod 'React-RCTText', :path => '../../../node_modules/react-native/Libraries/Text'
|
||||
pod 'React-RCTVibration', :path => '../../../node_modules/react-native/Libraries/Vibration'
|
||||
pod 'React-Core/RCTWebSocket', :path => '../../../node_modules/react-native/'
|
||||
|
||||
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
|
||||
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
|
||||
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
|
||||
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
|
||||
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
|
||||
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
|
||||
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
|
||||
pod 'React-cxxreact', :path => '../../../node_modules/react-native/ReactCommon/cxxreact'
|
||||
pod 'React-jsi', :path => '../../../node_modules/react-native/ReactCommon/jsi'
|
||||
pod 'React-jsiexecutor', :path => '../../../node_modules/react-native/ReactCommon/jsiexecutor'
|
||||
pod 'React-jsinspector', :path => '../../../node_modules/react-native/ReactCommon/jsinspector'
|
||||
pod 'ReactCommon/jscallinvoker', :path => "../../../node_modules/react-native/ReactCommon"
|
||||
pod 'ReactCommon/turbomodule/core', :path => "../../../node_modules/react-native/ReactCommon"
|
||||
pod 'Yoga', :path => '../../../node_modules/react-native/ReactCommon/yoga'
|
||||
|
||||
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
|
||||
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
|
||||
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
|
||||
pod 'DoubleConversion', :podspec => '../../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
|
||||
pod 'glog', :podspec => '../../../node_modules/react-native/third-party-podspecs/glog.podspec'
|
||||
pod 'Folly', :podspec => '../../../node_modules/react-native/third-party-podspecs/Folly.podspec'
|
||||
|
||||
|
||||
target 'exampleReactNativeTests' do
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/example-reactnative authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/example-reactnative authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const path = require('path');
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright 2017-2020 @polkadot/example-reactnative authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/example-reactnative authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable no-global-assign */
|
||||
|
||||
import 'fast-text-encoding';
|
||||
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
|
||||
class Storage {
|
||||
@@ -20,27 +21,27 @@ class Storage {
|
||||
this.loading = false;
|
||||
|
||||
return [...data];
|
||||
}
|
||||
};
|
||||
|
||||
getItem = (key) => {
|
||||
return this.dataMap.get(key);
|
||||
}
|
||||
};
|
||||
|
||||
setItem = (key, value) => {
|
||||
this.dataMap.set(key, value);
|
||||
|
||||
return AsyncStorage.setItem(key, value);
|
||||
}
|
||||
};
|
||||
|
||||
remove = (key) => {
|
||||
this.dataMap.delete(key);
|
||||
|
||||
return AsyncStorage.removeItem(key);
|
||||
}
|
||||
};
|
||||
|
||||
saveItem = (item) => {
|
||||
this.dataMap.set(item[0], item[1]);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Set global process variable expected by some classes.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "exampleReactNative",
|
||||
"version": "0.62.1",
|
||||
"version": "0.87.1",
|
||||
"license": "Apache-2.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"copy-workspace-packages": "yarn copy-identicon && yarn copy-ui-shared",
|
||||
@@ -11,32 +12,40 @@
|
||||
"start": "NODE_OPTIONS=--max_old_space_size=8192 react-native start",
|
||||
"test": "jest"
|
||||
},
|
||||
"bugs": "https://github.com/polkadot-js/ui/issues",
|
||||
"homepage": "https://github.com/polkadot-js/ui#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/ui.git",
|
||||
"directory": "packages/exampleReactNative"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"dependencies": {
|
||||
"@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",
|
||||
"@polkadot/keyring": "^8.0.2",
|
||||
"@polkadot/reactnative-identicon": "0.87.1",
|
||||
"@polkadot/ui-keyring": "0.87.1",
|
||||
"@polkadot/ui-settings": "0.87.1",
|
||||
"@polkadot/util": "^8.0.2",
|
||||
"@polkadot/util-crypto": "^8.0.2",
|
||||
"@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": "^17.0.1",
|
||||
"react-native": "^0.63.3",
|
||||
"react": "^17.0.2",
|
||||
"react-native": "^0.66.3",
|
||||
"react-native-crypto": "^2.2.0",
|
||||
"react-native-randombytes": "^3.6.0",
|
||||
"stream-http": "^3.1.1"
|
||||
"react-native-randombytes": "^3.6.1",
|
||||
"stream-http": "^3.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@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.6.3",
|
||||
"metro-react-native-babel-preset": "^0.64.0",
|
||||
"react-test-renderer": "17.0.1"
|
||||
"@babel/core": "^7.16.0",
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@react-native-community/cli-platform-ios": "^6.2.0",
|
||||
"@types/react-test-renderer": "17.0.1",
|
||||
"babel-jest": "^27.3.1",
|
||||
"metro-react-native-babel-preset": "^0.66.2",
|
||||
"react-test-renderer": "17.0.2"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "react-native",
|
||||
|
||||
@@ -1,25 +1,43 @@
|
||||
{
|
||||
"name": "@polkadot/react-identicon",
|
||||
"version": "0.62.1",
|
||||
"description": "Renders an SVG picture representing an address",
|
||||
"main": "index.js",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"bugs": "https://github.com/polkadot-js/ui/issues",
|
||||
"contributors": [],
|
||||
"description": "Renders an SVG picture representing an address",
|
||||
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/react-identicon#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/react-identicon",
|
||||
"repository": {
|
||||
"directory": "packages/react-identicon",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/ui.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "0.87.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@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",
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@polkadot/keyring": "^8.0.2",
|
||||
"@polkadot/ui-settings": "0.87.1",
|
||||
"@polkadot/ui-shared": "0.87.1",
|
||||
"@polkadot/util": "^8.0.2",
|
||||
"@polkadot/util-crypto": "^8.0.2",
|
||||
"color": "^3.2.1",
|
||||
"ethereum-blockies-base64": "^1.0.2",
|
||||
"jdenticon": "2.2.0",
|
||||
"react-copy-to-clipboard": "^5.0.2",
|
||||
"styled-components": "^5.2.1"
|
||||
"jdenticon": "3.1.1",
|
||||
"react-copy-to-clipboard": "^5.0.4",
|
||||
"styled-components": "^5.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react-copy-to-clipboard": "^5.0.2",
|
||||
"@types/react-dom": "^17.0.11",
|
||||
"@types/styled-components": "^5.1.15",
|
||||
"styled-components": "^5.3.3",
|
||||
"xmlserializer": "^0.6.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/keyring": "*",
|
||||
@@ -29,12 +47,5 @@
|
||||
"react-dom": "*",
|
||||
"react-is": "*",
|
||||
"styled-components": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react-copy-to-clipboard": "^4.3.0",
|
||||
"@types/react-dom": "^16.9.9",
|
||||
"@types/styled-components": "^5.1.4",
|
||||
"styled-components": "^5.2.1",
|
||||
"xmlserializer": "^0.6.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
import { encodeAddress, randomAsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import IdentityIcon from '.';
|
||||
import { Identicon } from '.';
|
||||
|
||||
const THEMES = ['beachball', 'polkadot', 'substrate'];
|
||||
|
||||
export default class Demo extends React.PureComponent {
|
||||
public render (): React.ReactNode {
|
||||
public override render (): React.ReactNode {
|
||||
const identities: string[] = [];
|
||||
|
||||
while (identities.length !== 50) {
|
||||
@@ -23,7 +24,7 @@ export default class Demo extends React.PureComponent {
|
||||
<div>
|
||||
<div>
|
||||
{identities.map((value, index): React.ReactNode => (
|
||||
<IdentityIcon
|
||||
<Identicon
|
||||
key={value.toString()}
|
||||
theme={THEMES[index % THEMES.length] as 'empty'}
|
||||
value={value}
|
||||
@@ -32,7 +33,7 @@ export default class Demo extends React.PureComponent {
|
||||
</div>
|
||||
<div>
|
||||
{THEMES.map((theme): React.ReactNode => (
|
||||
<IdentityIcon
|
||||
<Identicon
|
||||
key={theme}
|
||||
theme={theme as 'empty'}
|
||||
value='5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { Prefix } from '@polkadot/util-crypto/address/types';
|
||||
import { IdentityProps as Props, Props as ComponentProps } from './types';
|
||||
import type { Prefix } from '@polkadot/util-crypto/address/types';
|
||||
import type { IdentityProps as Props, Props as ComponentProps } from './types';
|
||||
|
||||
import React from 'react';
|
||||
import CopyToClipboard from 'react-copy-to-clipboard';
|
||||
import styled from 'styled-components';
|
||||
import settings, { ICON_DEFAULT_HOST } from '@polkadot/ui-settings';
|
||||
|
||||
import { ICON_DEFAULT_HOST, settings } from '@polkadot/ui-settings';
|
||||
import { isHex, isU8a, u8aToHex } from '@polkadot/util';
|
||||
import { decodeAddress, encodeAddress, ethereumEncode } from '@polkadot/util-crypto';
|
||||
|
||||
@@ -57,7 +58,7 @@ const Wrapper = styled.div`
|
||||
`;
|
||||
|
||||
class BaseIcon extends React.PureComponent<Props, State> {
|
||||
public state: State = {
|
||||
public override state: State = {
|
||||
address: '',
|
||||
publicKey: '0x'
|
||||
};
|
||||
@@ -97,7 +98,7 @@ class BaseIcon extends React.PureComponent<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
public render (): React.ReactNode {
|
||||
public override render (): React.ReactNode {
|
||||
const { address } = this.state;
|
||||
const wrapped = this.getWrapped(this.state, this.props);
|
||||
|
||||
@@ -143,11 +144,11 @@ class BaseIcon extends React.PureComponent<Props, State> {
|
||||
if (address && onCopy) {
|
||||
onCopy(address);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function Identicon (props: Props): React.ReactElement<Props> {
|
||||
function Icon (props: Props): React.ReactElement<Props> {
|
||||
return <BaseIcon {...props} />;
|
||||
}
|
||||
|
||||
export default React.memo(Identicon);
|
||||
export const Identicon = React.memo(Icon);
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './icons';
|
||||
|
||||
export { Identicon } from './Identicon';
|
||||
export { packageInfo } from './packageInfo';
|
||||
@@ -0,0 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { packageInfo as settingsInfo } from '@polkadot/ui-settings/packageInfo';
|
||||
import { packageInfo as sharedInfo } from '@polkadot/ui-shared/packageInfo';
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import { packageInfo } from './packageInfo';
|
||||
|
||||
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [settingsInfo, sharedInfo]);
|
||||
@@ -1,12 +1,13 @@
|
||||
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { Props } from '../types';
|
||||
import type { Props } from '../types';
|
||||
|
||||
import React, { useCallback } from 'react';
|
||||
|
||||
import { beachballIcon } from '@polkadot/ui-shared';
|
||||
|
||||
function Beachball ({ address, className = '', size, style }: Props): React.ReactElement<Props> {
|
||||
function Identicon ({ address, className = '', size, style }: Props): React.ReactElement<Props> {
|
||||
const updateElem = useCallback(
|
||||
(node: HTMLDivElement): void => {
|
||||
node && node.appendChild(
|
||||
@@ -25,4 +26,4 @@ function Beachball ({ address, className = '', size, style }: Props): React.Reac
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(Beachball);
|
||||
export const Beachball = React.memo(Identicon);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { Props } from '../types';
|
||||
import type { Props } from '../types';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
function Empty ({ className = '', size, style }: Props): React.ReactElement<Props> {
|
||||
function Identicon ({ className = '', size, style }: Props): React.ReactElement<Props> {
|
||||
return (
|
||||
<svg
|
||||
className={className}
|
||||
@@ -17,4 +17,4 @@ function Empty ({ className = '', size, style }: Props): React.ReactElement<Prop
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(Empty);
|
||||
export const Empty = React.memo(Identicon);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { Props } from '../types';
|
||||
import type { 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> {
|
||||
function Identicon ({ address, className = '', style }: Props): React.ReactElement<Props> {
|
||||
const imgSrc = useMemo(
|
||||
() => makeBlockie(address),
|
||||
[address]
|
||||
@@ -22,7 +22,7 @@ function Ethereum ({ address, className = '', style }: Props): React.ReactElemen
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(styled(Ethereum)(({ size }: Props) => `
|
||||
export const Ethereum = React.memo(styled(Identicon)(({ size }: Props) => `
|
||||
display: block;
|
||||
height: ${size}px;
|
||||
width: ${size}px;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { Props } from '../types';
|
||||
import type { Props } from '../types';
|
||||
|
||||
import * as jdenticon from 'jdenticon';
|
||||
import React from 'react';
|
||||
import jdenticon from 'jdenticon';
|
||||
|
||||
function Jdenticon ({ className = '', publicKey, size, style }: Props): React.ReactElement<Props> {
|
||||
function Identicon ({ className = '', publicKey, size, style }: Props): React.ReactElement<Props> {
|
||||
return (
|
||||
<div
|
||||
className={className}
|
||||
@@ -18,4 +18,4 @@ function Jdenticon ({ className = '', publicKey, size, style }: Props): React.Re
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(Jdenticon);
|
||||
export const Jdenticon = React.memo(Identicon);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Copyright 2018-2020 @polkadot/react-identicon authors & contributors
|
||||
// Copyright 2018-2021 @polkadot/react-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Copyright 2018 Paritytech via paritytech/oo7/polkadot-identicon
|
||||
|
||||
// This has been converted from the original version that can be found at
|
||||
@@ -15,10 +16,11 @@
|
||||
// - Move constants to file-level
|
||||
// - Overall it is now just a static component, expecting an address as an input value
|
||||
|
||||
import { Circle } from '@polkadot/ui-shared/icons/types';
|
||||
import { Props } from '../types';
|
||||
import type { Circle } from '@polkadot/ui-shared/icons/types';
|
||||
import type { Props } from '../types';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { polkadotIcon } from '@polkadot/ui-shared';
|
||||
|
||||
function renderCircle ({ cx, cy, fill, r }: Circle, key: number): React.ReactNode {
|
||||
@@ -49,4 +51,4 @@ function Identicon ({ address, className = '', isAlternative = false, size, styl
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(Identicon);
|
||||
export const Polkadot = React.memo(Identicon);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { default as Beachball } from './Beachball';
|
||||
export { default as Empty } from './Empty';
|
||||
export { default as Ethereum } from './Ethereum';
|
||||
export { default as Jdenticon } from './Jdenticon';
|
||||
export { default as Polkadot } from './Polkadot';
|
||||
export { Beachball } from './Beachball';
|
||||
export { Empty } from './Empty';
|
||||
export { Ethereum } from './Ethereum';
|
||||
export { Jdenticon } from './Jdenticon';
|
||||
export { Polkadot } from './Polkadot';
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import Identicon from './Identicon';
|
||||
export * from './icons';
|
||||
import './detectPackage';
|
||||
|
||||
import { Identicon } from './bundle';
|
||||
|
||||
export * from './bundle';
|
||||
|
||||
export default Identicon;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/react-identicon', version: '0.87.1' };
|
||||
@@ -1,7 +1,8 @@
|
||||
// Copyright 2018-2020 @polkadot/react-identicon authors & contributors
|
||||
// Copyright 2018-2021 @polkadot/react-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { Prefix } from '@polkadot/util-crypto/address/types';
|
||||
import type { Prefix } from '@polkadot/util-crypto/address/types';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
export interface BaseProps {
|
||||
@@ -25,6 +26,8 @@ export interface IdentityProps extends BaseProps {
|
||||
onCopy?: (value: string) => void;
|
||||
prefix?: Prefix;
|
||||
size?: number;
|
||||
theme?: 'beachball' | 'empty' | 'ethereum' | 'jdenticon' | 'polkadot' | 'substrate';
|
||||
theme?: IconTheme;
|
||||
value?: string | Uint8Array | null;
|
||||
}
|
||||
|
||||
export type IconTheme = 'beachball' | 'empty' | 'ethereum' | 'jdenticon' | 'polkadot' | 'substrate';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const path = require('path');
|
||||
|
||||
@@ -1,24 +1,32 @@
|
||||
{
|
||||
"name": "@polkadot/react-qr",
|
||||
"version": "0.62.1",
|
||||
"description": "Generates and reads QR codes",
|
||||
"main": "index.js",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"bugs": "https://github.com/polkadot-js/ui/issues",
|
||||
"contributors": [],
|
||||
"description": "Generates and reads QR codes",
|
||||
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/react-qr#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/react-qr",
|
||||
"repository": {
|
||||
"directory": "packages/react-qr",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/ui.git"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"version": "0.87.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@polkadot/util": "^4.0.1",
|
||||
"@polkadot/util-crypto": "^4.0.1",
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@polkadot/util": "^8.0.2",
|
||||
"@polkadot/util-crypto": "^8.0.2",
|
||||
"qrcode-generator": "^1.4.4",
|
||||
"react-qr-reader": "^2.2.1",
|
||||
"styled-components": "^5.2.1"
|
||||
"styled-components": "^5.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react-qr-reader": "^2.1.3",
|
||||
"@types/styled-components": "^5.1.4"
|
||||
"@types/react-qr-reader": "^2.1.4",
|
||||
"@types/styled-components": "^5.1.15"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/util": "*",
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { objectSpread } from '@polkadot/util';
|
||||
import { xxhashAsHex } from '@polkadot/util-crypto';
|
||||
|
||||
import qrcode from './qrcode';
|
||||
import { qrcode } from './qrcode';
|
||||
import { createFrames, createImgSize } from './util';
|
||||
|
||||
interface Props {
|
||||
@@ -34,10 +36,9 @@ const TIMER_INC = 500;
|
||||
function getDataUrl (value: Uint8Array): string {
|
||||
const qr = qrcode(0, 'M');
|
||||
|
||||
// HACK See out qrcode stringToBytes override as used internally. This
|
||||
// will only work for the case where we actuall pass `Bytes` in here
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
qr.addData(value as any, 'Byte');
|
||||
// HACK See our qrcode stringToBytes override as used internally. This
|
||||
// will only work for the case where we actually pass `Bytes` in here
|
||||
qr.addData(value as unknown as string, 'Byte');
|
||||
qr.make();
|
||||
|
||||
return qr.createDataURL(16, 0);
|
||||
@@ -73,11 +74,10 @@ function Display ({ className, size, skipEncoding, style, value }: Props): React
|
||||
// only encode the frames on demand, not above as part of the
|
||||
// state derivation - in the case of large payloads, this should
|
||||
// be slightly more responsive on initial load
|
||||
return {
|
||||
...state,
|
||||
return objectSpread({}, state, {
|
||||
frameIdx,
|
||||
image: getDataUrl(state.frames[frameIdx])
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
timerRef.current.timerId = window.setTimeout(nextFrame, FRAME_DELAY);
|
||||
@@ -130,7 +130,7 @@ function Display ({ className, size, skipEncoding, style, value }: Props): React
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(styled(Display)`
|
||||
export const QrDisplay = React.memo(styled(Display)`
|
||||
.ui--qr-Display {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { QrDisplay } from './Display';
|
||||
import { createAddressPayload } from './util';
|
||||
import QrDisplay from './Display';
|
||||
|
||||
interface Props {
|
||||
address: string;
|
||||
@@ -14,7 +14,7 @@ interface Props {
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
|
||||
function DisplayExtrinsic ({ address, className, genesisHash, size, style }: Props): React.ReactElement<Props> | null {
|
||||
function DisplayAddress ({ address, className, genesisHash, size, style }: Props): React.ReactElement<Props> | null {
|
||||
const data = useMemo(
|
||||
() => createAddressPayload(address, genesisHash),
|
||||
[address, genesisHash]
|
||||
@@ -35,4 +35,4 @@ function DisplayExtrinsic ({ address, className, genesisHash, size, style }: Pro
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(DisplayExtrinsic);
|
||||
export const QrDisplayAddress = React.memo(DisplayAddress);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { QrDisplay } from './Display';
|
||||
import { createSignPayload } from './util';
|
||||
import QrDisplay from './Display';
|
||||
|
||||
interface Props {
|
||||
address: string;
|
||||
@@ -36,4 +36,4 @@ function DisplayPayload ({ address, className, cmd, genesisHash, payload, size,
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(DisplayPayload);
|
||||
export const QrDisplayPayload = React.memo(DisplayPayload);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { NetworkSpecsStruct } from '@polkadot/ui-settings';
|
||||
import type { NetworkSpecsStruct } from '@polkadot/ui-settings/types';
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
import QrDisplay from './Display';
|
||||
|
||||
import { QrDisplay } from './Display';
|
||||
import { encodeString } from './util';
|
||||
|
||||
interface Props {
|
||||
@@ -36,4 +36,4 @@ function DisplayNetworkSpecs ({ className, networkSpecs, size, style }: Props):
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(DisplayNetworkSpecs);
|
||||
export const QrNetworkSpecs = React.memo(DisplayNetworkSpecs);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
@@ -54,7 +54,7 @@ function Scan ({ className, delay = DEFAULT_DELAY, onError = DEFAULT_ERROR, onSc
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(styled(Scan)`
|
||||
export const QrScan = React.memo(styled(Scan)`
|
||||
.ui--qr-Scan {
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import React, { useCallback } from 'react';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
import { decodeAddress } from '@polkadot/util-crypto';
|
||||
|
||||
import { ADDRESS_PREFIX, SEED_PREFIX } from './constants';
|
||||
import QrScan from './Scan';
|
||||
import { QrScan } from './Scan';
|
||||
|
||||
interface ScanType {
|
||||
isAddress: boolean;
|
||||
@@ -21,31 +22,44 @@ interface Props {
|
||||
onScan: (scanned: ScanType) => void;
|
||||
size?: string | number;
|
||||
style?: React.CSSProperties;
|
||||
isEthereum?: boolean
|
||||
}
|
||||
|
||||
function ScanAddress ({ className, onError, onScan, size, style }: Props): React.ReactElement<Props> {
|
||||
function ScanAddress ({ className, isEthereum, onError, onScan, size, style }: Props): React.ReactElement<Props> {
|
||||
const _onScan = useCallback(
|
||||
(data: string | null): void => {
|
||||
if (data) {
|
||||
try {
|
||||
const [prefix, content, genesisHash, ...name] = data.split(':');
|
||||
const isValidPrefix = prefix === ADDRESS_PREFIX || prefix === SEED_PREFIX;
|
||||
let prefix: string, content: string, genesisHash: string, name: string[];
|
||||
|
||||
assert(isValidPrefix, `Invalid prefix received, expected '${ADDRESS_PREFIX}/${SEED_PREFIX}' , found '${prefix}'`);
|
||||
if (!isEthereum) {
|
||||
[prefix, content, genesisHash, ...name] = data.split(':');
|
||||
} else {
|
||||
[prefix, content, ...name] = data.split(':');
|
||||
genesisHash = '';
|
||||
content = content.substring(0, 42);
|
||||
}
|
||||
|
||||
const isAddress = prefix === ADDRESS_PREFIX;
|
||||
const expectedPrefix = (isEthereum ? 'ethereum' : ADDRESS_PREFIX);
|
||||
const isValidPrefix = (prefix === expectedPrefix) || (prefix === SEED_PREFIX);
|
||||
|
||||
if (isAddress) {
|
||||
assert(isValidPrefix, `Invalid prefix received, expected '${expectedPrefix} or ${SEED_PREFIX}' , found '${prefix}'`);
|
||||
|
||||
const isAddress = prefix === expectedPrefix;
|
||||
|
||||
if (isAddress && !isEthereum) {
|
||||
decodeAddress(content);
|
||||
}
|
||||
|
||||
onScan({ content, genesisHash, isAddress, name: name?.length ? name.join(':') : undefined });
|
||||
} catch (error) {
|
||||
onError && onError(error as Error);
|
||||
|
||||
console.error('@polkadot/react-qr:QrScanAddress', (error as Error).message, data);
|
||||
}
|
||||
}
|
||||
},
|
||||
[onScan]
|
||||
[onScan, onError, isEthereum]
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -59,4 +73,4 @@ function ScanAddress ({ className, onError, onScan, size, style }: Props): React
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(ScanAddress);
|
||||
export const QrScanAddress = React.memo(ScanAddress);
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
|
||||
import React, { useCallback } from 'react';
|
||||
|
||||
import QrScan from './Scan';
|
||||
import { QrScan } from './Scan';
|
||||
|
||||
interface ScanType {
|
||||
signature: string;
|
||||
signature: HexString;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
@@ -34,4 +36,4 @@ function ScanSignature ({ className, onError, onScan, size, style }: Props): Rea
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(ScanSignature);
|
||||
export const QrScanSignature = React.memo(ScanSignature);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const ADDRESS_PREFIX = 'substrate';
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { default as QrDisplayAddress } from './DisplayAddress';
|
||||
export { default as QrDisplayPayload } from './DisplayPayload';
|
||||
export { default as QrScanAddress } from './ScanAddress';
|
||||
export { default as QrScanSignature } from './ScanSignature';
|
||||
export { default as QrNetworkSpecs } from './NetworkSpecs';
|
||||
export { QrDisplayAddress } from './DisplayAddress';
|
||||
export { QrDisplayPayload } from './DisplayPayload';
|
||||
export { QrScanAddress } from './ScanAddress';
|
||||
export { QrScanSignature } from './ScanSignature';
|
||||
export { QrNetworkSpecs } from './NetworkSpecs';
|
||||
export { packageInfo } from './packageInfo';
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/react-qr', version: '0.87.1' };
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import _qrcode from 'qrcode-generator';
|
||||
@@ -12,4 +12,4 @@ const qrcode: typeof _qrcode = _qrcode;
|
||||
(qrcode as any).stringToBytes = (data: Uint8Array): Uint8Array =>
|
||||
data;
|
||||
|
||||
export default qrcode;
|
||||
export { qrcode };
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { u8aConcat, u8aToHex, u8aToString } from '@polkadot/util';
|
||||
|
||||
import { createAddressPayload, createSignPayload, createFrames, decodeString, encodeNumber, encodeString } from './util';
|
||||
import { randomAsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import { createAddressPayload, createFrames, createSignPayload, decodeString, encodeNumber, encodeString } from './util';
|
||||
|
||||
describe('util', (): void => {
|
||||
describe('Uint8Array <-> string', (): void => {
|
||||
let u8a: Uint8Array;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { isString, u8aConcat, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
@@ -1,27 +1,38 @@
|
||||
{
|
||||
"name": "@polkadot/reactnative-identicon",
|
||||
"version": "0.62.1",
|
||||
"description": "Renders an SVG picture representing an address",
|
||||
"main": "index.js",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"bugs": "https://github.com/polkadot-js/ui/issues",
|
||||
"contributors": [],
|
||||
"description": "Renders an SVG picture representing an address",
|
||||
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/reactnative-identicon#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/reactnative-identicon",
|
||||
"repository": {
|
||||
"directory": "packages/reactnative-identicon",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/ui.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "0.87.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@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"
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@polkadot/ui-shared": "0.87.1",
|
||||
"@polkadot/util": "^8.0.2",
|
||||
"@polkadot/util-crypto": "^8.0.2",
|
||||
"react-native-svg": "^12.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react-native": "^0.66.6"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/util": "*",
|
||||
"@polkadot/util-crypto": "*",
|
||||
"react": "*",
|
||||
"react-native": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react-native": "^0.63.32"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// Copyright 2017-2020 @polkadot/reactnative-identicon authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/reactnative-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { Prefix } from '@polkadot/util-crypto/address/types';
|
||||
import { Props as ComponentProps } from './types';
|
||||
import type { Prefix } from '@polkadot/util-crypto/address/types';
|
||||
import type { Props as ComponentProps } from './types';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { isHex, isU8a, u8aToHex } from '@polkadot/util';
|
||||
import { decodeAddress, encodeAddress } from '@polkadot/util-crypto';
|
||||
|
||||
@@ -32,7 +33,7 @@ const Components: Record<string, React.ComponentType<ComponentProps>> = {
|
||||
};
|
||||
|
||||
export default class IdentityIcon extends React.PureComponent<Props, State> {
|
||||
public state: State = {
|
||||
public override state: State = {
|
||||
address: '',
|
||||
publicKey: '0x'
|
||||
};
|
||||
@@ -61,7 +62,7 @@ export default class IdentityIcon extends React.PureComponent<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
public render (): React.ReactNode {
|
||||
public override render (): React.ReactNode {
|
||||
const { theme = DEFAULT_THEME, size = DEFAULT_SIZE } = this.props;
|
||||
const { address, publicKey } = this.state;
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// Copyright 2017-2021 @polkadot/reactnative-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { packageInfo as sharedInfo } from '@polkadot/ui-shared/packageInfo';
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import { packageInfo } from './packageInfo';
|
||||
|
||||
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [sharedInfo]);
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/reactnative-identicon authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/reactnative-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { Props } from '../types';
|
||||
import type { Props } from '../types';
|
||||
|
||||
import React from 'react';
|
||||
import { View } from 'react-native';
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// Copyright 2018-2020 @polkadot/reactnative-identicon authors & contributors
|
||||
// Copyright 2018-2021 @polkadot/reactnative-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { Circle as CircleType } from '@polkadot/ui-shared/icons/types';
|
||||
import { Props } from '../types';
|
||||
import type { Circle as CircleType } from '@polkadot/ui-shared/icons/types';
|
||||
import type { Props } from '../types';
|
||||
|
||||
import React from 'react';
|
||||
import { View } from 'react-native';
|
||||
import Svg, { Circle as SvgCircle } from 'react-native-svg';
|
||||
|
||||
import { polkadotIcon } from '@polkadot/ui-shared';
|
||||
|
||||
function renderCircle ({ cx, cy, fill, r }: CircleType, key: number): React.ReactNode {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/reactnative-identicon authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/reactnative-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { default as Empty } from './Empty';
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
// Copyright 2017-2020 @polkadot/reactnative-identicon authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/reactnative-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import './detectPackage';
|
||||
|
||||
import Identicon from './Identicon';
|
||||
|
||||
export * from './icons';
|
||||
export { packageInfo } from './packageInfo';
|
||||
|
||||
export default Identicon;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/reactnative-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/reactnative-identicon', version: '0.87.1' };
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2018-2020 @polkadot/reactnative-identicon authors & contributors
|
||||
// Copyright 2018-2021 @polkadot/reactnative-identicon authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export interface Props {
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
{
|
||||
"name": "@polkadot/ui-assets",
|
||||
"version": "0.62.1",
|
||||
"description": "Static assets shared accross projects",
|
||||
"main": "index.js",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"bugs": "https://github.com/polkadot-js/ui/issues",
|
||||
"contributors": [],
|
||||
"description": "Static assets shared accross projects",
|
||||
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-assets#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/ui-assets",
|
||||
"repository": {
|
||||
"directory": "packages/ui-assets",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/ui.git"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"version": "0.87.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5"
|
||||
"@babel/runtime": "^7.16.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// Copyright 2017-2021 @polkadot/ui-assets authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// empty
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/ui-assets authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/ui-assets', version: '0.87.1' };
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-assets authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/ui-assets authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
declare module '*.svg' {
|
||||
|
||||
@@ -40,7 +40,7 @@ import accountObservable from '@polkadot/ui-keyring/observable/accounts';
|
||||
import { SingleAddress, SubjectInfo } from '@polkadot/ui-keyring/observable/types';
|
||||
import React from 'react';
|
||||
import { Subscribe } from 'react-with-observable';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { map } from 'rxjs';
|
||||
|
||||
class MyReactComponent extends React.PureComponent {
|
||||
render () {
|
||||
|
||||
@@ -1,42 +1,37 @@
|
||||
{
|
||||
"name": "@polkadot/ui-keyring",
|
||||
"version": "0.62.1",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"bugs": "https://github.com/polkadot-js/ui/issues",
|
||||
"contributors": [],
|
||||
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-keyring#readme",
|
||||
"license": "Apache-2.0",
|
||||
"browser": {
|
||||
"./ledger/transportsNode": "./ledger/transportsEmpty"
|
||||
},
|
||||
"react-native": {
|
||||
"./ledger/transportsNode": "./ledger/transportsEmpty",
|
||||
"./ledger/transportsWeb": "./ledger/transportsEmpty"
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/ui-keyring",
|
||||
"repository": {
|
||||
"directory": "packages/ui-keyring",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/ui.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "0.87.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@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",
|
||||
"@babel/runtime": "^7.16.3",
|
||||
"@polkadot/hw-ledger": "^8.0.2",
|
||||
"@polkadot/keyring": "^8.0.2",
|
||||
"@polkadot/ui-settings": "0.87.1",
|
||||
"@polkadot/util": "^8.0.2",
|
||||
"mkdirp": "^1.0.4",
|
||||
"rxjs": "^6.6.3",
|
||||
"rxjs": "^7.4.0",
|
||||
"store": "^2.0.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@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/mkdirp": "^1.0.2",
|
||||
"@types/store": "^2.0.2"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@ledgerhq/hw-transport-node-hid": "^5.28.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/keyring": "*",
|
||||
"@polkadot/ui-settings": "*",
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { KeyringInstance, KeyringPair } from '@polkadot/keyring/types';
|
||||
import { Prefix } from '@polkadot/util-crypto/address/types';
|
||||
import { AddressSubject } from './observable/types';
|
||||
import { KeyringOptions, KeyringStore } from './types';
|
||||
import type { KeyringInstance, KeyringPair } from '@polkadot/keyring/types';
|
||||
import type { Prefix } from '@polkadot/util-crypto/address/types';
|
||||
import type { AddressSubject } from './observable/types';
|
||||
import type { KeyringOptions, KeyringStore } from './types';
|
||||
|
||||
import testKeyring from '@polkadot/keyring/testing';
|
||||
import { isBoolean, isString } from '@polkadot/util';
|
||||
import { createTestKeyring } from '@polkadot/keyring';
|
||||
import { isBoolean, isNumber, isString } from '@polkadot/util';
|
||||
|
||||
import accounts from './observable/accounts';
|
||||
import addresses from './observable/addresses';
|
||||
import contracts from './observable/contracts';
|
||||
import env from './observable/development';
|
||||
import BrowserStore from './stores/Browser'; // direct import (skip index with all)
|
||||
import { accounts } from './observable/accounts';
|
||||
import { addresses } from './observable/addresses';
|
||||
import { contracts } from './observable/contracts';
|
||||
import { env } from './observable/env';
|
||||
import { BrowserStore } from './stores/Browser'; // direct import (skip index with all)
|
||||
|
||||
export default class Base {
|
||||
export class Base {
|
||||
#accounts: AddressSubject;
|
||||
|
||||
#addresses: AddressSubject;
|
||||
@@ -61,11 +61,11 @@ export default class Base {
|
||||
|
||||
public decodeAddress = (key: string | Uint8Array, ignoreChecksum?: boolean, ss58Format?: Prefix): Uint8Array => {
|
||||
return this.keyring.decodeAddress(key, ignoreChecksum, ss58Format);
|
||||
}
|
||||
};
|
||||
|
||||
public encodeAddress = (key: string | Uint8Array, ss58Format?: Prefix): string => {
|
||||
return this.keyring.encodeAddress(key, ss58Format);
|
||||
}
|
||||
};
|
||||
|
||||
public getPair (address: string | Uint8Array): KeyringPair {
|
||||
return this.keyring.getPair(address);
|
||||
@@ -93,7 +93,7 @@ export default class Base {
|
||||
}
|
||||
|
||||
public setSS58Format (ss58Format?: Prefix): void {
|
||||
if (this.#keyring && ss58Format) {
|
||||
if (this.#keyring && isNumber(ss58Format)) {
|
||||
this.#keyring.setSS58Format(ss58Format);
|
||||
}
|
||||
}
|
||||
@@ -103,14 +103,18 @@ export default class Base {
|
||||
}
|
||||
|
||||
protected initKeyring (options: KeyringOptions): void {
|
||||
const keyring = testKeyring(options, true);
|
||||
const keyring = createTestKeyring(options, true);
|
||||
|
||||
if (isBoolean(options.isDevelopment)) {
|
||||
this.setDevMode(options.isDevelopment);
|
||||
}
|
||||
|
||||
this.#keyring = keyring;
|
||||
this._genesisHash = options.genesisHash && options.genesisHash.toHex();
|
||||
this._genesisHash = options.genesisHash && (
|
||||
isString(options.genesisHash)
|
||||
? options.genesisHash.toString()
|
||||
: options.genesisHash.toHex()
|
||||
);
|
||||
this._store = options.store || this._store;
|
||||
|
||||
this.addAccountPairs();
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { KeyringPair, KeyringPair$Meta, KeyringPair$Json } from '@polkadot/keyring/types';
|
||||
import { KeypairType } from '@polkadot/util-crypto/types';
|
||||
import { AddressSubject, SingleAddress } from './observable/types';
|
||||
import { CreateResult, KeyringAddress, KeyringAddressType, KeyringItemType, KeyringJson, KeyringJson$Meta, KeyringOptions, KeyringStruct } from './types';
|
||||
import type BN from 'bn.js';
|
||||
import type { KeyringPair, KeyringPair$Json, KeyringPair$Meta } from '@polkadot/keyring/types';
|
||||
import type { EncryptedJson } from '@polkadot/util-crypto/json/types';
|
||||
import type { KeypairType } from '@polkadot/util-crypto/types';
|
||||
import type { AddressSubject, SingleAddress } from './observable/types';
|
||||
import type { CreateResult, KeyringAddress, KeyringAddressType, KeyringItemType, KeyringJson, KeyringJson$Meta, KeyringOptions, KeyringPairs$Json, KeyringStruct } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import createPair from '@polkadot/keyring/pair';
|
||||
import chains from '@polkadot/ui-settings/defaults/chains';
|
||||
import { bnToBn, hexToU8a, isHex, isString, u8aSorted } from '@polkadot/util';
|
||||
import { base64Decode, createKeyMulti } from '@polkadot/util-crypto';
|
||||
import { createPair } from '@polkadot/keyring';
|
||||
import { chains } from '@polkadot/ui-settings';
|
||||
import { bnToBn, hexToU8a, isHex, isString, objectSpread, stringToU8a, u8aSorted, u8aToString } from '@polkadot/util';
|
||||
import { base64Decode, createKeyMulti, jsonDecrypt, jsonEncrypt } from '@polkadot/util-crypto';
|
||||
|
||||
import env from './observable/development';
|
||||
import Base from './Base';
|
||||
import { accountKey, addressKey, accountRegex, addressRegex, contractKey, contractRegex } from './defaults';
|
||||
import keyringOption from './options';
|
||||
import { env } from './observable/env';
|
||||
import { Base } from './Base';
|
||||
import { accountKey, accountRegex, addressKey, addressRegex, contractKey, contractRegex } from './defaults';
|
||||
import { KeyringOption } from './options';
|
||||
|
||||
const RECENT_EXPIRY = 24 * 60 * 60;
|
||||
|
||||
@@ -23,6 +24,8 @@ const RECENT_EXPIRY = 24 * 60 * 60;
|
||||
// Chain determination occurs outside of Keyring. Loading `keyring.loadAll({ type: 'ed25519' | 'sr25519' })` is triggered
|
||||
// from the API after the chain is received
|
||||
export class Keyring extends Base implements KeyringStruct {
|
||||
public readonly keyringOption = new KeyringOption();
|
||||
|
||||
#stores = {
|
||||
account: (): AddressSubject => this.accounts,
|
||||
address: (): AddressSubject => this.addresses,
|
||||
@@ -30,7 +33,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
};
|
||||
|
||||
public addExternal (address: string | Uint8Array, meta: KeyringPair$Meta = {}): CreateResult {
|
||||
const pair = this.keyring.addFromAddress(address, { ...meta, isExternal: true }, null);
|
||||
const pair = this.keyring.addFromAddress(address, objectSpread<KeyringJson$Meta>({}, meta, { isExternal: true }), null);
|
||||
|
||||
return {
|
||||
json: this.saveAccount(pair),
|
||||
@@ -39,16 +42,16 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
}
|
||||
|
||||
public addHardware (address: string | Uint8Array, hardwareType: string, meta: KeyringPair$Meta = {}): CreateResult {
|
||||
return this.addExternal(address, { ...meta, hardwareType, isHardware: true });
|
||||
return this.addExternal(address, objectSpread<KeyringPair$Meta>({}, meta, { hardwareType, isHardware: true }));
|
||||
}
|
||||
|
||||
public addMultisig (addresses: (string | Uint8Array)[], threshold: BigInt | BN | number, meta: KeyringPair$Meta = {}): CreateResult {
|
||||
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 });
|
||||
return this.addExternal(address, objectSpread<KeyringPair$Meta>({}, meta, { isMultisig: true, threshold: bnToBn(threshold).toNumber(), who }));
|
||||
}
|
||||
|
||||
public addPair (pair: KeyringPair, password: string): CreateResult {
|
||||
@@ -79,8 +82,29 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
return pair.toJson(password);
|
||||
}
|
||||
|
||||
public async backupAccounts (addresses: string[], password: string): Promise<KeyringPairs$Json> {
|
||||
const accountPromises = addresses.map((address) => {
|
||||
return new Promise<KeyringJson>((resolve) => {
|
||||
this._store.get(accountKey(address), resolve);
|
||||
});
|
||||
});
|
||||
|
||||
const accounts = await Promise.all(accountPromises);
|
||||
|
||||
return objectSpread({}, jsonEncrypt(stringToU8a(JSON.stringify(accounts)), ['batch-pkcs8'], password), {
|
||||
accounts: accounts.map((account) => ({
|
||||
address: account.address,
|
||||
meta: account.meta
|
||||
}))
|
||||
});
|
||||
}
|
||||
|
||||
public createFromJson (json: KeyringPair$Json, meta: KeyringPair$Meta = {}): KeyringPair {
|
||||
return this.keyring.createFromJson({ ...json, meta: { ...(json.meta || {}), meta } });
|
||||
return this.keyring.createFromJson(
|
||||
objectSpread({}, json, {
|
||||
meta: objectSpread({}, json.meta, meta)
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public createFromUri (suri: string, meta: KeyringPair$Meta = {}, type?: KeypairType): KeyringPair {
|
||||
@@ -93,7 +117,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
json.meta.whenEdited = Date.now();
|
||||
|
||||
this.keyring.addFromJson(json);
|
||||
this.accounts.add(this._store, pair.address, json);
|
||||
this.accounts.add(this._store, pair.address, json, pair.type);
|
||||
}
|
||||
|
||||
public forgetAccount (address: string): void {
|
||||
@@ -119,7 +143,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
return Object
|
||||
.keys(available)
|
||||
.map((address): KeyringAddress => this.getAddress(address, 'account') as KeyringAddress)
|
||||
.filter((account): boolean => env.isDevelopment() || account.meta.isTesting !== true);
|
||||
.filter((account) => env.isDevelopment() || account.meta.isTesting !== true);
|
||||
}
|
||||
|
||||
public getAddress (_address: string | Uint8Array, type: KeyringItemType | null = null): KeyringAddress | undefined {
|
||||
@@ -178,7 +202,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
// FIXME Just for the transition period (ignoreChecksum)
|
||||
const pair = this.keyring.addFromJson(json as KeyringPair$Json, true);
|
||||
|
||||
this.accounts.add(this._store, pair.address, json);
|
||||
this.accounts.add(this._store, pair.address, json, pair.type);
|
||||
}
|
||||
|
||||
const [, hexAddr] = key.split(':');
|
||||
@@ -225,17 +249,14 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
this.rewriteKey(json, key, hexAddr, contractKey);
|
||||
}
|
||||
|
||||
private loadInjected (address: string, meta: KeyringJson$Meta): void {
|
||||
private loadInjected (address: string, meta: KeyringJson$Meta, type?: KeypairType): void {
|
||||
const json = {
|
||||
address,
|
||||
meta: {
|
||||
...meta,
|
||||
isInjected: true
|
||||
}
|
||||
meta: objectSpread<KeyringJson$Meta>({}, meta, { isInjected: true })
|
||||
};
|
||||
const pair = this.keyring.addFromAddress(address, json.meta);
|
||||
const pair = this.keyring.addFromAddress(address, json.meta, null, type);
|
||||
|
||||
this.accounts.add(this._store, pair.address, json);
|
||||
this.accounts.add(this._store, pair.address, json, pair.type);
|
||||
}
|
||||
|
||||
private allowGenesis (json?: KeyringJson | { meta: KeyringJson$Meta } | null): boolean {
|
||||
@@ -254,37 +275,45 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
return true;
|
||||
}
|
||||
|
||||
public loadAll (options: KeyringOptions, injected: { address: string; meta: KeyringJson$Meta }[] = []): void {
|
||||
public loadAll (options: KeyringOptions, injected: { address: string; meta: KeyringJson$Meta, type?: KeypairType }[] = []): void {
|
||||
super.initKeyring(options);
|
||||
|
||||
this._store.all((key: string, json: KeyringJson): void => {
|
||||
if (options.filter ? options.filter(json) : true) {
|
||||
if (this.allowGenesis(json)) {
|
||||
if (accountRegex.test(key)) {
|
||||
this.loadAccount(json, key);
|
||||
} else if (addressRegex.test(key)) {
|
||||
this.loadAddress(json, key);
|
||||
} else if (contractRegex.test(key)) {
|
||||
this.loadContract(json, key);
|
||||
try {
|
||||
if (this.allowGenesis(json)) {
|
||||
if (accountRegex.test(key)) {
|
||||
this.loadAccount(json, key);
|
||||
} else if (addressRegex.test(key)) {
|
||||
this.loadAddress(json, key);
|
||||
} else if (contractRegex.test(key)) {
|
||||
this.loadContract(json, key);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
injected.forEach((account): void => {
|
||||
if (this.allowGenesis(account)) {
|
||||
this.loadInjected(account.address, account.meta);
|
||||
try {
|
||||
this.loadInjected(account.address, account.meta, account.type);
|
||||
} catch (error) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
keyringOption.init(this);
|
||||
this.keyringOption.init(this);
|
||||
}
|
||||
|
||||
public restoreAccount (json: KeyringPair$Json, password: string): KeyringPair {
|
||||
const cryptoType = Array.isArray(json.encoding.content) ? json.encoding.content[1] : 'ed25519';
|
||||
const encType = Array.isArray(json.encoding.type) ? json.encoding.type : [json.encoding.type];
|
||||
const pair = createPair(
|
||||
{ toSS58: this.encodeAddress, type: cryptoType },
|
||||
{ toSS58: this.encodeAddress, type: cryptoType as KeypairType },
|
||||
{ publicKey: this.decodeAddress(json.address, true) },
|
||||
json.meta,
|
||||
isHex(json.encoded) ? hexToU8a(json.encoded) : base64Decode(json.encoded),
|
||||
@@ -299,13 +328,21 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
return pair;
|
||||
}
|
||||
|
||||
public restoreAccounts (json: EncryptedJson, password: string): void {
|
||||
const accounts: KeyringJson[] = JSON.parse(u8aToString(jsonDecrypt(json, password))) as KeyringJson[];
|
||||
|
||||
accounts.forEach((account) => {
|
||||
this.loadAccount(account, accountKey(account.address));
|
||||
});
|
||||
}
|
||||
|
||||
public saveAccount (pair: KeyringPair, password?: string): KeyringPair$Json {
|
||||
this.addTimestamp(pair);
|
||||
|
||||
const json = pair.toJson(password);
|
||||
|
||||
this.keyring.addFromJson(json);
|
||||
this.accounts.add(this._store, pair.address, json);
|
||||
this.accounts.add(this._store, pair.address, json, pair.type);
|
||||
|
||||
return json;
|
||||
}
|
||||
@@ -317,7 +354,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
pair.setMeta(meta);
|
||||
json.meta = pair.meta;
|
||||
|
||||
this.accounts.add(this._store, address, json);
|
||||
this.accounts.add(this._store, address, json, pair.type);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -364,7 +401,3 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
return this.addresses.subject.getValue()[address];
|
||||
}
|
||||
}
|
||||
|
||||
const keyringInstance = new Keyring();
|
||||
|
||||
export default keyringInstance;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright 2017-2021 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { Keyring } from './Keyring';
|
||||
|
||||
export { Ledger } from '@polkadot/hw-ledger';
|
||||
export { packageInfo } from './packageInfo';
|
||||
|
||||
const keyring = new Keyring();
|
||||
|
||||
export { Keyring, keyring };
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
import { decodeAddress } from '@polkadot/keyring';
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
|
||||
const ACCOUNT_PREFIX = 'account:';
|
||||
const ADDRESS_PREFIX = 'address:';
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// Copyright 2017-2021 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { packageInfo as settingsInfo } from '@polkadot/ui-settings/packageInfo';
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import { packageInfo } from './packageInfo';
|
||||
|
||||
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [settingsInfo]);
|
||||
@@ -1,17 +1,10 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
import './detectPackage';
|
||||
|
||||
import keyring, { Keyring } from './Keyring';
|
||||
import Ledger from './ledger';
|
||||
import { keyring } from './bundle';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
detectPackage(require('./package.json'), typeof __dirname !== 'undefined' && __dirname);
|
||||
export * from './bundle';
|
||||
|
||||
export default keyring;
|
||||
|
||||
export {
|
||||
Keyring,
|
||||
Ledger
|
||||
};
|
||||
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// Copyright 2017-2021 @polkadot/util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Be able to import json in TS
|
||||
// https://stackoverflow.com/questions/49996456/importing-json-file-in-typescript
|
||||
declare module '*.json' {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const value: any;
|
||||
|
||||
export default value;
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import Transport from '@ledgerhq/hw-transport';
|
||||
import { AccountOptions, LedgerAddress, LedgerSignature, LedgerTypes, LedgerVersion } from './types';
|
||||
|
||||
import { ResponseBase, SubstrateApp, newKusamaApp, newPolkadotApp } from '@zondax/ledger-polkadot';
|
||||
import { assert, bufferToU8a, u8aToBuffer, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import allNode from './transportsNode';
|
||||
import allWeb from './transportsWeb';
|
||||
|
||||
export const LEDGER_DEFAULT_ACCOUNT = 0x80000000;
|
||||
|
||||
export const LEDGER_DEFAULT_CHANGE = 0x80000000;
|
||||
|
||||
export const LEDGER_DEFAULT_INDEX = 0x80000000;
|
||||
|
||||
const SUCCESS_CODE = 0x9000;
|
||||
|
||||
const transports = allNode.concat(allWeb);
|
||||
|
||||
const APPS: Record<string, (transport: Transport) => SubstrateApp> = {
|
||||
kusama: newKusamaApp,
|
||||
polkadot: newPolkadotApp
|
||||
};
|
||||
|
||||
type Chain = keyof typeof APPS;
|
||||
|
||||
// A very basic wrapper for a ledger app -
|
||||
// - it connects automatically, creating an app as required
|
||||
// - Promises return errors (instead of wrapper errors)
|
||||
export default class Ledger {
|
||||
#app: SubstrateApp | null = null;
|
||||
|
||||
#chain: Chain;
|
||||
|
||||
#transport: LedgerTypes;
|
||||
|
||||
constructor (transport: LedgerTypes, chain: Chain) {
|
||||
// u2f is deprecated
|
||||
assert(['hid', 'webusb'].includes(transport), `Unsupported transport ${transport}`);
|
||||
assert(Object.keys(APPS).includes(chain), `Unsupported chain ${chain}`);
|
||||
|
||||
this.#chain = chain;
|
||||
this.#transport = transport;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
assert(def, `Unable to find a transport for ${this.#transport}`);
|
||||
|
||||
const transport = await def.create();
|
||||
|
||||
this.#app = APPS[this.#chain](transport);
|
||||
}
|
||||
|
||||
return this.#app;
|
||||
};
|
||||
|
||||
#withApp = async <T> (fn: (app: SubstrateApp) => Promise<T>): Promise<T> => {
|
||||
try {
|
||||
const app = await this.#getApp();
|
||||
|
||||
return await fn(app);
|
||||
} catch (error) {
|
||||
this.#app = null;
|
||||
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
#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;
|
||||
};
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TransportDef } from './types';
|
||||
|
||||
const transports: TransportDef[] = [];
|
||||
|
||||
export default transports;
|
||||
@@ -1,17 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TransportDef } from './types';
|
||||
|
||||
import Transport from '@ledgerhq/hw-transport';
|
||||
import LedgerHid from '@ledgerhq/hw-transport-node-hid';
|
||||
|
||||
const transports: TransportDef[] = [
|
||||
{
|
||||
create: (): Promise<Transport> =>
|
||||
LedgerHid.create(),
|
||||
type: 'hid'
|
||||
}
|
||||
];
|
||||
|
||||
export default transports;
|
||||
@@ -1,24 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TransportDef } from './types';
|
||||
|
||||
import Transport from '@ledgerhq/hw-transport';
|
||||
import LedgerWebUSB from '@ledgerhq/hw-transport-webusb';
|
||||
|
||||
const transports: TransportDef[] = [
|
||||
// deprecated
|
||||
// import LedgerU2F from '@ledgerhq/hw-transport-u2f';
|
||||
// {
|
||||
// create: (): Promise<Transport> =>
|
||||
// LedgerU2F.create(),
|
||||
// type: 'u2f'
|
||||
// },
|
||||
{
|
||||
create: (): Promise<Transport> =>
|
||||
LedgerWebUSB.create(),
|
||||
type: 'webusb'
|
||||
}
|
||||
];
|
||||
|
||||
export default transports;
|
||||
@@ -1,32 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import Transport from '@ledgerhq/hw-transport';
|
||||
|
||||
export type LedgerTypes = 'hid' | 'u2f' | 'webusb';
|
||||
|
||||
export interface AccountOptions {
|
||||
account: number;
|
||||
addressIndex: number;
|
||||
change: number;
|
||||
}
|
||||
|
||||
export interface LedgerAddress {
|
||||
address: string;
|
||||
publicKey: string;
|
||||
}
|
||||
|
||||
export interface LedgerSignature {
|
||||
signature: string;
|
||||
}
|
||||
|
||||
export interface LedgerVersion {
|
||||
isLocked: boolean;
|
||||
isTestMode: boolean;
|
||||
version: [number, number, number];
|
||||
}
|
||||
|
||||
export interface TransportDef {
|
||||
create (): Promise<Transport>;
|
||||
type: LedgerTypes;
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { accountKey } from '../defaults';
|
||||
import { genericSubject } from './genericSubject';
|
||||
|
||||
import genericSubject from './genericSubject';
|
||||
|
||||
export default genericSubject(accountKey, true);
|
||||
export const accounts = genericSubject(accountKey, true);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { addressKey } from '../defaults';
|
||||
import { genericSubject } from './genericSubject';
|
||||
|
||||
import genericSubject from './genericSubject';
|
||||
|
||||
export default genericSubject(addressKey);
|
||||
export const addresses = genericSubject(addressKey);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { contractKey } from '../defaults';
|
||||
import { genericSubject } from './genericSubject';
|
||||
|
||||
import genericSubject from './genericSubject';
|
||||
|
||||
export default genericSubject(contractKey);
|
||||
export const contracts = genericSubject(contractKey);
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
const subject = new BehaviorSubject(false);
|
||||
|
||||
export default {
|
||||
export const env = {
|
||||
isDevelopment: (): boolean =>
|
||||
subject.getValue(),
|
||||
set: (isDevelopment: boolean): void => {
|
||||
@@ -1,16 +1,19 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { SubjectInfo, AddressSubject, SingleAddress } from './types';
|
||||
import { KeyringJson, KeyringStore } from '../types';
|
||||
import type { KeypairType } from '@polkadot/util-crypto/types';
|
||||
import type { KeyringJson, KeyringStore } from '../types';
|
||||
import type { AddressSubject, SingleAddress, SubjectInfo } from './types';
|
||||
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
import createOptionItem from '../options/item';
|
||||
import development from './development';
|
||||
import { objectCopy, objectSpread } from '@polkadot/util';
|
||||
|
||||
import { createOptionItem } from '../options/item';
|
||||
import { env } from './env';
|
||||
|
||||
function callNext (current: SubjectInfo, subject: BehaviorSubject<SubjectInfo>, withTest: boolean): void {
|
||||
const isDevMode = development.isDevelopment();
|
||||
const isDevMode = env.isDevelopment();
|
||||
const filtered: SubjectInfo = {};
|
||||
|
||||
Object.keys(current).forEach((key): void => {
|
||||
@@ -24,24 +27,25 @@ function callNext (current: SubjectInfo, subject: BehaviorSubject<SubjectInfo>,
|
||||
subject.next(filtered);
|
||||
}
|
||||
|
||||
export default function genericSubject (keyCreator: (address: string) => string, withTest = false): AddressSubject {
|
||||
export function genericSubject (keyCreator: (address: string) => string, withTest = false): AddressSubject {
|
||||
let current: SubjectInfo = {};
|
||||
const subject = new BehaviorSubject({});
|
||||
const next = (): void => callNext(current, subject, withTest);
|
||||
|
||||
development.subject.subscribe(next);
|
||||
env.subject.subscribe(next);
|
||||
|
||||
return {
|
||||
add: (store: KeyringStore, address: string, json: KeyringJson): SingleAddress => {
|
||||
current = { ...current };
|
||||
add: (store: KeyringStore, address: string, json: KeyringJson, type?: KeypairType): SingleAddress => {
|
||||
current = objectCopy(current);
|
||||
|
||||
current[address] = {
|
||||
json: { ...json, address },
|
||||
option: createOptionItem(address, json.meta.name)
|
||||
json: objectSpread({}, json, { address }),
|
||||
option: createOptionItem(address, json.meta.name),
|
||||
type
|
||||
};
|
||||
|
||||
// we do not store dev accounts, injected or hardware (the latter two are external/transient)
|
||||
if (!json.meta.isInjected && !json.meta.isHardware && (!json.meta.isTesting || development.isDevelopment())) {
|
||||
// we do not store dev or injected accounts (external/transient)
|
||||
if (!json.meta.isInjected && (!json.meta.isTesting || env.isDevelopment())) {
|
||||
store.set(keyCreator(address), json);
|
||||
}
|
||||
|
||||
@@ -50,7 +54,7 @@ export default function genericSubject (keyCreator: (address: string) => string,
|
||||
return current[address];
|
||||
},
|
||||
remove: (store: KeyringStore, address: string): void => {
|
||||
current = { ...current };
|
||||
current = objectCopy(current);
|
||||
|
||||
delete current[address];
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { SubjectInfo } from './types';
|
||||
import type { SubjectInfo } from './types';
|
||||
|
||||
import { combineLatest } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { combineLatest, map } from 'rxjs';
|
||||
|
||||
import accounts from './accounts';
|
||||
import addresses from './addresses';
|
||||
import contracts from './contracts';
|
||||
import { accounts } from './accounts';
|
||||
import { addresses } from './addresses';
|
||||
import { contracts } from './contracts';
|
||||
|
||||
interface Result {
|
||||
accounts: SubjectInfo;
|
||||
@@ -16,11 +15,11 @@ interface Result {
|
||||
contracts: SubjectInfo;
|
||||
}
|
||||
|
||||
export default combineLatest(
|
||||
export const obervableAll = combineLatest([
|
||||
accounts.subject,
|
||||
addresses.subject,
|
||||
contracts.subject
|
||||
).pipe(
|
||||
]).pipe(
|
||||
map(([accounts, addresses, contracts]): Result => ({
|
||||
accounts,
|
||||
addresses,
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
|
||||
// Copyright 2017-2021 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { KeyringSectionOption } from '../options/types';
|
||||
import { KeyringJson, KeyringStore } from '../types';
|
||||
import type { BehaviorSubject } from 'rxjs';
|
||||
import type { KeypairType } from '@polkadot/util-crypto/types';
|
||||
import type { KeyringSectionOption } from '../options/types';
|
||||
import type { KeyringJson, KeyringStore } from '../types';
|
||||
|
||||
export interface SingleAddress {
|
||||
json: KeyringJson;
|
||||
option: KeyringSectionOption;
|
||||
type?: KeypairType;
|
||||
}
|
||||
|
||||
export interface SubjectInfo {
|
||||
@@ -15,7 +17,7 @@ export interface SubjectInfo {
|
||||
}
|
||||
|
||||
export interface AddressSubject {
|
||||
add: (store: KeyringStore, address: string, json: KeyringJson) => SingleAddress;
|
||||
add: (store: KeyringStore, address: string, json: KeyringJson, type?: KeypairType) => SingleAddress;
|
||||
remove: (store: KeyringStore, address: string) => void;
|
||||
subject: BehaviorSubject<SubjectInfo>;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user