Compare commits

..
392 Commits
Author SHA1 Message Date
Github Actions c45d42f606 [CI Skip] release/stable 0.71.2
skip-checks: true
2021-03-07 15:48:27 +00:00
Jaco Greeff 401e55a7bd 0.71.2 (#452)
* 0.71.2

* Bumps
2021-03-07 16:46:07 +01:00
Github Actions 5a0158c372 [CI Skip] release/stable 0.71.1
skip-checks: true
2021-03-06 06:52:05 +00:00
Jaco Greeff 2509347330 0.71 (#451) 2021-03-06 07:48:44 +01:00
Github Actions a5bc4bc902 [CI Skip] release/beta 0.70.2-3
skip-checks: true
2021-03-05 16:08:03 +00:00
Jaco Greeff 7588f21b8f Bump util/util-crypto (#450) 2021-03-05 17:04:56 +01:00
Github Actions 78ca8b86a8 [CI Skip] release/beta 0.70.2-2
skip-checks: true
2021-03-03 09:25:24 +00:00
Jaco Greeff fc9cb7da9e Bump deps (& berry) (#448) 2021-03-03 10:22:44 +01:00
Github Actions 70dacc878c [CI Skip] release/beta 0.70.2-1
skip-checks: true
2021-03-02 20:46:35 +00:00
Jaco Greeff 0eebd52577 Default to type: module (#447) 2021-03-02 21:43:36 +01:00
Github Actions 100f22bcfe [CI Skip] release/beta 0.70.2-0
skip-checks: true
2021-03-01 20:50:00 +00:00
Jaco Greeff 36d479380f Bump deps (#446) 2021-03-01 21:47:02 +01:00
Github Actions aff728dd5e [CI Skip] release/stable 0.70.1
skip-checks: true
2021-02-28 13:19:40 +00:00
Jaco Greeff a0c8fa1a84 0.70 (#445)
* 0.70

* Correct util versions
2021-02-28 14:17:02 +01:00
Github Actions a88990cc73 [CI Skip] release/beta 0.69.2-3
skip-checks: true
2021-02-28 10:26:09 +00:00
Jaco Greeff 15c03c0aff Detection for mismatched monorepo deps (#444)
* Detection for mismatched monorepo deps

* Bump common
2021-02-28 11:23:11 +01:00
Github Actions aa3d6803f7 [CI Skip] release/beta 0.69.2-2
skip-checks: true
2021-02-26 08:11:45 +00:00
Jaco Greeff 0bf8b0a35b Bump common (#443) 2021-02-26 09:09:02 +01:00
Github Actions 3fd29ee299 [CI Skip] release/beta 0.69.2-1
skip-checks: true
2021-02-16 12:30:22 +00:00
Jaco Greeff 1fb62d2964 Bump deps (& use packageInfo detection) (#441) 2021-02-16 13:27:29 +01:00
Github Actions 756af81132 [CI Skip] release/beta 0.69.2-0
skip-checks: true
2021-02-08 16:53:33 +00:00
Jaco Greeff 0ebce80650 Bump util (#439) 2021-02-08 17:50:38 +01:00
Github Actions 743311ec19 [CI Skip] release/stable 0.69.1
skip-checks: true
2021-02-07 13:58:22 +00:00
Jaco Greeff d8237f0687 0.69 (#438)
* 0.69

* Adjust

* Adjust

* Update CHANGELOG.md
2021-02-07 14:55:32 +01:00
Github Actions 68f3d13d09 [CI Skip] release/stable 0.68.1
skip-checks: true
2021-02-01 08:32:18 +00:00
Jaco Greeff b9194310a9 0.68 (#437) 2021-02-01 09:29:46 +01:00
Github Actions 670078158c [CI Skip] release/beta 0.67.2-0
skip-checks: true
2021-01-28 14:13:00 +00:00
Jaco Greeff 0f0bea2624 ed25519 w/ bip44 option (#436)
* ed25519 w/ bip44 option

* naming

* Rename Ledger option (no bip32-ed25519 compatible)
2021-01-28 15:10:03 +01:00
Github Actions 82bd15b09c [CI Skip] release/stable 0.67.1
skip-checks: true
2021-01-24 16:27:39 +00:00
Jaco Greeff 9e3b69931f 0.67 (#434) 2021-01-24 17:25:13 +01:00
Github Actions b8ed514ca8 [CI Skip] release/beta 0.66.4-3
skip-checks: true
2021-01-24 16:18:29 +00:00
Jaco Greeff 079ebdb39b Bump common ref 2021-01-24 16:52:22 +01:00
Github Actions 230a35faf0 [CI Skip] release/beta 0.66.4-2
skip-checks: true
2021-01-24 11:27:13 +00:00
Jaco Greeff 943e60b47b Bump common (#433) 2021-01-24 12:24:56 +01:00
Github Actions cc67d386b8 [CI Skip] release/beta 0.66.4-1
skip-checks: true
2021-01-19 22:11:12 +00:00
Jaco Greeff 54384279b2 Bump deps (#432) 2021-01-19 23:08:13 +01:00
Github Actions 83fcb1fa7b [CI Skip] release/beta 0.66.4-0
skip-checks: true
2021-01-18 14:15:34 +00:00
Thibaut Sardan a83e2802ed store hardware wallets (#431) 2021-01-18 15:12:36 +01:00
Github Actions 27d524c758 [CI Skip] release/stable 0.66.3
skip-checks: true
2021-01-18 12:19:55 +00:00
Jaco Greeff 262e010a08 Path for stable x-rxjs 2021-01-18 13:17:27 +01:00
Github Actions c3a8f0c3d7 [CI Skip] release/stable 0.66.2
skip-checks: true
2021-01-17 16:31:29 +00:00
Jaco Greeff b045104c3e 0.66.2 Stable common 2021-01-17 17:29:05 +01:00
Github Actions 12bc342cc6 [CI Skip] release/stable 0.66.1
skip-checks: true
2021-01-17 15:06:52 +00:00
Jaco Greeff 1a1f351207 0.6 (#430) 2021-01-17 16:03:59 +01:00
Github Actions 510d33fd89 [CI Skip] release/beta 0.65.2-5
skip-checks: true
2021-01-14 21:57:26 +00:00
Jaco Greeff 19c68dada7 Use @polkadot/hw-ledger from common (#429) 2021-01-14 22:54:38 +01:00
Github Actions 089b24f505 [CI Skip] release/beta 0.65.2-4
skip-checks: true
2021-01-14 09:48:12 +00:00
Jaco Greeff 3f6a37a535 Bump deps (#428)
* Bump deps

* Bump deps
2021-01-14 10:45:10 +01:00
Github Actions 596331daf3 [CI Skip] release/beta 0.65.2-3
skip-checks: true
2021-01-13 18:49:54 +00:00
Adam DossaandAdam Dossa f665d0a590 Add Polymesh Ledger Integration (#427)
* Add Polymesh Ledger Integration

* Fix ordering

Co-authored-by: Adam Dossa <adamdossa@Adams-MacBook-Pro.local>
2021-01-13 19:46:53 +01:00
Github Actions 0c6c6c9a91 [CI Skip] release/beta 0.65.2-2
skip-checks: true
2021-01-07 21:03:35 +00:00
Jaco Greeff 9abdd88a3d Bump deps (#426) 2021-01-07 22:00:48 +01:00
Github Actions cdb927da2a [CI Skip] release/beta 0.65.2-1
skip-checks: true
2021-01-07 20:15:41 +00:00
Lovesh Harchandani 214fa1538a Allow Ledger support for Dock (#425)
Signed-off-by: lovesh <lovesh.bond@gmail.com>
2021-01-07 21:12:25 +01:00
Github Actions 97d74944cb [CI Skip] release/beta 0.65.2-0
skip-checks: true
2021-01-03 10:48:56 +00:00
Jaco Greeff f003063b94 2021 (#424) 2021-01-03 11:46:19 +01:00
Github Actions 08132ef566 [CI Skip] release/stable 0.65.1
skip-checks: true
2020-12-28 10:59:29 +00:00
Jaco Greeff 1fbbc0500d 0.65 (#423) 2020-12-28 11:56:21 +01:00
Github Actions 708ee3b7bd [CI Skip] release/beta 0.64.2-1
skip-checks: true
2020-12-21 19:16:15 +00:00
Jaco Greeff 3d0afd017a jdenticon imports 2020-12-21 20:13:08 +01:00
Github Actions bf67852b59 [CI Skip] release/beta 0.64.2-0
skip-checks: true
2020-12-21 12:21:22 +00:00
Jaco Greeff 105fb61f71 Cleanup deps (#422) 2020-12-21 13:18:20 +01:00
Github Actions d4f81a92e0 [CI Skip] release/stable 0.64.1
skip-checks: true
2020-12-21 10:53:42 +00:00
Jaco Greeff 353a15827b No types export from index (#421)
* No types export from index

* Fix use

* bump

* Bumps

* CHANGELOG

* OCD
2020-12-21 11:50:34 +01:00
Github Actions 6a3bf8c0b3 [CI Skip] release/beta 0.63.2-4
skip-checks: true
2020-12-21 08:48:34 +00:00
Jaco Greeff 9a20feb417 Bumps 2020-12-21 09:45:38 +01:00
Github Actions a25ae21074 [CI Skip] release/beta 0.63.2-3
skip-checks: true
2020-12-18 10:53:31 +00:00
Jaco Greeff f9428ee6d2 Bump dev 2020-12-18 11:50:32 +01:00
Github Actions 3746b608b2 [CI Skip] release/beta 0.63.2-2
skip-checks: true
2020-12-17 13:00:57 +00:00
Jaco Greeff 769995549d Mark detectPackage as sideEffect 2020-12-17 13:57:54 +01:00
Github Actions 98c497b0aa [CI Skip] release/beta 0.63.2-1
skip-checks: true
2020-12-17 12:30:46 +00:00
Jaco Greeff 96a1c981bc Update detectPackage with callback 2020-12-17 13:28:05 +01:00
Github Actions 82fc187983 [CI Skip] release/beta 0.63.2-0
skip-checks: true
2020-12-16 15:30:36 +00:00
Jaco Greeff fc22cc0456 Allow import.meta.url for detectPackage (#420)
* Allow import.meta.url for detectPackage

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

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

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

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

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

* Update dev

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

* Fix browser/node resolution

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

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

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

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

* fix yarn.lock ?

* cater for kusama hashes

* yarn update-interactive

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

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

* Apply suggestions from code review
2020-10-16 15:45:22 +02:00
Github Actions 7f4e90a2cf [CI Skip] release/beta 0.60.2-0
skip-checks: true
2020-10-14 12:29:42 +00:00
WoeOm 4d7b19e64b add darwinia ss58 (#379) 2020-10-14 14:25:08 +02:00
Github Actions 127c937e5d [CI Skip] release/stable 0.60.1
skip-checks: true
2020-10-07 12:48:28 +00:00
Jaco Greeff a0fc946ee7 CHANGELOG 2020-10-07 14:43:55 +02:00
Jaco Greeff 35dd0b2561 Bump dev (#377) 2020-10-07 14:15:34 +02:00
Github Actions 33ef29361f [CI Skip] release/stable 0.60.0
skip-checks: true
2020-10-04 13:45:08 +00:00
Jaco Greeff 7953d92bfc Bump dev (no lerna) (#376) 2020-10-04 15:41:34 +02:00
Github Actions 4089bca9d5 [CI Skip] release/beta 0.60.0-beta.0
skip-checks: true
2020-09-30 12:24:44 +00:00
Jaco Greeff fea7424a7d Allow for Custom IdentityIcon override (#375) 2020-09-30 14:20:50 +02:00
Github Actions d4923b80fc [CI Skip] release/stable 0.59.1
skip-checks: true
2020-09-28 08:11:53 +00:00
Jaco Greeff 678d4dc524 0.59 (#374) 2020-09-28 10:08:08 +02:00
Github Actions 4e92aab586 [CI Skip] release/beta 0.59.0-beta.12
skip-checks: true
2020-09-25 15:05:57 +00:00
Jaco Greeff 1833b1a28f Bump Ledger libs (WebUSB) (#373) 2020-09-25 17:02:09 +02:00
Github Actions 3ca640fd3c [CI Skip] release/beta 0.59.0-beta.11
skip-checks: true
2020-09-25 11:29:07 +00:00
Jaco Greeff 0017139d69 Bump keyring (#372) 2020-09-25 13:25:17 +02:00
Github Actions 87fd12c002 [CI Skip] release/beta 0.59.0-beta.10
skip-checks: true
2020-09-24 13:38:29 +00:00
Jaco Greeff 723641ac57 Expose createFromJSON 2020-09-24 15:34:43 +02:00
Github Actions 4155547c0b [CI Skip] release/beta 0.59.0-beta.9
skip-checks: true
2020-09-24 13:05:28 +00:00
Jaco Greeff 262b8ad7c3 Bump deps (#371)
* Bump deps

* Headers
2020-09-24 15:01:56 +02:00
Jaco Greeff 64f630d904 SPDX (#370) 2020-09-17 16:12:52 +02:00
Github Actions 8525c59b9a [CI Skip] release/beta 0.59.0-beta.8
skip-checks: true
2020-09-17 07:06:39 +00:00
Jaco Greeff 0288421cef Bump deps (#369) 2020-09-17 09:03:29 +02:00
Github Actions 8f1ae11d9c [CI Skip] release/beta 0.59.0-beta.7
skip-checks: true
2020-09-16 10:03:29 +00:00
Jaco Greeff 8f61882bf7 Bump deps (#367) 2020-09-16 12:00:05 +02:00
Github Actions 12cba3f23d [CI Skip] release/beta 0.59.0-beta.6
skip-checks: true
2020-09-14 20:05:04 +00:00
Jaco Greeff 05d8d95991 Fix API to 1.33 2020-09-14 22:01:41 +02:00
Github Actions adbaa6caf4 [CI Skip] release/beta 0.59.0-beta.5
skip-checks: true
2020-09-14 18:49:53 +00:00
Jaco Greeff db6948d658 Indices for ledger account/address (#366) 2020-09-14 20:46:49 +02:00
Github Actions 6ca5ac62eb [CI Skip] release/beta 0.59.0-beta.4
skip-checks: true
2020-09-11 17:21:20 +00:00
Jaco Greeff 0b63b9eaf9 useMem to replace useEffect/useState (#365) 2020-09-11 19:17:38 +02:00
Github Actions b62cfcaf94 [CI Skip] release/beta 0.59.0-beta.3
skip-checks: true
2020-09-09 10:09:07 +00:00
Jaco Greeff e24cf09608 Bumps (#364) 2020-09-09 12:05:22 +02:00
Github Actions 815bbd647c [CI Skip] release/beta 0.59.0-beta.2
skip-checks: true
2020-09-06 11:12:26 +00:00
Jaco Greeff 54a325f306 Bump deps (#363) 2020-09-06 13:09:31 +02:00
Github Actions d5b9362c85 [CI Skip] release/beta 0.59.0-beta.1
skip-checks: true
2020-09-05 06:07:11 +00:00
Jaco Greeff 55f3ca652d Bump deps (#362) 2020-09-05 08:03:27 +02:00
Github Actions 1cce48ef53 [CI Skip] release/beta 0.59.0-beta.0
skip-checks: true
2020-09-03 13:01:53 +00:00
Jaco Greeff 44bf1f4260 Bump dev (#361)
* Bump dev

* Ordering
2020-09-03 14:58:05 +02:00
Github Actions a26ef77df2 [CI Skip] release/stable 0.58.1
skip-checks: true
2020-08-31 16:02:16 +00:00
Jaco Greeff 0bffc7af3c 0.58.1 (#360) 2020-08-31 17:58:20 +02:00
Github Actions 496dc7fe2e [CI Skip] release/beta 0.58.0-beta.9
skip-checks: true
2020-08-27 08:58:01 +00:00
Vlad Proshchavaiev 3610d1b921 Add Subsocial to ss58 defaults (#358) 2020-08-27 10:53:37 +02:00
Github Actions abdfa588a6 [CI Skip] release/beta 0.58.0-beta.8
skip-checks: true
2020-08-26 14:04:31 +00:00
Jaco Greeff ccfa730713 Bump deps (#357)
* Bump deps

* Update packages/ui-settings/src/defaults/crypto.ts

* .eslintrc
2020-08-26 15:59:57 +02:00
Github Actions 3eb8799f67 [CI Skip] release/beta 0.58.0-beta.7
skip-checks: true
2020-08-18 10:07:03 +00:00
Jaco Greeff 42e57ee0ca Bump deps (#356) 2020-08-18 12:03:28 +02:00
Github Actions e37751672b [CI Skip] release/beta 0.58.0-beta.6
skip-checks: true
2020-08-13 09:10:37 +00:00
Jaco Greeff 9768383b40 Bump deps (#355) 2020-08-13 11:07:06 +02:00
Github Actions b87479f618 [CI Skip] release/beta 0.58.0-beta.5
skip-checks: true
2020-08-10 19:29:47 +00:00
Jaco Greeff fdc310b32e Support scanning name where ":" is contained within (#354) 2020-08-10 21:26:11 +02:00
Github Actions 8766481109 [CI Skip] release/beta 0.58.0-beta.4
skip-checks: true
2020-08-08 07:10:35 +00:00
Jaco Greeff d4575f7e65 Bump deps (#353) 2020-08-08 09:07:31 +02:00
Github Actions 59952cbb3a [CI Skip] release/beta 0.58.0-beta.3
skip-checks: true
2020-08-06 13:19:07 +00:00
Jaco Greeff 492e1739bc Bump berry (#352)
* Bump berry

* Rewrite
2020-08-06 15:15:56 +02:00
Github Actions a6065f7154 [CI Skip] release/beta 0.58.0-beta.2
skip-checks: true
2020-07-31 12:35:14 +00:00
Jaco Greeff 11c44643aa Bump deps (#351) 2020-07-31 14:29:50 +02:00
Github Actions 04b61d6b7a [CI Skip] release/beta 0.58.0-beta.1
skip-checks: true
2020-07-27 12:13:22 +00:00
Jaco Greeff bc15f44780 Bump to next beta 2020-07-27 14:09:23 +02:00
Github Actions 735b18d59f [CI Skip] release/stable 0.57.3
skip-checks: true
2020-07-27 12:07:25 +00:00
Jaco Greeff 5001dea3c1 Add updated yarn.lock 2020-07-27 14:03:50 +02:00
Jaco Greeff 1be84c778b 0.57.3 (CHANGELOG typo) 2020-07-27 14:03:10 +02:00
Github Actions ddb1b8169b [CI Skip] release/stable 0.57.2
skip-checks: true
2020-07-27 12:00:47 +00:00
Jaco Greeff e077259037 0.57.2 (after failed 0.57.1 release) 2020-07-27 13:57:06 +02:00
Github Actions c88bccb560 [CI Skip] release/stable 0.57.1
skip-checks: true
2020-07-27 11:53:15 +00:00
Jaco Greeff 5bd2b3c85e Actual bump to 0.57 2020-07-27 13:48:41 +02:00
Github Actions 078d6800a6 [CI Skip] release/beta 0.57.0-beta.2
skip-checks: true
2020-07-27 11:47:25 +00:00
Jaco Greeff 4126dffc96 0.57 (#350) 2020-07-27 13:43:18 +02:00
Github Actions 61400d4c03 [CI Skip] release/beta 0.57.0-beta.1
skip-checks: true
2020-07-21 20:33:33 +00:00
Jaco Greeff a3ab735c4e Adjust password checks for v3 (#349) 2020-07-21 22:29:50 +02:00
Github Actions 0138ac3e4a [CI Skip] release/beta 0.57.0-beta.0
skip-checks: true
2020-07-21 09:22:08 +00:00
Jaco Greeff 0dcbdcac3a JSON v3 (#348) 2020-07-21 11:18:19 +02:00
Github Actions cc86e71837 [CI Skip] release/stable 0.56.1
skip-checks: true
2020-07-20 15:31:28 +00:00
Jaco Greeff 00d24f587b 0.56 (#346) 2020-07-20 17:27:23 +02:00
Github Actions c2683d10c6 [CI Skip] release/beta 0.56.0-beta.3
skip-checks: true
2020-07-17 12:30:25 +00:00
Jaco Greeff 11f5607272 Bump dev 2020-07-17 14:26:25 +02:00
Github Actions 259326cb5b [CI Skip] release/beta 0.56.0-beta.2
skip-checks: true
2020-07-17 07:58:51 +00:00
Jaco Greeff dad6590660 Bump deps (#345) 2020-07-17 09:54:43 +02:00
Github Actions b68b4cc374 [CI Skip] release/beta 0.56.0-beta.1
skip-checks: true
2020-07-11 07:35:09 +00:00
Jaco Greeff 7ffa17e372 Flatten Identicon (remove extra wrapper) (#343) 2020-07-11 09:31:22 +02:00
Github Actions c02a4d381c [CI Skip] release/beta 0.56.0-beta.0
skip-checks: true
2020-07-06 17:27:26 +00:00
carumusan ab6e20a0dc Add kulupu (#342) 2020-07-06 19:22:00 +02:00
Github Actions 51dece8b0f [CI Skip] release/stable 0.55.1
skip-checks: true
2020-07-02 11:49:16 +00:00
Jaco Greeff 2452470163 0.55 (#341) 2020-07-02 13:44:36 +02:00
Github Actions edbdb4f239 [CI Skip] release/beta 0.55.0-beta.6
skip-checks: true
2020-07-02 09:54:25 +00:00
Jaco Greeff 43da3b50de Assert of single key 2020-07-02 11:49:54 +02:00
yuhui1208 a3658de7c2 [Stores] make FileStroe read key safely (#338)
* safely readKey

* fix ci

* fix

* fix type error

* Modify judgment

* fix

* fix

* fix lint
2020-07-02 11:44:04 +02:00
Github Actions 74315ec825 [CI Skip] release/beta 0.55.0-beta.5
skip-checks: true
2020-07-02 06:07:03 +00:00
Jaco Greeff 4c58f48645 Bump deps (#340)
* Bump deps

* Adjust for new eslint parser
2020-07-02 08:01:50 +02:00
Github Actions c8f4983946 [CI Skip] release/beta 0.55.0-beta.4
skip-checks: true
2020-07-01 11:44:59 +00:00
Jaco Greeff ea7fad63a6 Ignore .DS_Store (#339)
As per https://github.com/polkadot-js/ui/issues/337#issuecomment-651617556
2020-07-01 13:39:41 +02:00
Github Actions 65352f4253 [CI Skip] release/beta 0.55.0-beta.3
skip-checks: true
2020-06-28 05:40:43 +00:00
Jaco Greeff 11922b1b02 Only apply before on highlight for icons (#336) 2020-06-28 07:35:17 +02:00
Github Actions 47752593b0 [CI Skip] release/beta 0.55.0-beta.2
skip-checks: true
2020-06-25 10:20:37 +00:00
Jaco Greeff 8dfaea2bfc Dep cleanups (#335) 2020-06-25 12:15:27 +02:00
Github Actions b288773d15 [CI Skip] release/beta 0.55.0-beta.1
skip-checks: true
2020-06-24 07:34:57 +00:00
Jaco Greeff 25d9da3144 Bump dependencies (#334)
* Bump dependencies

* QR display component to functional

* Small adjustments
2020-06-24 09:29:43 +02:00
Github Actions 841819d249 [CI Skip] release/beta 0.55.0-beta.0
skip-checks: true
2020-06-22 19:35:29 +00:00
Jaco Greeff 47fa7f9f0e Ledger dependencies bump (#332)
* Bump Ledger deps, adjust interfaces

* Cleanup with correct ledger exports

* Align deps

* 0.10.4
2020-06-22 21:31:17 +02:00
Jaco Greeff ed2c9e5c41 Bumps 2020-06-22 20:42:21 +02:00
Jaco Greeff 985177dd96 Bump deps (#333) 2020-06-22 20:37:44 +02:00
Github Actions 95a1a4f9a2 [CI Skip] release/stable 0.54.1
skip-checks: true
2020-06-16 07:06:08 +00:00
Jaco Greeff e142284713 0.54 (#331)
* 0.54

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

* simplify flow

* use original orders

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

* Rewrite yarn.lock

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

* fix order and add tests (#324)

* fix order and add tests

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

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

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

* Apply suggestions from code review

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

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

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

* Remove unused deps

* Bump berry

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

* Bumps

* Spelling.
2020-04-24 18:02:13 +02:00
Github Actions 2e323be1c3 [CI Skip] 0.52.1
skip-checks: true
2020-04-16 05:46:28 +00:00
Jaco Greeff 8111ce1ce6 0.52 (#310)
* 0.52

* Actual date ;)
2020-04-16 07:42:57 +02:00
Github Actions f946b7d8fe [CI Skip] 0.52.0-beta.32
skip-checks: true
2020-04-12 07:11:28 +00:00
Jaco Greeff 7251b1f763 Cleanup shared, consistency with standards (#309)
* Cleanup shared, consistency with standards

* Re-add item

* Cleanup webpack demos
2020-04-12 09:06:32 +02:00
Github Actions a1aa280cb9 [CI Skip] 0.52.0-beta.31
skip-checks: true
2020-04-12 05:32:53 +00:00
Jaco Greeff a268160ffd isAlternative (#308) 2020-04-12 07:28:16 +02:00
Github Actions 87187649d1 [CI Skip] 0.52.0-beta.30
skip-checks: true
2020-04-07 20:01:23 +00:00
Jaco Greeff b2ba6aa7ae Bumps 2020-04-07 21:56:19 +02:00
Jaco Greeff e95dc3932b Bump common 2020-04-07 21:36:04 +02:00
Github Actions 68579a0b86 [CI Skip] 0.52.0-beta.29
skip-checks: true
2020-04-06 11:01:24 +00:00
Jaco Greeff ae447e52c9 Trigger 2020-04-06 12:56:23 +02:00
Github Actions 1d66e071e9 [CI Skip] 0.52.0-beta.28
skip-checks: true
2020-04-06 10:31:46 +00:00
Jaco Greeff e26f9aedb6 Use bundled node (#307) 2020-04-06 12:27:46 +02:00
Github Actions d83c45cb2f [CI Skip] 0.52.0-beta.27
skip-checks: true
2020-04-06 08:38:43 +00:00
Jaco Greeff b695647acf Remove extension store (#306) 2020-04-06 10:16:07 +02:00
Github Actions 0d179f9d0b [CI Skip] 0.52.0-beta.26
skip-checks: true
2020-04-05 08:01:42 +00:00
Jaco Greeff 6e60311ba7 Bump deps (#305) 2020-04-05 09:57:04 +02:00
Github Actions a6a7ef040f [CI Skip] 0.52.0-beta.25
skip-checks: true
2020-04-04 08:52:06 +00:00
Jaco Greeff e2637b06a0 Bump deps (#304) 2020-04-04 10:47:33 +02:00
Github Actions ec5caf8fe1 [CI Skip] 0.52.0-beta.24
skip-checks: true
2020-04-01 21:01:46 +00:00
Jaco Greeff 7428ef8eb7 Bump dev (#303) 2020-04-01 22:57:30 +02:00
Github Actions d29edf679e [CI Skip] 0.52.0-beta.23
skip-checks: true
2020-04-01 19:29:10 +00:00
Jaco Greeff 175f876101 Bump dev (incl. eslint fixes) (#302)
* Bump dev (incl. eslint fixes)

* Ordering fixes
2020-04-01 21:24:45 +02:00
Github Actions cc4fa53339 [CI Skip] 0.52.0-beta.22
skip-checks: true
2020-04-01 11:23:17 +00:00
Jaco Greeff 371262d056 Bump dev, apply JSX rules (#301) 2020-04-01 13:18:28 +02:00
Github Actions cd5a881f32 [CI Skip] 0.52.0-beta.21
skip-checks: true
2020-03-27 07:57:05 +00:00
Jaco Greeff 95882ea875 Exhaustive hooks (#300) 2020-03-27 08:52:52 +01:00
Github Actions 3edeae30a0 [CI Skip] 0.52.0-beta.20
skip-checks: true
2020-03-26 12:21:29 +00:00
Hanwen Cheng 44f7e6a436 Add qr support for networkSpecs (#299)
* add qr support for networkSpecs

* make lint happy with spaces

* make lint happier

* remove path id in networkspecs type

* Update tsconfig.json
2020-03-26 13:16:47 +01:00
Github Actions 03033b8d7c [CI Skip] 0.52.0-beta.19
skip-checks: true
2020-03-22 18:16:13 +00:00
Jaco Greeff a25f813f6b Bump API (#298) 2020-03-22 19:11:54 +01:00
Github Actions 873ac2a3ee [CI Skip] 0.52.0-beta.18
skip-checks: true
2020-03-21 10:41:38 +00:00
Jaco Greeff ee613b1578 Bump dev (#297) 2020-03-21 11:37:03 +01:00
Github Actions 6f5adca0cc [CI Skip] 0.52.0-beta.17
skip-checks: true
2020-03-21 09:32:10 +00:00
Jaco Greeff 49c4c592f1 Bump deps (#296)
* Bump deps

* @types/jest

* TS 3.8.3
2020-03-21 10:27:57 +01:00
Github Actions b5882bf3a4 [CI Skip] 0.52.0-beta.16
skip-checks: true
2020-03-16 14:36:11 +00:00
Jaco Greeff 5ad56a9520 Add yarn matrix (#295) 2020-03-16 15:31:37 +01:00
Github Actions 0afc9908ed [CI Skip] 0.52.0-beta.15
skip-checks: true
2020-03-16 13:47:13 +00:00
Jaco Greeff 6c55f6ea53 Collapse actions matrix (#294) 2020-03-16 14:42:33 +01:00
Github Actions 1eef52e286 [CI Skip] 0.52.0-beta.14
skip-checks: true
2020-03-15 07:25:14 +00:00
Jaco Greeff c1644287e1 Remove non-working CI cache (#293) 2020-03-15 08:21:31 +01:00
Github Actions 1ceee77b27 [CI Skip] 0.52.0-beta.13
skip-checks: true
2020-03-15 05:15:01 +00:00
Jaco Greeff faea66eed8 rxjs to dependency 2020-03-15 06:10:47 +01:00
Github Actions f211a19eab [CI Skip] 0.52.0-beta.12
skip-checks: true
2020-03-15 05:04:43 +00:00
Jaco Greeff ad9abfb0d8 Missing peerDependencies 2020-03-15 06:00:31 +01:00
Github Actions 204b0b46ef [CI Skip] 0.52.0-beta.11
skip-checks: true
2020-03-14 17:40:52 +00:00
Jaco Greeff 5ddcec777f Missing explicit deps 2020-03-14 18:36:31 +01:00
Github Actions 0055d7573b [CI Skip] 0.52.0-beta.10
skip-checks: true
2020-03-14 17:25:26 +00:00
Jaco Greeff 92998eb817 Add missing peerDependency 2020-03-14 18:21:12 +01:00
Github Actions a11dc52cfe [CI Skip] 0.52.0-beta.9
skip-checks: true
2020-03-14 12:24:57 +00:00
Jaco Greeff b2175a60cd Some additional functional wrappers (#292) 2020-03-14 13:20:39 +01:00
Github Actions 9bba6b0c28 [CI Skip] 0.52.0-beta.8
skip-checks: true
2020-03-14 11:46:18 +00:00
Jaco Greeff 8865d2a2c5 Some functional components (#291)
* Some functional components

* Pass param to useCallback

* Bump berry

* Scan -> functional
2020-03-14 12:41:57 +01:00
Github Actions 067f1a4fa7 [CI Skip] 0.52.0-beta.7
skip-checks: true
2020-03-14 09:05:57 +00:00
Jaco Greeff 15c6b1cef6 Bump deps (#290) 2020-03-14 10:01:47 +01:00
Github Actions f49b5a0389 [CI Skip] 0.52.0-beta.6
skip-checks: true
2020-03-09 07:29:31 +00:00
Keith Ingram 5e86263fe3 fix ff api url issue (#289) 2020-03-09 08:24:45 +01:00
Github Actions 9fce0e2d51 [CI Skip] 0.52.0-beta.5
skip-checks: true
2020-02-29 12:56:01 +00:00
Jaco Greeff 6cbabfbe80 Minify yarn plugins (#288) 2020-02-29 13:50:27 +01:00
Github Actions 32c1ca8abf [CI Skip] 0.52.0-beta.4
skip-checks: true
2020-02-28 13:24:53 +00:00
Jaco Greeff 31e8904f7a Swap to yarn 2 (#287) 2020-02-28 14:19:03 +01:00
Github Actions 1229bedffb [CI Skip] 0.52.0-beta.3
skip-checks: true
2020-02-22 17:21:23 +00:00
Jaco Greeff e69e98182b Control priv access via # (#286) 2020-02-22 18:19:35 +01:00
Github Actions 3b71f10d1e [CI Skip] 0.52.0-beta.2
skip-checks: true
2020-02-19 20:07:15 +00:00
Jaco Greeff 992eed1bfc Centrifuge logo (#285) 2020-02-19 21:05:32 +01:00
Github Actions 873b1c40e8 [CI Skip] 0.52.0-beta.1
skip-checks: true
2020-02-19 17:07:38 +00:00
Jaco Greeff 7e0171bb9f Add Centrifuge logo (#284) 2020-02-19 18:05:22 +01:00
Github Actions 309f652ce6 [CI Skip] 0.52.0-beta.0
skip-checks: true
2020-02-18 16:09:45 +00:00
Jaco Greeff 2ba4444ca4 Internal ss58Format handling (#283) 2020-02-18 17:07:53 +01:00
Github Actions 826de3ddf0 [CI Skip] 0.51.1
skip-checks: true
2020-02-18 09:00:43 +00:00
Jaco Greeff 1e4148f2cf 0.51 (#282) 2020-02-18 09:58:35 +01:00
Github Actions 5827a9702c [CI Skip] 0.51.0-beta.1
skip-checks: true
2020-02-17 20:05:29 +00:00
Jaco Greeff fd11071566 Bump deps (#281) 2020-02-17 21:02:55 +01:00
Github Actions 7b7d467143 [CI Skip] 0.51.0-beta.0
skip-checks: true
2020-02-17 14:09:48 +00:00
Jaco Greeff 170b778dcf Add GH actions yarn cache (#280) 2020-02-17 15:07:46 +01:00
Github Actions bc5be9e382 [CI Skip] 0.50.1
skip-checks: true
2020-02-16 08:20:07 +00:00
Jaco Greeff 6fb91e2e56 0.50 (#279)
* 0.50

* Dep bumps
2020-02-16 09:18:04 +01:00
Github Actions c29613faed [CI Skip] 0.50.0-beta.4
skip-checks: true
2020-02-14 15:31:51 +00:00
Jaco Greeff 7b6ff51186 Bump deps (& @types to dev deps) (#278) 2020-02-14 16:30:08 +01:00
Github Actions 44043a9374 [CI Skip] 0.50.0-beta.3
skip-checks: true
2020-02-14 08:51:34 +00:00
Jaco Greeff e4159028ae Bump dev (#277) 2020-02-14 09:49:29 +01:00
Github Actions b6424bdb15 [CI Skip] 0.50.0-beta.2
skip-checks: true
2020-02-13 15:09:53 +00:00
Jaco Greeff 9e5a2ac7c5 Bump dev (#276)
* Bump dev

* Fix linting
2020-02-13 16:07:21 +01:00
Github Actions 924e69bc7b [CI Skip] 0.50.0-beta.1
skip-checks: true
2020-02-12 16:11:31 +00:00
Jaco Greeff 4f025cb9ec Explicit deps & bumps (#275) 2020-02-12 17:08:52 +01:00
Github Actions 9902c9351d [CI Skip] 0.50.0-beta.0
skip-checks: true
2020-02-10 17:39:21 +00:00
Drew Stone 536a6dd877 Add Edgeware testnet and mainnet updated endpoints (#274) 2020-02-10 18:37:11 +01:00
Github Actions 00e702e24f [CI Skip] 0.49.1
skip-checks: true
2020-02-06 16:00:42 +00:00
Jaco Greeff 7c39f68a1a 0.49 (#273) 2020-02-06 16:58:25 +01:00
Github Actions ba9f571c83 [CI Skip] 0.49.0-beta.3
skip-checks: true
2020-02-06 14:27:45 +00:00
Jaco Greeff d12387f4ae Add a resolver for jest (#272) 2020-02-06 15:25:08 +01:00
Github Actions 4bed02e395 [CI Skip] 0.49.0-beta.2
skip-checks: true
2020-02-05 17:35:37 +00:00
Nikhil Ranjan ee23a50c06 Updated to valid javascript (#271)
; cannot be used with => .
2020-02-05 18:33:19 +01:00
Github Actions 7f383fffc9 [CI Skip] 0.49.0-beta.1
skip-checks: true
2020-02-04 11:37:49 +00:00
Jaco Greeff 42b421be44 Bump deps (#270) 2020-02-04 12:35:32 +01:00
Github Actions 121fe3008a [CI Skip] 0.49.0-beta.0
skip-checks: true
2020-02-03 12:59:24 +00:00
Jaco Greeff 55fd797707 Bump deps (#269) 2020-02-03 13:56:45 +01:00
195 changed files with 19500 additions and 19469 deletions
+5
View File
@@ -0,0 +1,5 @@
1
0.57.20.57.3
0.66.2
0.66.3
0.71.2
-1
View File
@@ -1 +0,0 @@
module.exports = require('./babel.config.js');
-4
View File
@@ -1,4 +0,0 @@
**/build/*
**/coverage/*
**/node_modules/*
**/*.d.ts
+23 -1
View File
@@ -1,11 +1,33 @@
const base = require('@polkadot/dev-react/config/eslint');
// Copyright 2017-2021 @polkadot/ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
const base = require('@polkadot/dev/config/eslint.cjs');
module.exports = {
...base,
ignorePatterns: [
'.eslintrc.js',
'.github/**',
'.vscode/**',
'.yarn/**',
'**/build/*',
'**/coverage/*',
'**/node_modules/*',
'**/*.d.ts'
],
parserOptions: {
...base.parserOptions,
project: [
'./tsconfig.json'
]
},
rules: {
...base.rules,
// add override for any (a metric ton of them, initial conversion)
'@typescript-eslint/no-explicit-any': 'off',
// these should be removed, there are 8 of them as errors
'@typescript-eslint/no-non-null-assertion': 'off',
// this seems very broken atm, false positives
'@typescript-eslint/unbound-method': 'off'
}
};
+7 -62
View File
@@ -2,70 +2,15 @@ name: PR
on: [pull_request]
jobs:
lint:
name: Linting
runs-on: ubuntu-latest
pr:
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: lint
run: |
yarn install --frozen-lockfile
yarn lint
test:
name: Testing
step: ['lint', 'test', 'build']
name: ${{ matrix.step }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: test
- uses: actions/checkout@v2
- name: ${{ matrix.step }}
run: |
yarn install --frozen-lockfile
yarn test
build_code:
name: Build Code
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: build
run: |
yarn install --frozen-lockfile
yarn build
build_docs:
name: Build Docs
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: build
run: |
yarn install --frozen-lockfile
yarn docs
yarn install --immutable | grep -v 'YN0013'
yarn ${{ matrix.step }}
+10 -43
View File
@@ -5,62 +5,29 @@ on:
- master
jobs:
build_code:
name: Build Code
if: "! contains(github.event.head_commit.message, '[CI Skip]')"
runs-on: ubuntu-latest
master:
strategy:
matrix:
node-version: [12.x]
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@v1
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_PAT }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: build
- name: ${{ matrix.step }}
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
GH_PAT: ${{ secrets.GH_PAT }}
GH_TOKEN: ${{ secrets.GH_PAT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
yarn install --frozen-lockfile
yarn polkadot-dev-ghact-build
build_docs:
name: Build Docs
if: "! contains(github.event.head_commit.message, '[CI Skip]')"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: build
env:
GH_PAT: ${{ secrets.GH_PAT }}
GH_TOKEN: ${{ secrets.GH_PAT }}
GH_PAGES_SRC: build-docs
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn install --frozen-lockfile
yarn polkadot-dev-ghact-docs
yarn install --immutable | grep -v 'YN0013'
yarn ${{ matrix.step }}
dummy:
name: Dummy
if: "contains(github.event.head_commit.message, '[CI Skip]')"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- name: dummy
run: |
+4
View File
@@ -9,6 +9,10 @@ tmp/
.env.test.local
.env.production.local
.npmrc
.yarn/*
!.yarn/releases
!.yarn/plugins
.pnp.*
cc-test-reporter
package-lock.json
npm-debug.log*
-1
View File
@@ -1 +0,0 @@
10.13.0
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+55
View File
File diff suppressed because one or more lines are too long
+13
View File
@@ -0,0 +1,13 @@
enableImmutableInstalls: false
enableProgressBars: false
nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
yarnPath: .yarn/releases/yarn-2.4.1.cjs
+387 -24
View File
@@ -1,32 +1,329 @@
# 0.47.1
# CHANGELOG
## 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:
- Update address checks to allow for Ethereum-compatible chains
- Add Ethereum icon type (uses blockies underneath)
- Updated to `@polkadot/{keyring, util, util-crypto}` 4.0.1
- Updated to `@polkadot/api` 2.6.1
## 0.61.1 Oct 19, 2020
Contributed:
- Add Darwinia ss58 (Thanks to https://github.com/WoeOm)
- Swap network identifiers to `@polkadot/networks` (Thanks to https://github.com/Tbaut)
Changes:
- Explicit deps versions (with peerDependencies as provided)
- Bump to `@polkadot/api` 2.3.1
- Bump to `@polkadot/util` 3.6.1
## 0.60.1 Oct 7, 2020
Changes:
- Allow for custom IdentityIcon overrides
- Move docs to docs repo
- Bump to `@polkadot/api` 2.1.1
## 0.59.1 Sep 28, 2020
Changes:
- Expose createFromJson on keyring to compliment createFromUri
- Support Account/address indexes for Ledger
- Bump to `@polkadot/api` 2.0.1
- Bump to `@polkadot/util` 3.5.1
## 0.58.1 Aug 31, 2020
Contributed:
- Add Subsocial to ss58 defaults (Thanks to https://github.com/F3Joule)
Changes:
- Support QR scanning where name contains ":"
- Support for Moonbeam ETH-compatible crypto types
## 0.57.3 Jul 27, 2020
Changes:
- Support for JSON v3 kdf-enabled format
- Adjust password validity checks (alongside v3)
- Bump to `@polkadot/api` 1.26.1
- Bump to `@polkadot/util` 3.0.1
## 0.56.1 Jul 20, 2020
Contributed:
- Add Kulupu to ss58 options (https://github.com/carumusan)
Changes:
- Remove CC1 naming for Polkadot (as applicable)
- Flatten React IdentityIcon (no extra wrapping)
- Bump to `@polkadot/api` 1.25.1
- Bump to `@polkadot/util` 2.18.1
## 0.55.1 Jul 2, 2020
Contributed:
- Better error-handling for invalid FileStore accounts (Thanks to https://github.com/yuhui1208)
Changes:
- Adjust react-qr `Scan*` making `onScan` callbacks required
- Rework the react-qr display to use functional components
- Bump to `@polkadot/api` 1.21.1
- Bump to `@polkadot/util` 2.15.1
## 0.54.1 Jun 16, 2020
Contributed:
- Add genesisHash to signer payload (Thanks to https://github.com/hanwencheng)
- Allow QR scanning to parse mini keys (Thanks to https://github.com/hanwencheng)
Changes:
- Adjust ordering of available crypto types (native first)
- Rename Substrate prefix entry (42) to "generic"
- Bump to `@polkadot/api` 1.19.1
- Bump to `@polkadot/util` 2.14.1
## 0.53.1 May 14, 2020
Contributed:
- Add Ecdsa to the supported crypto types options (Thanks to https://github.com/akru)
- Add Egedware to network prefix settings (Thanks to https://github.com/jnaviask)
Changes:
- Add `addMultisig` into keyring (with all options to re-create address)
- Bump to `@polkadot/api` 1.14.1
- Bump to `@polkadot/util` 2.10.1
## 0.52.1 Apr 15, 2020
- **Breaking change** (TypeScript only) The `*.d.ts` files now contain TypeScript 3.8 features, `#private`, which is not usable in older versions
Contributed:
- Allow for the encoding of chain-settings via QR (Thanks to https://github.com/hanwencheng)
- Enhance checks for ws url in settings (Thanks to https://github.com/kwingram25)
Changes:
- Start of `isAlternative` implementations for identicons to react, react-native & vue (currently only Polkadot sixPoint)
- Bump to `@polkadot/api` 1.10 & `@polkadot/util` 2.8
- Convert `private <field>` to `#<field>`
- Remove internal/duplicated ui-keyring ss58Format mapping, rather set it directly on wrapped keyring
## 0.51.1 Feb 18, 2020
Changes:
- Support formatting of addresses via createPair base on latest upstream keyring
- Bump to `@polkadot/api` 1.3.1
- Bump to `@polkadot/util` 2.4.1
## 0.50.1 Feb 16, 2020
Changes:
- ui-settings does not expose pre-configured endpoints by default (only local dev node)
- Bump to `@polkadot/api` 1.2.1
- Bump to `@polkadot/util` 2.3.1
## 0.49.1 Feb 06, 2020
Changes:
- Add resolver for jest requires (tests from src)
## 0.48.1 Jan 30, 2020
Changes:
- Add Westend & Kulupulu, remove Alexander
- Update Edgeware wss uri
- Change display name for Kusama
- Mirror QR scanning display
## 0.47.1 Nov 29, 2019
Changes:
- Support for Kusama CC3 (network endpoints)
- Genesis hashes for accounts can now lookup against a range (so CC2-locked accounts will show on CC3)
- Language options have been removed from settings (these will be app-specific)
- QR display loops now have a timeout decay (slower as it loops)
# 0.46.1
## 0.46.1 Oct 25, 2019
- Add an example for using React Native (thanks to https://github.com/cameronfr)
Changes:
- Add base documentation for getting started
- Add camera access to the setting structure
# 0.45.1
## 0.45.1 Sep 26, 2019
- **Breaking change** The subscription subject for `ui-keyring` does not return a pre-formatted React object anymore. This is SUI-specific, so had limited use and therefore should not even be split into a `react-keyring` component. Rather users of this functionality should construct their own options for their framework.
Changes:
- Support for Kusama CC2
- **Breaking change** The subscription subject for `ui-keyring` does not return a pre-formatted React object anymore. This is SUI-specific, so had limited use and therefore should not even be split into a `react-keyring` component. Rather users of this functionality should construct their own options for their framework.
- Experimental support for signing via Ledger HW
- Add specific settings for the icon type to `ui-settings`
- Add Edgeware live RPC endpoints to `ui-settings`
- Adjust `react-identicon` highlights (validators)
- Add `example-{react, vue}` highlighting simple use with `ui-keyring`, `ui-settings` & `*-identicon` components
# 0.44.1
## 0.44.1 Sep 12, 2019
Changes:
- Update `@polkadot/util` to 1.4.1
- Upddate to Babel 7.6
# 0.43.1
## 0.43.1 Sep 10, 2019
Changes:
- Add W3F Node for Kusama
- Add extended info to ui-settings, i.e. info on each option
@@ -34,17 +331,24 @@
- ui-keyring now check the genesisHash on all load operations (if supplied)
- react-qr is now operational and integrated in the polkadot-js/extension and apps repos
# 0.42.1
## 0.42.1 Aug 24, 2019
- **Breaking Change** The `@polkadot/ui-identicon` package has been renamed to `@polkadot/react-identicon`
- **Breaking change** For `@polkadot/ui-keyring` the stores are now not exported from the index, imports should be changed to either `ui-keyring/stores` or explicitly to `ui-keyring/stores/Extension`
Changes:
- Support for Kusama with endpoints and settings
- The `@polkadot/reactnative-identicon` package has been added (only Polkadot support atm)
- The `@polkadot/react-qr` package has been added to display/scan QR codes
- `@polkadot/ui-settings` has UNfrastructure added as an RPC provider for Alex
- `@polkadot/ui-settings` exposes a dropdown with address prefix options
# 0.41.1
## 0.41.1 Jun 14, 2019
Changes:
- Adapt interface to cater for new `@polkadot/keyring`, where pairs -
- expose `address` getter instead of `address()`
@@ -56,16 +360,25 @@
- Remove previously deprecated kering functions, `createAccount`, `createAccountExternal` & `createAccountMnemonic`
- Remove (previously deprecated), `@polkadot/ui-util`, all these functions have been incorporated in `@polkadot/util`
# 0.40.1
## 0.40.1 Jun 04, 2019
Changes:
- Address encoding changes, use encoded address instead of supplied
# 0.39.1
## 0.39.1 May 22, 2019
Changes:
- Allow for externally injected accounts
- @polkadot/util 0.91.1 & @polkadot/api 0.79.1
# 0.38.1
## 0.38.1 May 08, 2019
Changes:
- Sorting of keyring addresses
- Fix JSON import defaults (previously detection was not working for old accounts)
@@ -73,62 +386,112 @@
- Ensure only a single instance of ui-keyring is loaded
- Adjust short address option display (keyring options)
# 0.37.1
## 0.37.1 Apr 03, 2019
Changes:
- Add Emberic Elm (Dried Danta discontinued)
- @polkadot/util & @polkadot/api 0.75.1
# 0.36.1
## 0.36.1 Mar 29, 2019
Changes:
- Small fixes, latest @polkadot/wasm-* packages
# 0.35.1
## 0.35.1 Mar 29, 2019
Changes:
- @polkadot/util & @polkadot/api 0.75.1
# 0.34.1
## 0.34.1 Mar 28, 2019
Changes:
- Fix for blake2 in Polkadot identicon generation
# 0.33.1
## 0.33.1 Mar 23, 2019
Changes:
- Rename createUri and createExternal to addExternal and addUri
- Rename addAccountPair to addPair
- Add additional createFromUri function to create pair, but not add it
- Latest api, util & util-crypto (this with WASM and JS fallbacks)
# 0.32.1
## 0.32.1 Mar 20, 2019
Changes:
- Add createUri to create an account from a path uri
- Add createExternal as an alias for createAccountExternal
- Deprecate createAccount, createAccountExternal and createAccountMnemonic
- Fix styled-component dependencies when used in a non-@polkadot project
# 0.31.1
## 0.31.1 Mar 18, 2019
Changes:
- Allow for latest keyring with sr25519 derived support
- When using dev mode, it assumes the substrate node has sr25519 derived keys
# 0.30.1
## 0.30.1 Mar 14, 2019
Changes:
- Swap to publishing -beta.x on merge (non-breaking testing)
# 0.29.1
## 0.29.1 Mar 13, 2019
Changes:
Swap to using a dev HDKD keyring (only available on latest substrate master, only affects nodes running with --dev, normal operation unaffected)
# 0.28.1
## 0.28.1 Feb 21, 2019
Changes:
Default Substrate icon is Jdenticon
# 0.27.1
## 0.27.1 Feb 20, 2019
Changes:
Replace Charred Cherry with Dried Danta, remove old decimals and token name configs
# 0.26.1
## 0.26.1 Feb 14, 2019
Changes:
Add keyring support for sd25519 (schnorrkel)
# 0.25.1
## 0.25.1 Jan 09, 2019
Changes:
Add `@polkadot/{keyring,util,util-crypto,types}` as peerDependencies for the various packages as used. Thie should allow less churn on this repo with version bumps, although it does add some extra effort onto the users of these libraries. (But the assumption is that they use these anyway)
## 0.24.1 Dec 19, 2018
## 0.23.1 Dec 14, 2018
## 0.22.1 Dec 05, 2018
Changes:
- Split from apps
+4 -2
View File
@@ -1,5 +1,7 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const base = require('@polkadot/dev-react/config/babel');
// Copyright 2017-2021 @polkadot/ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
const base = require('@polkadot/dev/config/babel-config-cjs.cjs');
module.exports = Object.keys(base).reduce((config, key) => {
config[key] = base[key];
-20
View File
@@ -1,20 +0,0 @@
#!/bin/bash
function copy_folder () {
SRC="packages/$1/build"
DST="../apps/node_modules/@polkadot/$1"
echo "** Copying $SRC to $DST"
rm -rf $DST
cp -r $SRC $DST
}
yarn polkadot-dev-build-ts
copy_folder "react-identicon"
copy_folder "react-qr"
copy_folder "ui-assets"
copy_folder "ui-keyring"
copy_folder "ui-settings"
copy_folder "ui-shared"
-20
View File
@@ -1,20 +0,0 @@
#!/bin/bash
function copy_folder () {
SRC="packages/$1/build"
DST="../extension/node_modules/@polkadot/$1"
echo "** Copying $SRC to $DST"
rm -rf $DST
cp -r $SRC $DST
}
yarn polkadot-dev-build-ts
copy_folder "react-identicon"
copy_folder "react-qr"
copy_folder "ui-assets"
copy_folder "ui-keyring"
copy_folder "ui-settings"
copy_folder "ui-shared"
-50
View File
@@ -1,50 +0,0 @@
module.exports = {
base: '/ui/',
title: 'polkadot-js/ui',
description: 'UI utilities, libraries and React components in use across @polkadot projects',
markdown: {
lineNumbers: true
},
themeConfig: {
displayAllHeaders: true,
nav: [
{ text: 'Polkadot/Substrate Apps', link: 'https://polkadot.js.org/apps/' },
{ text: 'Project family', link: 'https://polkadot.js.org/' },
{
text: 'Documentation',
items: [
{ text: 'API Reference', link: 'https://polkadot.js.org/api/' },
{ text: 'Utility Reference', link: 'https://polkadot.js.org/common/' },
{ text: 'UI Libs Reference (this)', link: 'https://polkadot.js.org/ui/' },
]
},
{ text: 'GitHub', link: 'https://github.com/polkadot-js/ui' }
],
search: false,
sidebar: [
{
title: 'Getting started',
path: '/start/',
collapsable: false,
sidebarDepth: 0,
children: [
['start/packages.md', 'Available packages'],
['start/keyring.md', 'Keyring'],
['start/keyring.accounts.md', 'Keyring accounts'],
['start/keyring.derivation.md', 'Account derivation'],
['start/keyring.retrieve.md', 'Account retrieval'],
['start/keyring.other.md', 'Other addresses'],
['start/FAQ.md', 'FAQ']
]
},
['/react-identicon/', '@polkadot/react-identicon'],
['/react-qr/', '@polkadot/react-qr'],
['/reactnative-identicon/', '@polkadot/reactnative-identicon'],
['/ui-keyring/', '@polkadot/ui-keyring'],
['/ui-settings/', '@polkadot/ui-settings'],
['/ui-shared/', '@polkadot/ui-shared'],
['/vue-identicon/', '@polkadot/vue-identicon'],
'/CONTRIBUTING.md'
]
}
};
-9
View File
@@ -1,9 +0,0 @@
$accentColor = #fd8824
$textColor = #2c3e50
.home .hero .description,
.home .feature h2,
.home .feature p {
color: $textColor
opacity: 0.75
}
+12
View File
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=0.5, maximum-scale=1">
<meta http-equiv="refresh" content="0;URL='https://polkadot.js.org/docs/'" />
<title>Redirecting to https://polkadot.js.org/docs/</title>
</head>
<body>
Redirecting to <a href="https://polkadot.js.org/docs/">https://polkadot.js.org/docs/</a>
</body>
</html>
-52
View File
@@ -1,52 +0,0 @@
---
home: true
heroText:
tagline:
# Bringing JavaScript to the Polkadot world.
# actionText: Repository Overview
# actionLink: /REPOS.md
features:
- title: Frameworks
details: We support multiple UI frameworks, including React, React Native and Vue.
- title: Identicon
details: A flexible identity icon generator supporting a number of display styles based on theme.
- title: Keyring
details: An extension to the base keyring that allows for additions such as browser storage.
footer: Apache-2 Licensed | Copyright © 2017-2019 polkadot-js authors and contributors
---
## Welcome
This is a collection of UI libraries, utilities and classes that allows for easier use of the Polkadot JS infrastructure inside your apps.
::: tip Getting started
For those new to these repose, we provide a [getting started](start/README.md) guide to take you from the tame to the insane.
:::
## Available packages
This repository split up into a number of internal packages, namely -
- Examples take a short dive into some functionality, either for [React](example-react/README.md), [React Native](exampleReactNative) and [Vue](example-vue/README.md).
- Identicons display identity icons based on theme, available for [React](react-identicon/README.md) also availble for [React Native](reactnative-identicon/README.md) and [Vue](vue-identicon/README.md)
- [keyring](ui-keyring/README.md) A keyring with browser-specific extensions
- [settings](ui-settings/README.md) Setting management and defaults
## The Polkadot Project
You can read more about the Polkadot Network at [https://polkadot.network/](https://polkadot.network/) and more about the polkadot-js projects at [https://polkadot.js.org](https://polkadot.js.org)
## Github repositories
You can find the Polkadot repositories at:
- [https://github.com/polkadot-js](https://github.com/polkadot-js)
- [https://github.com/paritytech/polkadot](https://github.com/paritytech/polkadot)
- [https://github.com/paritytech/substrate](https://github.com/paritytech/substrate)
This documentation is generated from [https://github.com/polkadot-js/ui](https://github.com/polkadot-js/ui)
## Contributing
Contribution to the Polkadot JS projects are more than welcome. You can [report issues](https://github.com/polkadot-js/ui/issues/new) and [log feature requests](https://github.com/polkadot-js/ui/issues/new).
+12
View File
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=0.5, maximum-scale=1">
<meta http-equiv="refresh" content="0;URL='https://polkadot.js.org/docs/'" />
<title>Redirecting to https://polkadot.js.org/docs/</title>
</head>
<body>
Redirecting to <a href="https://polkadot.js.org/docs/">https://polkadot.js.org/docs/</a>
</body>
</html>
-11
View File
@@ -1,11 +0,0 @@
# FAQ
The list will be updated/expanded as questions come up, dealing with some common issues that users find.
## I have a crypto has not been initialized error
When using the keyring, make sure that you are [initializing the keyring](keyring.md#initialization) before attempting to use it. Generally you would hook this into the async API creation (which transparently caters for the WASM load).
## My React Native build runs out of memory
When using the keyring packages with RN, due to a lack of support, an [asm.js fallback](https://github.com/polkadot-js/wasm/issues/19) is provided. This does however all some memory load to the application build process (and is by no means fast), ensure that you adjust your build flags to include `NODE_OPTIONS=--max_old_space_size=8192`, for instance doing `NODE_OPTIONS=--max_old_space_size=8192 yarn run ios`
-15
View File
@@ -1,15 +0,0 @@
# Getting started
These sections should provide you with all the information needed to install any packages in this repo, understand the structure of the interfaces and allow you to start using it. It really focusses on the general packages with any framework-specific packages such as icons as detailed in their own section.
## What this is not
This is not line-by-line documentation of all the existing function calls available, nor it is tied to a specific framework that you may end up using. We have users using frameworks such as Angular, Electron, React, React Native, Next.js and Vue and even support direct environments such as browser extensions, Electron apps in addition to the normal web applications you may be used to. There will be some things in the libraries that are probably not covered, which brings us to the next point...
## Help us help others
If you spot gaps in the information provided, or are uncertain about any specific area, please do [log an issue](https://github.com/polkadot-js/ui/issues) or if you are that way inclined, make a pull-request. We really want to have good documentation in these areas and allow people to be productive right from the start.
## Ready? Steady? Go!
If you already have a good grasp on the API and are just looking for a specific answer, you may want to take a look at the [Frequently Asked Questions](FAQ.md). With all that said, let's get started... [What are all these things and what can I do with it](packages.md)
-49
View File
@@ -1,49 +0,0 @@
# Keyring accounts
With our keyring setup completed in the previous section, and all available accounts loaded, we are ready to proceed. However we have not actually loaded any accounts yet, since well, we have not created or stored any previously. So let's change that.
## Adding accounts
The keyring has a number of ways to add accounts, but in 99% of the cases, you should need only a single method to add an account to the keyring - `addUri(suri: string, password?: string, meta: KeyringPair$Meta = {}, type?: KeypairType)`. Let's jump in with some explicit examples -
```js
import { mnemonicGenerate } from '@polkadot/util-crypto';
...
// generate a random mnemonic, 12 words in length
const mnemonic = mnemonicGenerate(12);
// add the account, encrypt the stored JSON with an account-specific password
const { pair, json } = keyring.addUri(mnemonic, 'myStr0ngP@ssworD', { name: 'mnemonic acc' });
```
The above example is relatively straight-forward. Create an account with the specified mnemonic, encrypt the account (as stored) with the password and attach some metadata to the account. It returns a pair instance (we will work with these later) as well as the encrypted json as is saved to the store.
Metadata is free form, with any indicators that you would find useful in your application. Some fields that are known to be used in (and also exists other keyring entries such as contacts & contracts) includes -
- `genesisHash` - a hex value of the genesis this accounts belong to. If specified, the account will only be loaded when the same genesisHash is available in the keyring options
- `name` - a human-readable description for the account
## Non-mnemonic accounts
Generally, we would encourage all wallets and users to only support mnemonic phrases - these are portable between crypto implementations, has built-in checksums and is a standard across the blockchain environment.
In some cases however, either due to the need to provide backwards compatibility or for closed environments, other seed types may be used. The `addUri` will detect the type of input, i.e. if a hex-encoded value is provided, it will treat it as a raw seed. With this in mind, we can rewrite our example above to generate a random raw seed -
```js
import { randomAsHex } from '@polkadot/util-crypto';
...
// generate a random hex raw seed, this needs to be 32 bytes in length
const seed = randomAsHex(32);
// add the account, encrypting it, override to ed25519
const { pair, json } = keyring.addUri(seed, 'weakpass', { name: 'hex seed acc' }, 'ed25519');
```
In addition to creating the account in the same fashion as in the preceding section, we are overriding the type of the account created here. Assuming we created the keyring with the `type: 'sr25519'` option, the first mnemonic account was created with an `sr25519` type. Here we specify the type of crypto explicitly, and therefore create a non-default (for this keyring instance) `ed25519` type.
## Deriving accounts
In the next section, we will expand our account creation capabilities and take a look at [account derivation and passing suri options](keyring.derivation.md).
-29
View File
@@ -1,29 +0,0 @@
# Account derivation
[Secret URIs](https://github.com/paritytech/substrate/wiki/Secret-URI-Test-Vectors) are a way of describing the phrase/seed along with derivation paths. This explains the naming of the default add as `addUri(...)`, it can handle mnemonics, seeds and apply suri derivations on these.
## Diving in
As a follow-up on what we have done in the preceding section, we take a dive into expanding our account addition with derivation, in this case we are applying two hard paths, `hard` followed by `derivation` -
```js
...
// add the account with hard derivation paths
keyring.addUri(`${mnemonic}//hard//derivation`, 'donotcare', { name: 'testing derive' });
```
This format is standard across the `@polkadot/keyring`, `@polkadot/ui-keyring` as well as [Substrate subkey](https://github.com/paritytech/substrate/tree/master/subkey), so it is a Polkadot/Substrate specific way of defining derivation paths.
## Understanding paths
To build a suri, you paths, the format is always `<mnemonic or seed>[//hard][/soft][///password]` and it is passed as-is to the `addUri(...)` function. the derivation types are -
- Soft derivation, i.e `/<soft path>` - Here a single slash, `/`, denotes a soft derivation. Please note that any pair with an `ed25519` type does not support soft derivations, these are only applicable to `sr25519` types.
- Hard derivation, i.e. `//<hard path>` - Here two slashes, `//`, denoted a hard derivation. This is available to both `sr25519` and `ed25519` pairs. Underlying it will apply a hashing function on the secret, generating a new secret for the remainder of the derivations.
- Password, i.e. `///<password>` - Here three slashed, `///`, denoted the (optional) password. Unlike hard and soft derivations that can be mixed, only a single password should be specified. The password here applies to the actual uri, not be be confused by the JSON encryption password. It is an additional security layer - if your full mnemonic and all paths do leak without the password, a bad actor would still not be able to generate a compatible secret to access funds without the password.
## Retrieving accounts
With a fim grasp on adding accounts, next we will take a look at [retrieving account and account subscriptions](keyring.retrieve.md).
-104
View File
@@ -1,104 +0,0 @@
# Keyring
The [@polkadot/ui-keyring](https://www.npmjs.com/package/@polkadot/ui-keyring) package provides a wrapper around the [@polkadot/keyring](https://www.npmjs.com/package/@polkadot/keyring) package, specifically for use in browser environments. The `ui-keyring` only extends the `keyring`, but does not replace it. All underlying account management functions are provided by the base keyring, the browser-specific extensions allows for transparent management of account state in storage.
Additionally where the base keyring is focussed on accounts, the `ui-keyring` extends this to cater for an address-book, contracts and allows for accounts to be tied to a specific chain. Since UIs are typically split into different parts, it also allows for subscriptions on accounts, so notifications are available when accounts are added or removed.
## Installation
If you already use the [@polkadot/api](https://www.npmjs.com/package/@polkadot/api) in your project (which is true in most cases), you don't need anything more than `yarn add @polkadot/ui-keyring`.
If however you use the `ui-keyring` independently (i.e. in an address generator, like the examples) you would need the `keyring` dependency as well, `yarn add @polkadot/keyring @polkadot/ui-keyring`. (In the first case the `@polkadot/api` already comes bundled with the base keyring, so no additional dependencies are needed).
## Initialization
To understand the initialization process, some background on the underlying libraries are required. For the [Schnorrkel sr25519](https://github.com/w3f/schnorrkel) a WASM library is used. This means that before `sr25519` can be used, the WASM libraries needs to be loaded and initialized. This is not an issue when the keyring only uses `ed25519`.
With this in mind, we take care of the initialization as before we load our keyring, yielding -
```js
import keyring from '@polkadot/ui-keyring';
import { cryptoWaitReady } from '@polkadot/util-crypto';
cryptoWaitReady().then(() => {
// load all available addresses and accounts
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
// additional initialization here, including rendering
});
```
The `cryptoWaitReady()` promise resolves as soon as the underlying WASM libraries have been made available. This is followed by `keyring.loadAll(...)` which is the main initialization for the keyring, which
- initializes the underlying `@polkadot/keyring`
- loads all available accounts, addresses band contracts previously stored
- sets up the default address format with `42` (This is the substrate development default. When not specified, this defaults to `42`)
- defaults to `sr25519` accounts (We can still add `ed25519` accounts, more on this later. When not specified this defaults to `ed25519`)
Since you would generally want the keyring available before rendering the UI (although it can be done elsewhere, showing some info while loading), the following pattern is used in our examples, both React and Vue shown here -
```js
...
cryptoWaitReady().then(() => {
keyring.loadAll({ ... });
// mount React and render
ReactDOM.render(<App />, document.getElementById('app'));
});
```
```js
...
cryptoWaitReady().then(() => {
keyring.loadAll({ ... });
// mount Vue and render
new Vue({ render: (h) => h(App) }).$mount('#app');
});
```
When using the keyring together with the Polkadot-js API, the above would be adapted since the API itself already has a check for the WASM availability. In this case, we can adapt the interface to follow the following pattern -
```js
import { ApiPromise } from '@polkadot/api';
import keyring from '@polkadot/ui-keyring';
...
ApiPromise.create({ ... }).then(() => {
keyring.loadAll({ ... });
// additional initialization here, including rendering
});
```
The above pattern is how initialization is done in some applications such as the [polkadot-js apps UI](https://polkadot.js.org/apps/).
## Additional create options
In addition to the `ss58Format` and `type` options (both optional), the following additional configuration options are available to the `loadAll(...)` call -
- `filter?: (json: KeyringJson) => boolean` - An optional filter that is executed on account loading. This allows us to check the loaded account and apply rules on it before including it in the keyring. Generally this would be used for advanced cases, any account that is filtered with `false` won't appear.
- `genesisHash?: Hash` - The `genesisHash` of accounts to should be loaded. The meta property of the account _may_ contain a `genesisHash`, when both are available and non-matching, the account will not be included. To populate this option, the easiest way is to pass the `api.genesisHash` property.
- `isDevelopment?: boolean` - This flag, when set to `true` loads the keyring in development mode. This means that the default development accounts such as "Alice", "Bob", ..., "Ferdie" are included in the keyring. Generally you would only specify this when actually connected to a development chain.
- `store?: KeyringStore` - An optional store to be used. By default the `ui-keyring` will user browser localStorage, but with a specific store this behavior can be adjusted. For instance, for an extension we would default to the extension store (although localStorage is available) and for Electron apps, we may want to default to file storage.
```js
import { ExtensionStore } from '@polkadot/ui-keyring/stores';
// For file storage where available, e.g. in Electron environments.
// This takes an path in the constructor, new FileStore('~./keyring-data')
// import { FileStore } from '@polkadot/ui-keyring/stores';
// When the store is not specified, it defaults to new BrowserStore()
// import { BrowserStore } from '@polkadot/ui-keyring/stores';
...
keyring.loadAll({ store: new ExtensionStore(), ... });
```
## Managing accounts
With the keyring installed and ready for use, [next we will dive into adding and managing accounts](keyring.accounts.md).
-41
View File
@@ -1,41 +0,0 @@
# Other addresses
As mentioned in previous sections, the keyring not only has the ability to manage accounts (i.e. keypairs), but also allows you to add addresses/contacts as well as contracts to the keyring. This is very useful in the case where you are developing a wallet and want to save external addresses to interact with.
Here we will give an overview of working with addresses, the same concepts can be expanded to work with contracts.
## Adding an address
For accounts, we have the `addUri(...)` endpoint that allows us to create and save an account. For addresses, we the keyring exposes `saveAddress (address: string, meta: KeyringPair$Meta)`, which we can use to save any address -
```js
...
// add the address
const FAUCET_ADDR = 'FvnazYM5KAetYpXoVDfqt9WFcJogKbekXVJ3Fz5oW2Dv82P';
const json = keyring.saveAddress(FAUCET_ADDR, { name: 'Alex faucet' });
// the faucet will now be in the list of available addresses
keyring.getAddresses().forEach(...)
```
From this point forward, the address is in your keyring and can be retrieved via the `getAddresses()` interface. The same call can be used to update the meta for the address, for instance if we wish to change the name above, we can do -
```js
...
const json = keyring.saveAddress(FAUCET_ADDR, { name: 'Alexander Faucet' });
```
And the already-saved address will be updated with the new metadata.
## Removing an address
To clear and address and remove it from the keyring, we can use the `forgetAddress(address: string)` call, this mirrors the `forgetAccount(address: string)` and `forgetContract(address: string)` calls. For instance -
```js
...
// remove the specific address
keyring.forgetAddress(FAUCET_ADDR);
/// the faucet will not be in the list of addresses anymore
keyring.getAddresses().forEach(...)
```
-57
View File
@@ -1,57 +0,0 @@
# Account retrieval
Adding accounts is good. Having access to these accounts when added via `const { pair } = keyring.addUr(...)` is better, but being able to access these to iterate over at a later point (even after reload), is magic. Here we will try to add some magic to your experience, allowing you to retrieve accounts as well as subscribe to changes as they happen.
## Loading all available
As we've seen in the keyring init section, when we can `loadAll`, it loads all added added - this includes those added via `addUri(...)` which transparently saves to the provided storage. Loading means it is available in the keyring, to get a list of the accounts, we can then do -
```js
import { u8aToHex } from '@polkadot/util';
...
const accounts = keyring.getAccounts();
accounts.forEach(({ address, meta, publicKey }) =>
console.log(address, JSON.stringify(meta), u8aToHex(publicKey));
);
```
The above interface was probably not quite what you have been expecting, rather you would have expected to get back a list of the pairs, but rather you received a list of the account descriptors. Some rationale for this approach - since we have `getAccounts()`, `getAddresses()` (for contacts) and `getContracts()` the consistent interface here is applicable. Instead based on an address, you can then retrieve a specific pair -
```js
accounts.forEach(({ address }) => {
// retrieve via address or publicKey
const pair = getPair(address);
// display the locked account status
console.log(address, pair.isLocked);
});
```
Similarly we have a `getPairs()` that mirrors `getAccounts()`, but retrieves the list of available pairs - which is the output you probably expected from the initial `getAccounts()` call.
## Subscriptions (Optional)
In addition to the retrieving of accounts on demand, we can actually subscribe to accounts for the keyring. This subscription returns a list of all accounts as they are updated, i.e. when a new account is added it will callback with a list of all the account, including the new one, when an account is removed, it will callback with a list of accounts, excluding the removed member.
```js
...
// create a subscription to all available accounts, updated real-time
const sub = keyring.accounts.subject.subscribe((accounts) => {
accounts.forEach(({ json, option }) =>
// json is the stored data, including address
// option is a { name: meta.name, value: address }
);
});
...
// at some point when we are not interested anymore, we can unsubscribe
sub.unsubscribe();
```
As with the `get{Accounts|Addresses|Contracts}()` functions, similarly we have in addition to `keyring.accounts.subject` the `keyring.addresses.subject` and `keyring.contracts.subject` subscriptions available, with the same generic result set.
## Other address types
We have been referencing contacts and contracts and number of times up till now, up next we will take a look at [how to store other addresses, be if for an address book or contract](keyring.other.md).
-35
View File
@@ -1,35 +0,0 @@
# Available Packages
Let's take a slightly deeper diver into the available packages that we provide. While we won't (yet) cover the specifics of Frameworks-specifics (such as React, React Native or Vue), we will also take a slight detour from the rest of the getting started sections, just allowing a comprehensive overview of everything provided... including the framework-specifics.
## Organization
Before we get to the available packages, just a note on the organization of the available items. We have a number of types of packages, with the following prefixes -
- `@polkadot/example-*` - These are very basic examples that shows how to actually use the libraries in your own applications. for instance the `@polkadot/example-vue` shows step-by-step how to build a simple key generator with the keyring and the Vue-specific icons. (The `@polkadot/example-react` is equivalent... and we would love to see the same for React Native...)
- `@polkadot/ui-*` - These packages are all framework agnostic. It doesn't matter if you use Angular, React or Vue - these packages are designed to be framework independent and should work in any environment that has the intent of being displayed in a browser window, yes, including Electron.
- `@polkadot/react-*` - As the name suggests, these packages are meant for use with React. In some cases (e.g. UOS support), these may be slightly ahead of other frameworks. However where an equivalent package exists, we always aim for feature parity.
- `@polkadot/reactnative-*` - Specifically for React Native applications.
- `@polkadot/vue-*` - Specifically for Vue applications.
With the above in mind, let's take an initial tour through the various generic implementations.
## Generic UI libraries
As indicated, all of the `@polkadot/ui-*` packages are meant to be framework independent. The only common thread between these are that they are designed for use inside a browser, with no requirement for using a development framework.
The first package we will look at is the [@polkadot/ui-assets package](https://www.npmjs.com/package/@polkadot/ui-assets). It really is just a collection of images that are available for various chains & nodes and makes no assumption about how you are including it in your app, or rather which packager you use.
Up next is a critical component of any non-trivial app that also manages accounts, [@polkadot/ui-keyring](https://www.npmjs.com/package/@polkadot/ui-keyring). It is a browser-specific wrapper around the [@polkadot/keyring pcakge](https://www.npmjs.com/package/@polkadot/keyring) that transparently handles access to accounts, addresses, contracts and storage (saving accounts between use) all while allowing for swapable storage depending on your environment, be it browser, extension or Electron.
[@polkadot/ui-settings](https://www.npmjs.com/package/@polkadot/ui-settings) provides a set of default settings, UI end network related, that could be useful to application developers in certain circumstances. The relates to settings such are ss58 formats, network endpoints and other.
Last-up is the [@polkadot/ui-shared](https://www.npmjs.com/package/@polkadot/ui-shared) package. It is not deemed as generally useful to building apps, but rather contains shared code that is used within other packages, for instance in the generation of icons.
## Diving in
Now that we have some bearing of where we are, it is time to take a dive in, [let's start with the keyring and see what we can do](keyring.md).
+8 -5
View File
@@ -1,12 +1,15 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const config = require('@polkadot/dev-react/config/jest');
// Copyright 2017-2021 @polkadot/ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
const config = require('@polkadot/dev/config/jest.cjs');
module.exports = Object.assign({}, config, {
moduleNameMapper: {
'@polkadot/react-(identicon|qr)(.*)$': '<rootDir>/packages/react-$1/src/$2',
'@polkadot/reactnative-(identicon)(.*)$': '<rootDir>/packages/reactnative-$1/src/$2',
'@polkadot/ui-(assets|keyring|settings|shared)(.*)$': '<rootDir>/packages/ui-$1/src/$2',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': 'empty/object',
'\\.(css|less)$': 'empty/object'
}
'\\.(css|less)$': 'empty/object',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': 'empty/object'
},
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/|rxjs/_esm5)']
});
-14
View File
@@ -1,14 +0,0 @@
{
"lerna": "2.11.0",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
"publish": {
"allowBranch": "master"
}
},
"packages": [
"packages/*"
],
"version": "0.48.1"
}
+28 -21
View File
@@ -1,40 +1,47 @@
{
"version": "0.48.1",
"repository": "https://github.com/polkadot-js/ui",
"author": "Jaco Greeff <jacogr@gmail.com>",
"license": "Apache-2",
"private": true,
"engines": {
"yarn": "^1.10.1"
},
"homepage": ".",
"workspaces": [
"packages/*"
],
"resolutions": {
"babel-core": "^7.0.0-bridge.0",
"typescript": "^3.7.5"
"typescript": "^4.2.3"
},
"scripts": {
"build": "polkadot-dev-build-ts",
"docs": "polkadot-dev-build-docs",
"lint": "eslint --ext .js,.jsx,.ts,.tsx . && tsc --noEmit --pretty",
"build:release": "polkadot-ci-ghact-build",
"lint": "polkadot-dev-run-lint",
"clean": "polkadot-dev-clean-build",
"demo:identicon:react": "yarn build:ts && webpack-serve --config packages/react-identicon/webpack.config.js --content packages/react-identicon --port 8080",
"demo:identicon:vue": "yarn build:ts && webpack-serve --config packages/vue-identicon/webpack.config.js --content packages/vue-identicon --port 8080",
"example:rn:packager": "yarn build:split:code && cd packages/exampleReactNative && yarn copy-workspace-packages && yarn start",
"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:ts && cd packages/example-react && webpack --config webpack.config.js",
"example:vue": "yarn build:ts && cd packages/example-vue && webpack --config webpack.config.js",
"example:react": "yarn build && cd packages/example-react && webpack --config webpack.config.js",
"example:vue": "yarn build && cd packages/example-vue && webpack --config webpack.config.js",
"postinstall": "polkadot-dev-yarn-only",
"test": "jest --coverage --runInBand",
"test:one": "jest"
"test": "polkadot-dev-run-test --coverage --runInBand",
"test:one": "polkadot-dev-run-test"
},
"devDependencies": {
"@babel/core": "^7.8.3",
"@babel/runtime": "^7.8.3",
"@polkadot/dev-react": "^0.33.3",
"@polkadot/ts": "^0.2.1",
"@babel/core": "^7.13.8",
"@babel/runtime": "^7.13.9",
"@polkadot/dev": "^0.62.5",
"@polkadot/ts": "^0.3.61",
"@types/jest": "^26.0.20",
"babel-plugin-transform-vue-template": "^0.4.2",
"empty": "^0.10.1",
"react-native": "^0.61.4"
}
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-is": "^17.0.1",
"react-native": "^0.63.4",
"vue-template-compiler": "^2.6.12",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12",
"webpack-serve": "^3.2.0"
},
"version": "0.71.2"
}
+3 -5
View File
@@ -1,14 +1,12 @@
{
"name": "@polkadot/example-react",
"version": "0.48.1",
"version": "0.71.2",
"description": "A very basic example with ui-* & react-* packages",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"maintainers": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.8.3"
"@babel/runtime": "^7.13.9"
}
}
+61 -27
View File
@@ -1,13 +1,13 @@
// Copyright 2017-2020 @polkadot/example-react authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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 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;
@@ -24,19 +24,27 @@ function App ({ className }: Props): React.ReactElement<Props> | 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);
};
const _onChangeSS58Format = ({ currentTarget: { value } }: React.SyntheticEvent<HTMLSelectElement>): void => {
setSS58Format(parseInt(value, 10));
};
setAddress(keyring.encodeAddress(address, ss58Format));
setPhrase(phrase);
},
[ss58Format]
);
const _onChangeSS58Format = useCallback(
({ currentTarget: { value } }: React.SyntheticEvent<HTMLSelectElement>): void => {
setSS58Format(parseInt(value, 10));
},
[]
);
useEffect((): void => {
_onClickNew();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useEffect((): void => {
@@ -54,13 +62,29 @@ function App ({ className }: Props): React.ReactElement<Props> | null {
</section>
<section>
<label>phrase</label>
<textarea cols={40} rows={4} readOnly value={phrase} />
<textarea
cols={40}
readOnly
rows={4}
value={phrase}
/>
</section>
<section>
<label>icons</label>
<Identicon className='icon' value={address} />
<Identicon className='icon' value={address} theme='polkadot' />
<Identicon className='icon' value={address} theme='beachball' />
<Identicon
className='icon'
value={address}
/>
<Identicon
className='icon'
theme='polkadot'
value={address}
/>
<Identicon
className='icon'
theme='beachball'
value={address}
/>
</section>
<section>
<label>address</label>
@@ -68,11 +92,19 @@ function App ({ className }: Props): React.ReactElement<Props> | null {
</section>
<section>
<label>ss58 format</label>
<select onChange={_onChangeSS58Format} value={ss58Format}>
<select
onChange={_onChangeSS58Format}
value={ss58Format}
>
{settings.availablePrefixes
.filter((_, index): boolean => index !== 0)
.map(({ text, value }): React.ReactNode => (
<option key={value} value={value}>{text}</option>
<option
key={value}
value={value}
>
{text}
</option>
))
}
</select>
@@ -81,7 +113,9 @@ function App ({ className }: Props): React.ReactElement<Props> | null {
);
}
cryptoWaitReady().then((): void => {
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
ReactDOM.render(<App />, rootElement);
});
cryptoWaitReady()
.then((): void => {
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
ReactDOM.render(<App />, rootElement);
})
.catch(console.error);
@@ -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.71.2' };
+19 -21
View File
@@ -1,7 +1,5 @@
/* eslint-disable @typescript-eslint/no-var-requires */
// Copyright 2017-2020 @polkadot/example-react authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/example-react authors & contributors
// SPDX-License-Identifier: Apache-2.0
const path = require('path');
const { WebpackPluginServe } = require('webpack-plugin-serve');
@@ -11,26 +9,11 @@ module.exports = {
devtool: 'cheap-eval-source-map',
entry: './src/index.tsx',
mode: 'development',
output: {
chunkFilename: '[name].[chunkhash:8].js',
globalObject: '(typeof self !== \'undefined\' ? self : this)',
filename: '[name].js',
path: path.join(__dirname, 'build')
},
resolve: {
alias: {
'@polkadot/react-identicon': path.resolve(__dirname, '../react-identicon/build'),
'@polkadot/ui-keyring': path.resolve(__dirname, '../ui-keyring/build'),
'@polkadot/ui-settings': path.resolve(__dirname, '../ui-settings/build'),
'@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build')
},
extensions: ['.js', '.ts', '.tsx']
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /(node_modules)/,
test: /\.(ts|tsx)$/,
use: [
{
loader: 'babel-loader',
@@ -40,14 +23,29 @@ module.exports = {
}
]
},
output: {
chunkFilename: '[name].[chunkhash:8].js',
filename: '[name].js',
globalObject: '(typeof self !== \'undefined\' ? self : this)',
path: path.join(__dirname, 'build')
},
plugins: [
new WebpackPluginServe({
hmr: false, // switch off, Chrome WASM memory leak
liveReload: false, // explict off, overrides hmr
progress: false, // since we have hmr off, disable
port: 8080,
progress: false, // since we have hmr off, disable
static: __dirname
})
],
resolve: {
alias: {
'@polkadot/react-identicon': path.resolve(__dirname, '../react-identicon/build'),
'@polkadot/ui-keyring': path.resolve(__dirname, '../ui-keyring/build'),
'@polkadot/ui-settings': path.resolve(__dirname, '../ui-settings/build'),
'@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build')
},
extensions: ['.js', '.ts', '.tsx']
},
watch: true
};
+3 -5
View File
@@ -1,14 +1,12 @@
{
"name": "@polkadot/example-vue",
"version": "0.48.1",
"version": "0.71.2",
"description": "A very basic example with ui-* & vue-* packages",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"maintainers": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.8.3"
"@babel/runtime": "^7.13.9"
}
}
+34 -32
View File
@@ -1,13 +1,13 @@
// Copyright 2017-2020 @polkadot/example-vue authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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 {
@@ -33,6 +33,25 @@ function generateAccount (ss58Format: Prefix = 42): Account {
}
const Example = Vue.extend({
components: {
Identicon
},
data: function (): Data {
return {
...generateAccount(),
ss58Format: 42,
ss58Options
};
},
methods: {
onClickNew: function (): void {
const { address, phrase } = generateAccount(this.ss58Format);
this.address = address;
this.phrase = phrase;
}
},
name: 'Example',
template: `
<div id="example">
<section>
@@ -62,25 +81,6 @@ const Example = Vue.extend({
</section>
</div>
`,
name: 'Example',
components: {
Identicon
},
data: function (): Data {
return {
...generateAccount(),
ss58Format: 42,
ss58Options
};
},
methods: {
onClickNew: function (): void {
const { address, phrase } = generateAccount(this.ss58Format);
this.address = address;
this.phrase = phrase;
}
},
watch: {
ss58Format: function (): void {
this.address = keyring.encodeAddress(this.address, this.ss58Format);
@@ -88,10 +88,12 @@ const Example = Vue.extend({
}
});
cryptoWaitReady().then((): void => {
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
cryptoWaitReady()
.then((): void => {
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
new Vue({
render: (h): VNode => h(Example)
}).$mount('#example');
});
new Vue({
render: (h): VNode => h(Example)
}).$mount('#example');
})
.catch(console.error);
+6
View File
@@ -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.71.2' };
+31 -34
View File
@@ -1,9 +1,6 @@
/* eslint-disable @typescript-eslint/no-var-requires */
// Copyright 2017-2020 @polkadot/example-vue authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/example-vue authors & contributors
// SPDX-License-Identifier: Apache-2.0
// eslint-disable-next-line @typescript-eslint/no-var-requires
const path = require('path');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const { WebpackPluginServe } = require('webpack-plugin-serve');
@@ -13,12 +10,40 @@ module.exports = {
devtool: 'cheap-eval-source-map',
entry: './src/index.ts',
mode: 'development',
module: {
rules: [
{
exclude: /(node_modules)/,
test: /\.(ts|tsx)$/,
use: [
{
loader: 'babel-loader',
options: require('../../babel.config.js')
}
]
},
{
loader: 'vue-loader',
test: /\.vue$/
}
]
},
output: {
chunkFilename: '[name].[chunkhash:8].js',
globalObject: '(typeof self !== \'undefined\' ? self : this)',
filename: '[name].js',
globalObject: '(typeof self !== \'undefined\' ? self : this)',
path: path.join(__dirname, 'build')
},
plugins: [
new WebpackPluginServe({
hmr: false, // switch off, Chrome WASM memory leak
liveReload: false, // explict off, overrides hmr
port: 8080,
progress: false, // since we have hmr off, disable
static: __dirname
}),
new VueLoaderPlugin()
],
resolve: {
alias: {
'@polkadot/ui-keyring': path.resolve(__dirname, '../ui-keyring/build'),
@@ -28,33 +53,5 @@ module.exports = {
},
extensions: ['.js', '.ts', '.tsx']
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /(node_modules)/,
use: [
{
loader: 'babel-loader',
options: require('../../babel.config.js')
}
]
},
{
test: /\.vue$/,
loader: 'vue-loader'
}
]
},
plugins: [
new WebpackPluginServe({
hmr: false, // switch off, Chrome WASM memory leak
liveReload: false, // explict off, overrides hmr
progress: false, // since we have hmr off, disable
port: 8080,
static: __dirname
}),
new VueLoaderPlugin()
],
watch: true
};
+52 -36
View File
@@ -1,53 +1,58 @@
// Copyright 2017-2020 @polkadot/example-react authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/example-react authors & contributors
// SPDX-License-Identifier: Apache-2.0
import React, { useEffect, useState } from 'react';
import { Button, SafeAreaView, ScrollView, StatusBar, StyleSheet, Text, View } from 'react-native';
import { Colors } from 'react-native/Libraries/NewAppScreen';
import Identicon from '@polkadot/reactnative-identicon';
import keyring from '@polkadot/ui-keyring';
import settings from '@polkadot/ui-settings';
import { mnemonicGenerate, cryptoWaitReady } from '@polkadot/util-crypto';
import { keyring } from '@polkadot/ui-keyring';
import { settings } from '@polkadot/ui-settings';
import { cryptoWaitReady, mnemonicGenerate } from '@polkadot/util-crypto';
const styles = StyleSheet.create({
scrollView: {
backgroundColor: Colors.lighter
},
body: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
backgroundColor: Colors.white
},
buttonContainer: {
alignItems: 'flex-start',
flex: 1,
flexDirection: 'column'
},
mainTitle: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
color: Colors.black,
fontSize: 28,
fontWeight: '600'
},
scrollView: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
backgroundColor: Colors.lighter
},
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
color: Colors.black
},
mainTitle: {
fontSize: 28,
fontWeight: '600',
color: Colors.black
},
sectionDescription: {
marginTop: 8,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
color: Colors.dark,
fontSize: 18,
fontWeight: '400',
color: Colors.dark
marginTop: 8
},
buttonContainer: {
flex: 1,
flexDirection: 'column',
alignItems: 'flex-start'
sectionTitle: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
color: Colors.black,
fontSize: 24,
fontWeight: '600'
}
});
const globalAny = global as unknown as Window;
export default function App (): React.ReactElement<{}> | null {
const [ready, setReady] = useState(false);
export default function App (): React.ReactElement | null {
const [isReady, setReady] = useState(false);
const [address, setAddress] = useState<string | null>(null);
const [phrase, setPhrase] = useState<string | null>(null);
const [ss58Format, setSS58Format] = useState(42);
@@ -65,12 +70,13 @@ export default function App (): React.ReactElement<{}> | null {
};
useEffect((): void => {
ready && _onClickNew();
}, []);
isReady && _onClickNew();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isReady]);
useEffect((): void => {
ready && address && setAddress(keyring.encodeAddress(address, ss58Format));
}, [address, ss58Format]);
isReady && address && setAddress(keyring.encodeAddress(address, ss58Format));
}, [address, isReady, ss58Format]);
const initialize = async (): Promise<void> => {
try {
@@ -78,17 +84,21 @@ export default function App (): React.ReactElement<{}> | null {
} catch (e) {
console.log('Error loading keyring ', e);
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
await globalAny.localStorage.init();
await cryptoWaitReady();
setReady(true);
_onClickNew();
};
if (!ready) {
if (!isReady) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
initialize();
}
if (!ready || !address || !phrase) {
if (!isReady || !address || !phrase) {
return null;
}
@@ -104,11 +114,17 @@ export default function App (): React.ReactElement<{}> | null {
<Text style={styles.mainTitle}>React-Native Example</Text>
</View>
<View style={styles.sectionContainer}>
<Button title='Generate Address' onPress={_onClickNew}></Button>
<Button
onPress={_onClickNew}
title='Generate Address'
/>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Phrase</Text>
<Text selectable={true} style={styles.sectionDescription}>
<Text
selectable={true}
style={styles.sectionDescription}
>
{phrase}
</Text>
</View>
@@ -128,8 +144,8 @@ export default function App (): React.ReactElement<{}> | null {
.map(({ text, value }): React.ReactNode => (
<Button
key={value}
title={text}
onPress={(): void => _onChangeSS58Format(value.toString())}
title={text}
/>
))
}
@@ -1,3 +1,6 @@
// Copyright 2017-2021 @polkadot/example-reactnative authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = {
presets: ['module:metro-react-native-babel-preset']
};
+3 -3
View File
@@ -1,10 +1,10 @@
// Copyright 2017-2020 @polkadot/example-react authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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';
+29 -29
View File
@@ -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
+18 -18
View File
@@ -1,31 +1,26 @@
/* eslint-disable @typescript-eslint/no-var-requires */
// Copyright 2017-2021 @polkadot/example-reactnative authors & contributors
// SPDX-License-Identifier: Apache-2.0
const path = require('path');
const getWorkspaces = require('get-yarn-workspaces');
const workspaces = getWorkspaces(__dirname).filter(item => {
return path.normalize(item) !== path.normalize(__dirname);
});
let workspacesBuildDirs = workspaces.map(workspace => path.join(workspace, 'build/'));
workspacesBuildDirs = workspacesBuildDirs.filter(item => item !== path.join(__dirname, '../reactnative-identicon/build/'));
const workspaces = getWorkspaces(__dirname).filter((item) =>
path.normalize(item) !== path.normalize(__dirname)
);
let workspacesBuildDirs = workspaces.map((workspace) => path.join(workspace, 'build/'));
workspacesBuildDirs = workspacesBuildDirs.filter((item) => item !== path.join(__dirname, '../reactnative-identicon/build/'));
module.exports = {
// watch other packages as well as root node_modules
watchFolders: [
path.resolve(__dirname, '../../node_modules'),
...workspacesBuildDirs
],
// remap node packages to react-native packages
resolver: {
extraNodeModules: {
crypto: require.resolve('react-native-crypto'),
stream: require.resolve('stream-http'),
vm: require.resolve('vm-browserify'),
os: require.resolve('os-browserify'),
process: require.resolve('process'),
os: require.resolve('os-browserify')
stream: require.resolve('stream-http'),
vm: require.resolve('vm-browserify')
}
},
transformer: {
getTransformOptions: () => ({
transform: {
@@ -33,5 +28,10 @@ module.exports = {
inlineRequires: false
}
})
}
},
// watch other packages as well as root node_modules
watchFolders: [
path.resolve(__dirname, '../../node_modules'),
...workspacesBuildDirs
]
};
+12 -6
View File
@@ -1,8 +1,10 @@
// Copyright 2017-2020 @polkadot/example-react authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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 {
@@ -14,26 +16,30 @@ class Storage {
init = async () => {
const keys = await AsyncStorage.getAllKeys();
const data = await AsyncStorage.multiGet(keys);
data.forEach(this.saveItem.bind(this));
this.loading = false;
return [...data];
}
getItem = key => {
getItem = (key) => {
return this.dataMap.get(key);
}
setItem = (key, value) => {
this.dataMap.set(key, value);
return AsyncStorage.setItem(key, value);
}
remove = key => {
remove = (key) => {
this.dataMap.delete(key);
return AsyncStorage.removeItem(key);
}
saveItem = item => {
saveItem = (item) => {
this.dataMap.set(item[0], item[1]);
}
}
+20 -28
View File
@@ -1,18 +1,7 @@
{
"name": "exampleReactNative",
"version": "0.48.1",
"version": "0.71.2",
"private": true,
"workspaces": {
"nohoist": [
"react-native",
"react-native/**",
"react-native-randombytes",
"react-native-randombytes/**",
"@react-native-community/**",
"react-native-svg",
"react-native-svg/**"
]
},
"scripts": {
"copy-workspace-packages": "yarn copy-identicon && yarn copy-ui-shared",
"copy-identicon": "mkdir -p node_modules/@polkadot/reactnative-identicon && cp -r ../reactnative-identicon/build/* ./node_modules/@polkadot/reactnative-identicon",
@@ -23,28 +12,31 @@
"test": "jest"
},
"dependencies": {
"@polkadot/reactnative-identicon": "^0.48.1",
"@polkadot/ui-keyring": "^0.48.1",
"@polkadot/ui-settings": "^0.48.1",
"@react-native-community/async-storage": "^1.7.1",
"fast-text-encoding": "^1.0.0",
"@polkadot/keyring": "^6.0.4",
"@polkadot/reactnative-identicon": "0.71.2",
"@polkadot/ui-keyring": "0.71.2",
"@polkadot/ui-settings": "0.71.2",
"@polkadot/util": "^6.0.4",
"@polkadot/util-crypto": "^6.0.4",
"@react-native-community/async-storage": "^1.12.1",
"fast-text-encoding": "^1.0.3",
"get-yarn-workspaces": "^1.0.2",
"os-browserify": "^0.3.0",
"process": "^0.11.10",
"react": "16.12.0",
"react-native": "^0.61.4",
"react": "^17.0.1",
"react-native": "^0.63.4",
"react-native-crypto": "^2.2.0",
"react-native-randombytes": "^3.5.3",
"stream-http": "^3.1.0"
"react-native-randombytes": "^3.6.0",
"stream-http": "^3.1.1"
},
"devDependencies": {
"@babel/core": "^7.8.3",
"@babel/runtime": "^7.8.3",
"@react-native-community/cli-platform-ios": "^3.0.0",
"@types/react-test-renderer": "16.9.2",
"babel-jest": "^25.1.0",
"metro-react-native-babel-preset": "^0.58.0",
"react-test-renderer": "16.12.0"
"@babel/core": "^7.13.8",
"@babel/runtime": "^7.13.9",
"@react-native-community/cli-platform-ios": "^4.13.0",
"@types/react-test-renderer": "17.0.1",
"babel-jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.65.2",
"react-test-renderer": "17.0.1"
},
"jest": {
"preset": "react-native",
+1 -1
View File
@@ -12,6 +12,6 @@
</head>
<body>
<div id="demo"></div>
<script src="./demo.js"></script>
<script src="./build/Demo.js"></script>
</body>
</html>
+27 -15
View File
@@ -1,31 +1,43 @@
{
"name": "@polkadot/react-identicon",
"version": "0.48.1",
"version": "0.71.2",
"type": "module",
"description": "Renders an SVG picture representing an address",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/ui-settings": "^0.48.1",
"@polkadot/ui-shared": "^0.48.1",
"@types/react-copy-to-clipboard": "^4.3.0",
"color": "^3.1.2",
"jdenticon": "2.2.0",
"react-copy-to-clipboard": "^5.0.2",
"styled-components": "^5.0.0"
"@babel/runtime": "^7.13.9",
"@polkadot/keyring": "^6.0.4",
"@polkadot/ui-settings": "0.71.2",
"@polkadot/ui-shared": "0.71.2",
"@polkadot/util": "^6.0.4",
"@polkadot/util-crypto": "^6.0.4",
"color": "^3.1.3",
"ethereum-blockies-base64": "^1.0.2",
"jdenticon": "3.1.0",
"react-copy-to-clipboard": "^5.0.3",
"styled-components": "^5.2.1"
},
"peerDependencies": {
"@polkadot/keyring": "*",
"@polkadot/util": "*",
"@polkadot/util-crypto": "*",
"react": "*"
"react": "*",
"react-dom": "*",
"react-is": "*",
"styled-components": "*"
},
"devDependencies": {
"@polkadot/keyring": "^2.0.1",
"@polkadot/util-crypto": "^2.0.1",
"@types/react-copy-to-clipboard": "^5.0.0",
"@types/react-dom": "^17.0.1",
"@types/styled-components": "^5.1.7",
"styled-components": "^5.2.1",
"xmlserializer": "^0.6.1"
}
}
+26 -11
View File
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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'];
@@ -20,13 +20,28 @@ export default class Demo extends React.PureComponent {
);
}
return identities.map((value, index): React.ReactNode => (
<IdentityIcon
key={value.toString()}
theme={THEMES[index % THEMES.length] as 'empty'}
value={value}
/>
));
return (
<div>
<div>
{identities.map((value, index): React.ReactNode => (
<Identicon
key={value.toString()}
theme={THEMES[index % THEMES.length] as 'empty'}
value={value}
/>
))}
</div>
<div>
{THEMES.map((theme): React.ReactNode => (
<Identicon
key={theme}
theme={theme as 'empty'}
value='5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'
/>
))}
</div>
</div>
);
}
}
+35 -23
View File
@@ -1,18 +1,18 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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 { isHex, isU8a, u8aToHex } from '@polkadot/util';
import { decodeAddress, encodeAddress } from '@polkadot/util-crypto';
import { Beachball, Empty, Jdenticon, Polkadot } from './icons';
import { ICON_DEFAULT_HOST, settings } from '@polkadot/ui-settings';
import { isHex, isU8a, u8aToHex } from '@polkadot/util';
import { decodeAddress, encodeAddress, ethereumEncode } from '@polkadot/util-crypto';
import { Beachball, Empty, Ethereum, Jdenticon, Polkadot } from './icons';
const Fallback = Beachball;
@@ -25,6 +25,7 @@ const DEFAULT_SIZE = 64;
const Components: Record<string, React.ComponentType<ComponentProps>> = {
beachball: Beachball,
empty: Empty,
ethereum: Ethereum,
jdenticon: Jdenticon,
polkadot: Polkadot,
substrate: Jdenticon
@@ -43,24 +44,20 @@ const Wrapper = styled.div`
position: relative;
}
&:before {
&.highlight:before {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: 50%;
box-shadow: 0 0 5px 2px #e0e0e0;
content: '';
}
&.highlight:before {
box-shadow: 0 0 5px 2px #aaa;
content: '';
}
}
`;
export default class IdentityIcon extends React.PureComponent<Props, State> {
class BaseIcon extends React.PureComponent<Props, State> {
public state: State = {
address: '',
publicKey: '0x'
@@ -69,10 +66,18 @@ export default class IdentityIcon extends React.PureComponent<Props, State> {
private static prefix?: Prefix = undefined;
public static setDefaultPrefix (prefix: Prefix): void {
IdentityIcon.prefix = prefix;
BaseIcon.prefix = prefix;
}
public static getDerivedStateFromProps ({ prefix = IdentityIcon.prefix, value }: Props, prevState: State): State | null {
public static getDerivedStateFromProps ({ prefix = BaseIcon.prefix, theme, value }: Props, prevState: State): State | null {
if (theme === 'ethereum') {
const address = isU8a(value)
? ethereumEncode(value)
: value || '';
return { address, publicKey: '' };
}
try {
const address = isU8a(value) || isHex(value)
? encodeAddress(value, prefix)
@@ -95,7 +100,7 @@ export default class IdentityIcon extends React.PureComponent<Props, State> {
public render (): React.ReactNode {
const { address } = this.state;
const wrapped = this.getWrapped(this.state);
const wrapped = this.getWrapped(this.state, this.props);
return !address
? wrapped
@@ -109,21 +114,22 @@ export default class IdentityIcon extends React.PureComponent<Props, State> {
);
}
private getWrapped ({ address, publicKey }: State): React.ReactNode {
const { className, isHighlight = false, size = DEFAULT_SIZE, style, theme = settings.icon } = this.props;
private getWrapped ({ address, publicKey }: State, { Custom }: Props): React.ReactNode {
const { className = '', isAlternative, isHighlight, size = DEFAULT_SIZE, style, theme = settings.icon } = this.props;
const Component = !address
? Empty
: Components[theme === 'default' ? ICON_DEFAULT_HOST : theme] || Fallback;
: Custom || Components[theme === 'default' ? ICON_DEFAULT_HOST : theme] || Fallback;
return (
<Wrapper
className={`ui--IdentityIcon ${className}`}
className={`ui--IdentityIcon ${className}`}
key={address}
style={style}
>
<Component
address={address}
className={isHighlight ? 'highlight' : ''}
isAlternative={isAlternative}
publicKey={publicKey}
size={size}
/>
@@ -140,3 +146,9 @@ export default class IdentityIcon extends React.PureComponent<Props, State> {
}
}
}
function Icon (props: Props): React.ReactElement<Props> {
return <BaseIcon {...props} />;
}
export const Identicon = React.memo(Icon);
@@ -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,32 +1,29 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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';
import generate from '@polkadot/ui-shared/beachballIcon';
import React, { useCallback } from 'react';
export default class Beachball extends React.PureComponent<Props> {
public render (): React.ReactNode {
const { className, style } = this.props;
import { beachballIcon } from '@polkadot/ui-shared';
return (
<div
className={`container ${className}`}
ref={this.appendIcon}
style={style}
/>
);
}
private appendIcon = (node: Element | null): void => {
const { address, size } = this.props;
if (node) {
node.appendChild(
generate(address, size)
function Identicon ({ address, className = '', size, style }: Props): React.ReactElement<Props> {
const updateElem = useCallback(
(node: HTMLDivElement): void => {
node && node.appendChild(
beachballIcon(address, { isAlternative: false, size })
);
}
}
},
[address, size]
);
return (
<div
className={className}
ref={updateElem}
style={style}
/>
);
}
export const Beachball = React.memo(Identicon);
+15 -21
View File
@@ -1,26 +1,20 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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';
export default class Empty extends React.PureComponent<Props> {
public render (): React.ReactNode {
const { className, size, style } = this.props;
return (
<div
className={`container ${className}`}
style={style}
>
<svg
height={size}
viewBox='0 0 64 64'
width={size}
/>
</div>
);
}
function Identicon ({ className = '', size, style }: Props): React.ReactElement<Props> {
return (
<svg
className={className}
height={size}
style={style}
viewBox='0 0 64 64'
width={size}
/>
);
}
export const Empty = React.memo(Identicon);
@@ -0,0 +1,29 @@
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Props } from '../types';
import makeBlockie from 'ethereum-blockies-base64';
import React, { useMemo } from 'react';
import styled from 'styled-components';
function Identicon ({ address, className = '', style }: Props): React.ReactElement<Props> {
const imgSrc = useMemo(
() => makeBlockie(address),
[address]
);
return (
<img
className={className}
src={imgSrc}
style={style}
/>
);
}
export const Ethereum = React.memo(styled(Identicon)(({ size }: Props) => `
display: block;
height: ${size}px;
width: ${size}px;
`));
@@ -1,24 +1,21 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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';
export default class Jdenticon extends React.PureComponent<Props> {
public render (): React.ReactNode {
const { className, publicKey, size, style } = this.props;
return (
<div
className={`container ${className}`}
style={style}
dangerouslySetInnerHTML={ {
__html: jdenticon.toSvg(publicKey.substr(2), size)
} }
/>
);
}
function Identicon ({ className = '', publicKey, size, style }: Props): React.ReactElement<Props> {
return (
<div
className={className}
dangerouslySetInnerHTML={{
__html: jdenticon.toSvg(publicKey.substr(2), size)
}}
style={style}
/>
);
}
export const Jdenticon = React.memo(Identicon);
+33 -40
View File
@@ -1,7 +1,7 @@
// Copyright 2018-2021 @polkadot/react-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Copyright 2018 Paritytech via paritytech/oo7/polkadot-identicon
// Copyright 2018 @polkadot/react-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// This has been converted from the original version that can be found at
//
@@ -16,46 +16,39 @@
// - Move constants to file-level
// - Overall it is now just a static component, expecting an address as an input value
import { Props as BaseProps } from '../types';
import type { Circle } from '@polkadot/ui-shared/icons/types';
import type { Props } from '../types';
import React from 'react';
import generateIcon, { Circle } from '@polkadot/ui-shared/polkadotIcon';
interface Props extends BaseProps {
sixPoint?: boolean;
import { polkadotIcon } from '@polkadot/ui-shared';
function renderCircle ({ cx, cy, fill, r }: Circle, key: number): React.ReactNode {
return (
<circle
cx={cx}
cy={cy}
fill={fill}
key={key}
r={r}
/>
);
}
export default class Identicon extends React.PureComponent<Props> {
public render (): React.ReactNode {
const { address, className, sixPoint, size, style } = this.props;
return (
<div
className={`container ${className}`}
style={style}
>
<svg
id={address}
name={address}
width={size}
height={size}
viewBox='0 0 64 64'
>
{generateIcon(address, sixPoint).map(this.renderCircle)}
</svg>
</div>
);
}
private renderCircle = ({ cx, cy, r, fill }: Circle, key: number): React.ReactNode => {
return (
<circle
key={key}
cx={cx}
cy={cy}
r={r}
fill={fill}
/>
);
}
function Identicon ({ address, className = '', isAlternative = false, size, style }: Props): React.ReactElement<Props> {
return (
<svg
className={className}
height={size}
id={address}
name={address}
style={style}
viewBox='0 0 64 64'
width={size}
>
{polkadotIcon(address, { isAlternative }).map(renderCircle)}
</svg>
);
}
export const Polkadot = React.memo(Identicon);
+7 -7
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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 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';
+9 -4
View File
@@ -1,8 +1,13 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import { Identicon } from './Identicon';
import Identicon from './Identicon';
export * from './icons';
export { packageInfo } from './packageInfo';
export { Identicon };
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.71.2' };
+14 -6
View File
@@ -1,25 +1,33 @@
// Copyright 2018 @polkadot/react-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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 {
className?: string;
style?: Record<string, string | number>;
style?: React.CSSProperties;
}
export interface Props extends BaseProps {
address: string;
isAlternative?: boolean;
className?: string;
publicKey: string;
size: number;
style?: React.CSSProperties;
}
export interface IdentityProps extends BaseProps {
Custom?: React.ComponentType<Props>;
isAlternative?: boolean;
isHighlight?: boolean;
onCopy?: (value: string) => void;
prefix?: Prefix;
size?: number;
theme?: 'beachball' | 'empty' | 'jdenticon' | 'polkadot' | 'substrate';
theme?: IconTheme;
value?: string | Uint8Array | null;
}
export type IconTheme = 'beachball' | 'empty' | 'ethereum' | 'jdenticon' | 'polkadot' | 'substrate';
+15 -17
View File
@@ -1,8 +1,6 @@
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
// eslint-disable-next-line @typescript-eslint/no-var-requires
const path = require('path');
const ENV = process.env.NODE_ENV || 'development';
@@ -13,27 +11,27 @@ module.exports = {
devtool: isProd ? 'source-map' : 'cheap-eval-source-map',
entry: './src/Demo.tsx',
mode: ENV,
output: {
path: __dirname,
filename: './demo.js'
},
resolve: {
alias: {
'@polkadot/ui-settings': path.resolve(__dirname, '../ui-settings/build'),
'@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build')
},
extensions: ['.js', '.jsx', '.ts', '.tsx']
},
module: {
rules: [
{
test: /\.(js|ts|tsx)$/,
exclude: /(node_modules)/,
test: /\.(js|ts|tsx)$/,
use: [
'babel-loader'
]
}
]
},
plugins: []
output: {
filename: './Demo.js',
path: path.join(__dirname, 'build')
},
plugins: [],
resolve: {
alias: {
'@polkadot/ui-settings': path.resolve(__dirname, '../ui-settings/build'),
'@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build')
},
extensions: ['.js', '.jsx', '.ts', '.tsx']
}
};
+20 -7
View File
@@ -1,17 +1,30 @@
{
"name": "@polkadot/react-qr",
"version": "0.48.1",
"version": "0.71.2",
"type": "module",
"description": "Generates and reads QR codes",
"main": "index.js",
"sideEffects": false,
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"maintainers": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@types/react-qr-reader": "^2.1.1",
"@babel/runtime": "^7.13.9",
"@polkadot/util": "^6.0.4",
"@polkadot/util-crypto": "^6.0.4",
"qrcode-generator": "^1.4.4",
"react-qr-reader": "^2.2.1"
"react-qr-reader": "^2.2.1",
"styled-components": "^5.2.1"
},
"devDependencies": {
"@types/react-qr-reader": "^2.1.3",
"@types/styled-components": "^5.1.7"
},
"peerDependencies": {
"@polkadot/util": "*",
"@polkadot/util-crypto": "*",
"react": "*",
"react-dom": "*",
"styled-components": "*"
}
}
+91 -92
View File
@@ -1,28 +1,32 @@
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BaseProps } from './types';
import React from 'react';
import React, { useEffect, useMemo, useRef, useState } from 'react';
import styled from 'styled-components';
import { xxhashAsHex } from '@polkadot/util-crypto';
import qrcode from './qrcode';
import { qrcode } from './qrcode';
import { createFrames, createImgSize } from './util';
interface Props extends BaseProps {
interface Props {
className?: string;
size?: string | number;
skipEncoding?: boolean;
style?: React.CSSProperties;
value: Uint8Array;
}
interface State {
interface FrameState {
frames: Uint8Array[];
frameIdx: number;
image: string | null;
valueHash: string | null;
}
interface TimerState {
timerDelay: number;
timerId: number | null;
valueHash: string | null;
}
const FRAME_DELAY = 2500;
@@ -31,8 +35,8 @@ const TIMER_INC = 500;
function getDataUrl (value: Uint8Array): string {
const qr = qrcode(0, 'M');
// HACK See out qrcode stringToBytes override as used internally. This
// will only work for the case where we actuall pass `Bytes` in here
// HACK See our qrcode stringToBytes override as used internally. This
// will only work for the case where we actually pass `Bytes` in here
// eslint-disable-next-line @typescript-eslint/no-explicit-any
qr.addData(value as any, 'Byte');
qr.make();
@@ -40,99 +44,94 @@ function getDataUrl (value: Uint8Array): string {
return qr.createDataURL(16, 0);
}
class Display extends React.PureComponent<Props, State> {
public state: State = {
frames: [],
frameIdx: 0,
image: null,
timerDelay: FRAME_DELAY,
timerId: null,
valueHash: null
};
function Display ({ className, size, skipEncoding, style, value }: Props): React.ReactElement<Props> | null {
const [{ image }, setFrameState] = useState<FrameState>({ frameIdx: 0, frames: [], image: null, valueHash: null });
const timerRef = useRef<TimerState>({ timerDelay: FRAME_DELAY, timerId: null });
public static getDerivedStateFromProps ({ value, skipEncoding = false }: Props, prevState: State): Pick<State, never> | null {
const valueHash = xxhashAsHex(value);
const containerStyle = useMemo(
() => createImgSize(size),
[size]
);
if (valueHash === prevState.valueHash) {
return null;
}
// run on initial load to setup the global timer and provide and unsubscribe
useEffect((): () => void => {
const nextFrame = () => setFrameState((state): FrameState => {
// when we have a single frame, we only ever fire once
if (state.frames.length <= 1) {
return state;
}
const frames: Uint8Array[] = skipEncoding
? [value]
: createFrames(value);
let frameIdx = state.frameIdx + 1;
// encode on demand
return {
frames,
frameIdx: 0,
image: getDataUrl(frames[0]),
valueHash
// when we overflow, skip to the first and slightly increase the delay between frames
if (frameIdx === state.frames.length) {
frameIdx = 0;
timerRef.current.timerDelay = timerRef.current.timerDelay + TIMER_INC;
}
timerRef.current.timerId = setTimeout(nextFrame, timerRef.current.timerDelay);
// 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,
frameIdx,
image: getDataUrl(state.frames[frameIdx])
};
});
timerRef.current.timerId = window.setTimeout(nextFrame, FRAME_DELAY);
return (): void => {
// eslint-disable-next-line react-hooks/exhaustive-deps
timerRef.current.timerId && clearTimeout(timerRef.current.timerId);
};
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
public componentDidMount (): void {
this.setState({
timerId: window.setTimeout(this.nextFrame, FRAME_DELAY)
useEffect((): void => {
setFrameState((state): FrameState => {
const valueHash = xxhashAsHex(value);
if (valueHash === state.valueHash) {
return state;
}
const frames: Uint8Array[] = skipEncoding
? [value]
: createFrames(value);
// encode on demand
return {
frameIdx: 0,
frames,
image: getDataUrl(frames[0]),
valueHash
};
});
}, [skipEncoding, value]);
if (!image) {
return null;
}
public componentWillUnmount (): void {
const { timerId } = this.state;
if (timerId) {
clearTimeout(timerId);
}
}
public render (): React.ReactNode {
const { className, size, style } = this.props;
const { image } = this.state;
if (!image) {
return null;
}
return (
return (
<div
className={className}
style={containerStyle}
>
<div
className={className}
style={createImgSize(size)}
className='ui--qr-Display'
style={style}
>
<div
className='ui--qr-Display'
style={style}
>
<img src={image} />
</div>
<img src={image} />
</div>
);
}
private nextFrame = (): void => {
const { frames, frameIdx, timerDelay } = this.state;
if (!frames || frames.length <= 1) {
return;
}
const nextIdx = frameIdx === frames.length - 1
? 0
: frameIdx + 1;
const nextDelay = timerDelay + ((nextIdx === 0) ? TIMER_INC : 0);
const timerId = setTimeout(this.nextFrame, nextDelay);
// 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
this.setState({
frameIdx: nextIdx,
image: getDataUrl(frames[nextIdx]),
timerId,
timerDelay: nextDelay
});
}
</div>
);
}
export default styled(Display as React.ComponentClass<Props>)`
export const QrDisplay = React.memo(styled(Display)`
.ui--qr-Display {
height: 100%;
width: 100%;
@@ -146,4 +145,4 @@ export default styled(Display as React.ComponentClass<Props>)`
width: auto !important;
}
}
`;
`);
+26 -46
View File
@@ -1,58 +1,38 @@
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BaseProps } from './types';
import React from 'react';
import { xxhashAsHex } from '@polkadot/util-crypto';
import React, { useMemo } from 'react';
import { QrDisplay } from './Display';
import { createAddressPayload } from './util';
import QrDisplay from './Display';
interface Props extends BaseProps {
interface Props {
address: string;
genesisHash: string;
className?: string;
size?: string | number;
style?: React.CSSProperties;
}
interface State {
data: Uint8Array | null;
dataHash: string | null;
}
function DisplayAddress ({ address, className, genesisHash, size, style }: Props): React.ReactElement<Props> | null {
const data = useMemo(
() => createAddressPayload(address, genesisHash),
[address, genesisHash]
);
export default class DisplayExtrinsic extends React.PureComponent<Props, State> {
public state: State = {
data: null,
dataHash: null
};
public static getDerivedStateFromProps ({ address, genesisHash }: Props, prevState: State): State | null {
const data = createAddressPayload(address, genesisHash);
const dataHash = xxhashAsHex(data);
if (dataHash === prevState.dataHash) {
return null;
}
return { data, dataHash };
if (!data) {
return null;
}
public render (): React.ReactNode {
const { className, size, style } = this.props;
const { data } = this.state;
if (!data) {
return null;
}
return (
<QrDisplay
className={className}
skipEncoding={true}
size={size}
style={style}
value={data}
/>
);
}
return (
<QrDisplay
className={className}
size={size}
skipEncoding
style={style}
value={data}
/>
);
}
export const QrDisplayAddress = React.memo(DisplayAddress);
+26 -45
View File
@@ -1,58 +1,39 @@
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BaseProps } from './types';
import React from 'react';
import { xxhashAsHex } from '@polkadot/util-crypto';
import React, { useMemo } from 'react';
import { QrDisplay } from './Display';
import { createSignPayload } from './util';
import QrDisplay from './Display';
interface Props extends BaseProps {
interface Props {
address: string;
className?: string;
cmd: number;
genesisHash: Uint8Array | string;
payload: Uint8Array;
size?: string | number;
style?: React.CSSProperties;
}
interface State {
data: Uint8Array | null;
dataHash: string | null;
}
function DisplayPayload ({ address, className, cmd, genesisHash, payload, size, style }: Props): React.ReactElement<Props> | null {
const data = useMemo(
() => createSignPayload(address, cmd, payload, genesisHash),
[address, cmd, payload, genesisHash]
);
export default class DisplayPayload extends React.PureComponent<Props, State> {
public state: State = {
data: null,
dataHash: null
};
public static getDerivedStateFromProps ({ address, cmd, payload }: Props, prevState: State): State | null {
const data = createSignPayload(address, cmd, payload);
const dataHash = xxhashAsHex(data);
if (dataHash === prevState.dataHash) {
return null;
}
return { data, dataHash };
if (!data) {
return null;
}
public render (): React.ReactNode {
const { className, size, style } = this.props;
const { data } = this.state;
if (!data) {
return null;
}
return (
<QrDisplay
className={className}
size={size}
style={style}
value={data}
/>
);
}
return (
<QrDisplay
className={className}
size={size}
style={style}
value={data}
/>
);
}
export const QrDisplayPayload = React.memo(DisplayPayload);
+39
View File
@@ -0,0 +1,39 @@
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { NetworkSpecsStruct } from '@polkadot/ui-settings/types';
import React, { useMemo } from 'react';
import { QrDisplay } from './Display';
import { encodeString } from './util';
interface Props {
className?: string;
networkSpecs: NetworkSpecsStruct;
size?: string | number;
style?: React.CSSProperties;
}
function DisplayNetworkSpecs ({ className, networkSpecs, size, style }: Props): React.ReactElement<Props> | null {
const data = useMemo(
() => encodeString(JSON.stringify(networkSpecs)),
[networkSpecs]
);
if (!data) {
return null;
}
return (
<QrDisplay
className={className}
size={size}
skipEncoding
style={style}
value={data}
/>
);
}
export const QrNetworkSpecs = React.memo(DisplayNetworkSpecs);
+38 -42
View File
@@ -1,64 +1,60 @@
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BaseProps } from './types';
import React from 'react';
import React, { useCallback, useMemo } from 'react';
import Reader from 'react-qr-reader';
import styled from 'styled-components';
import { createImgSize } from './util';
interface Props extends BaseProps {
interface Props {
className?: string;
delay?: number;
onError?: (error: Error) => void;
onScan?: (data: string) => void;
onScan: (data: string) => void;
size?: string | number;
style?: React.CSSProperties;
}
const DEFAULT_DELAY = 150;
const DEFAULT_ERROR = (error: Error): void => {
console.error('@polkadot/react-qr:Scan', error.message);
};
class Scan extends React.PureComponent<Props> {
public render (): React.ReactNode {
const { className, delay = DEFAULT_DELAY, size, style } = this.props;
function Scan ({ className, delay = DEFAULT_DELAY, onError = DEFAULT_ERROR, onScan, size, style }: Props): React.ReactElement<Props> {
const containerStyle = useMemo(
() => createImgSize(size),
[size]
);
return (
<div
className={className}
style={createImgSize(size)}
>
<Reader
className='ui--qr-Scan'
delay={delay}
onError={this.onError}
onScan={this.onScan}
style={style}
/>
</div>
);
}
const _onError = useCallback(
(error: Error) => onError(error),
[onError]
);
private onError = (error: Error): void => {
const { onError = DEFAULT_ERROR } = this.props;
const _onScan = useCallback(
(data: string | null) => data && onScan(data),
[onScan]
);
onError(error);
}
private onScan = (data: string | null): void => {
const { onScan } = this.props;
if (!data || !onScan) {
return;
}
onScan(data);
}
return (
<div
className={className}
style={containerStyle}
>
<Reader
className='ui--qr-Scan'
delay={delay}
onError={_onError}
onScan={_onScan}
style={style}
/>
</div>
);
}
export default styled(Scan)`
export const QrScan = React.memo(styled(Scan)`
.ui--qr-Scan {
display: inline-block;
height: 100%;
@@ -69,4 +65,4 @@ export default styled(Scan)`
margin: 0;
}
}
`;
`);
+44 -39
View File
@@ -1,58 +1,63 @@
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BaseProps } from './types';
import React, { useCallback } from 'react';
import React from 'react';
import { assert } from '@polkadot/util';
import { ADDRESS_PREFIX } from './constants';
import QrScan from './Scan';
import { decodeAddress } from '@polkadot/util-crypto';
import { ADDRESS_PREFIX, SEED_PREFIX } from './constants';
import { QrScan } from './Scan';
interface ScanType {
address: string;
isAddress: boolean;
content: string;
genesisHash: string;
name?: string;
}
interface Props extends BaseProps {
interface Props {
className?: string;
onError?: (error: Error) => void;
onScan?: (scanned: ScanType) => void;
onScan: (scanned: ScanType) => void;
size?: string | number;
style?: React.CSSProperties;
}
export default class ScanAddress extends React.PureComponent<Props> {
public render (): React.ReactNode {
const { className, onError, size, style } = this.props;
function ScanAddress ({ className, 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;
return (
<QrScan
className={className}
onError={onError}
onScan={this.onScan}
size={size}
style={style}
/>
);
}
assert(isValidPrefix, `Invalid prefix received, expected '${ADDRESS_PREFIX}/${SEED_PREFIX}' , found '${prefix}'`);
private onScan = (data: string | null): void => {
const { onScan } = this.props;
const isAddress = prefix === ADDRESS_PREFIX;
if (!data || !onScan) {
return;
}
if (isAddress) {
decodeAddress(content);
}
try {
const [prefix, address, genesisHash, name] = data.split(':');
onScan({ content, genesisHash, isAddress, name: name?.length ? name.join(':') : undefined });
} catch (error) {
console.error('@polkadot/react-qr:QrScanAddress', (error as Error).message, data);
}
}
},
[onScan]
);
assert(prefix === ADDRESS_PREFIX, `Invalid address received, expected '${ADDRESS_PREFIX}', found '${prefix}'`);
decodeAddress(address);
onScan({ address, genesisHash, name });
} catch (error) {
console.error('@polkadot/react-qr:QrScanAddress', error.message, data);
}
}
return (
<QrScan
className={className}
onError={onError}
onScan={_onScan}
size={size}
style={style}
/>
);
}
export const QrScanAddress = React.memo(ScanAddress);
+25 -32
View File
@@ -1,44 +1,37 @@
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BaseProps } from './types';
import React, { useCallback } from 'react';
import React from 'react';
import QrScan from './Scan';
import { QrScan } from './Scan';
interface ScanType {
signature: string;
}
interface Props extends BaseProps {
interface Props {
className?: string;
onError?: (error: Error) => void;
onScan?: (scanned: ScanType) => void;
onScan: (scanned: ScanType) => void;
size?: string | number;
style?: React.CSSProperties;
}
export default class ScanSignature extends React.PureComponent<Props> {
public render (): React.ReactNode {
const { className, onError, size, style } = this.props;
function ScanSignature ({ className, onError, onScan, size, style }: Props): React.ReactElement<Props> {
const _onScan = useCallback(
(signature: string | null) => signature && onScan({ signature: `0x${signature}` }),
[onScan]
);
return (
<QrScan
className={className}
onError={onError}
onScan={this.onScan}
size={size}
style={style}
/>
);
}
private onScan = (signature: string | null): void => {
const { onScan } = this.props;
if (!signature || !onScan) {
return;
}
onScan({ signature: `0x${signature}` });
}
return (
<QrScan
className={className}
onError={onError}
onScan={_onScan}
size={size}
style={style}
/>
);
}
export const QrScanSignature = React.memo(ScanSignature);
+4 -3
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
// SPDX-License-Identifier: Apache-2.0
const ADDRESS_PREFIX = 'substrate';
const SEED_PREFIX = 'secret';
const FRAME_SIZE = 1024;
const SUBSTRATE_ID = new Uint8Array([0x53]);
const CRYPTO_SR25519 = new Uint8Array([0x01]);
@@ -19,5 +19,6 @@ export {
CMD_SIGN_MSG,
CRYPTO_SR25519,
FRAME_SIZE,
SEED_PREFIX,
SUBSTRATE_ID
};
+8 -7
View File
@@ -1,8 +1,9 @@
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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 { QrDisplayAddress } from './DisplayAddress';
export { QrDisplayPayload } from './DisplayPayload';
export { QrScanAddress } from './ScanAddress';
export { QrScanSignature } from './ScanSignature';
export { QrNetworkSpecs } from './NetworkSpecs';
export { packageInfo } from './packageInfo';
+6
View File
@@ -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.71.2' };
+4 -5
View File
@@ -1,6 +1,5 @@
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
// SPDX-License-Identifier: Apache-2.0
import _qrcode from 'qrcode-generator';
@@ -9,8 +8,8 @@ const qrcode: typeof _qrcode = _qrcode;
// HACK The default function take string -> number[], the Uint8array is compatible
// with that signature and the use thereof
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access
(qrcode as any).stringToBytes = (data: Uint8Array): Uint8Array =>
data;
export default qrcode;
export { qrcode };
-9
View File
@@ -1,9 +0,0 @@
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
export interface BaseProps {
className?: string;
size?: string | number;
style?: Record<string, string | number>;
}
+10 -9
View File
@@ -1,12 +1,11 @@
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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;
@@ -64,7 +63,7 @@ describe('util', (): void => {
it('encodes a payload properly', (): void => {
expect(
u8aToHex(
createSignPayload('5HbgaJEuVN5qGbkhgtuDQANivSWwHXWsC2erP1SQUXgciTVq', 3, 'THIS IS SPARTA!')
createSignPayload('5HbgaJEuVN5qGbkhgtuDQANivSWwHXWsC2erP1SQUXgciTVq', 3, 'THIS IS SPARTA!', '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe')
)
).toEqual(
'0x' + // prefix
@@ -72,7 +71,8 @@ describe('util', (): void => {
'01' + // sr25519
'03' + // sign tx
'f4cd755672a8f9542ca9da4fbf2182e79135d94304002e6a09ffc96fef6e6c4c' + // publickey
'544849532049532053504152544121' // THIS IS SPARTA!
'544849532049532053504152544121' + // THIS IS SPARTA!
'b0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe' // genesisHash
);
});
});
@@ -81,7 +81,7 @@ describe('util', (): void => {
it('encodes frames properly', (): void => {
expect(
createFrames(
createSignPayload('5HbgaJEuVN5qGbkhgtuDQANivSWwHXWsC2erP1SQUXgciTVq', 0, '0x12345678')
createSignPayload('5HbgaJEuVN5qGbkhgtuDQANivSWwHXWsC2erP1SQUXgciTVq', 0, '0x12345678', '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe')
).map((u8a): string => u8aToHex(u8a))
).toEqual([
'0x' +
@@ -90,7 +90,8 @@ describe('util', (): void => {
'0000' + // index
'530100' + // payload info, substrate + sr25519 + signtx
'f4cd755672a8f9542ca9da4fbf2182e79135d94304002e6a09ffc96fef6e6c4c' + // publicKey
'12345678' // data
'12345678' + // data
'b0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe' // genesisHash
]);
});
});
+5 -5
View File
@@ -1,6 +1,5 @@
// Copyright 2017-2020 @polkadot/react-qr authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/react-qr authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { isString, u8aConcat, u8aToU8a } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
@@ -33,13 +32,14 @@ export function createAddressPayload (address: string, genesisHash: string): Uin
return encodeString(`${ADDRESS_PREFIX}:${address}:${genesisHash}`);
}
export function createSignPayload (address: string, cmd: number, payload: string | Uint8Array): Uint8Array {
export function createSignPayload (address: string, cmd: number, payload: string | Uint8Array, genesisHash: string | Uint8Array): Uint8Array {
return u8aConcat(
SUBSTRATE_ID,
CRYPTO_SR25519,
new Uint8Array([cmd]),
decodeAddress(address),
u8aToU8a(payload)
u8aToU8a(payload),
u8aToU8a(genesisHash)
);
}
+17 -7
View File
@@ -1,20 +1,30 @@
{
"name": "@polkadot/reactnative-identicon",
"version": "0.48.1",
"version": "0.71.2",
"type": "module",
"description": "Renders an SVG picture representing an address",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/ui-shared": "^0.48.1",
"react-native-svg": "^11.0.1"
"@babel/runtime": "^7.13.9",
"@polkadot/ui-shared": "0.71.2",
"@polkadot/util": "^6.0.4",
"@polkadot/util-crypto": "^6.0.4",
"react-native-svg": "^12.1.0"
},
"peerDependencies": {
"@polkadot/util": "*",
"@polkadot/util-crypto": "*",
"react": "*",
"react-native": "*"
},
"devDependencies": {
"@types/react-native": "^0.63.51"
}
}
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/reactnative-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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';
@@ -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,8 +1,7 @@
// Copyright 2017-2020 @polkadot/reactnative-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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';
@@ -19,8 +18,8 @@ export default function Empty ({ size }: Props): React.ReactElement<Props> {
<Circle
cx='32'
cy='32'
r='32'
fill='#eee'
r='32'
/>
</Svg>
</View>
@@ -1,40 +1,37 @@
// Copyright 2018 @polkadot/reactnative-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2018-2021 @polkadot/reactnative-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Props as BaseProps } 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 generateIcon, { Circle as CircleType } from '@polkadot/ui-shared/polkadotIcon';
interface Props extends BaseProps {
sixPoint?: boolean;
}
import { polkadotIcon } from '@polkadot/ui-shared';
function renderCircle ({ cx, cy, r, fill }: CircleType, key: number): React.ReactNode {
function renderCircle ({ cx, cy, fill, r }: CircleType, key: number): React.ReactNode {
return (
<SvgCircle
key={key}
cx={cx}
cy={cy}
r={r}
fill={fill}
key={key}
r={r}
/>
);
}
export default function Identicon ({ address, sixPoint, size }: Props): React.ReactElement<Props> {
export default function Identicon ({ address, isAlternative = false, size }: Props): React.ReactElement<Props> {
return (
<View>
<Svg
height={size}
id={address}
width={size}
viewBox='0 0 64 64'
width={size}
>
{generateIcon(address, sixPoint).map(renderCircle)}
{polkadotIcon(address, { isAlternative }).map(renderCircle)}
</Svg>
</View>
);
@@ -1,6 +1,5 @@
// Copyright 2017-2020 @polkadot/reactnative-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/reactnative-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { default as Empty } from './Empty';
export { default as Polkadot } from './Polkadot';
+6 -3
View File
@@ -1,8 +1,11 @@
// Copyright 2017-2020 @polkadot/reactnative-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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.71.2' };
+3 -3
View File
@@ -1,9 +1,9 @@
// Copyright 2018 @polkadot/reactnative-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2018-2021 @polkadot/reactnative-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
export interface Props {
address: string;
isAlternative?: boolean;
publicKey: string;
size: number;
}
+3 -5
View File
@@ -1,14 +1,12 @@
{
"name": "@polkadot/ui-assets",
"version": "0.48.1",
"version": "0.71.2",
"description": "Static assets shared accross projects",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"maintainers": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.8.3"
"@babel/runtime": "^7.13.9"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2021 @polkadot/ui-assets authors & contributors
// SPDX-License-Identifier: Apache-2.0
// empty
+6
View File
@@ -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.71.2' };
+2 -3
View File
@@ -1,6 +1,5 @@
// Copyright 2017-2020 @polkadot/ui-assets authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Copyright 2017-2021 @polkadot/ui-assets authors & contributors
// SPDX-License-Identifier: Apache-2.0
declare module '*.svg' {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
+20 -31
View File
@@ -1,45 +1,34 @@
{
"name": "@polkadot/ui-keyring",
"version": "0.48.1",
"version": "0.71.2",
"type": "module",
"main": "index.js",
"repository": "https://github.com/polkadot-js/apps.git",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"repository": "github:polkadot-js/apps",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"browser": {
"../package.json": "./package.json",
"./ledger/transportsNode": "./ledger/transportsEmpty"
},
"react-native": {
"../package.json": "./package.json",
"./ledger/transportsNode": "./ledger/transportsEmpty",
"./ledger/transportsWeb": "./ledger/transportsEmpty"
},
"dependencies": {
"@babel/runtime": "^7.8.3",
"@ledgerhq/hw-transport-u2f": "^5.7.0",
"@ledgerhq/hw-transport-webusb": "^5.7.0",
"@types/ledgerhq__hw-transport-node-hid": "^4.21.1",
"@types/ledgerhq__hw-transport-u2f": "^4.21.1",
"@types/mkdirp": "^0.5.2",
"@types/store": "^2.0.2",
"extensionizer": "^1.0.1",
"ledger-polkadot": "^0.7.0",
"mkdirp": "^1.0.3",
"@babel/runtime": "^7.13.9",
"@polkadot/hw-ledger": "^6.0.4",
"@polkadot/keyring": "^6.0.4",
"@polkadot/ui-settings": "0.71.2",
"@polkadot/util": "^6.0.4",
"@polkadot/x-rxjs": "^6.0.4",
"mkdirp": "^1.0.4",
"store": "^2.0.12"
},
"devDependencies": {
"@polkadot/keyring": "^2.0.1",
"@polkadot/types": "^1.0.1",
"@polkadot/util": "^2.0.1"
},
"optionalDependencies": {
"@ledgerhq/hw-transport-node-hid": "^5.7.0"
"@types/mkdirp": "^1.0.1",
"@types/store": "^2.0.2"
},
"peerDependencies": {
"@polkadot/keyring": "*"
"@polkadot/keyring": "*",
"@polkadot/ui-settings": "*",
"@polkadot/util": "*"
}
}
+41 -39
View File
@@ -1,59 +1,55 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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 { createTestKeyring } from '@polkadot/keyring/testing';
import { isBoolean, isString } from '@polkadot/util';
import accounts from './observable/accounts';
import addresses from './observable/addresses';
import contracts from './observable/contracts';
import env from './observable/development';
import BrowserStore from './stores/Browser'; // direct import (skip index with all)
import { MAX_PASS_LEN } from './defaults';
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 {
private _accounts: AddressSubject;
export class Base {
#accounts: AddressSubject;
private _addresses: AddressSubject;
#addresses: AddressSubject;
private _contracts: AddressSubject;
#contracts: AddressSubject;
private _keyring?: KeyringInstance;
#keyring?: KeyringInstance;
protected _store: KeyringStore;
protected _genesisHash?: string;
protected _store!: KeyringStore;
private _ss58Format?: Prefix;
constructor () {
this._accounts = accounts;
this._addresses = addresses;
this._contracts = contracts;
this._keyring = undefined;
this.#accounts = accounts;
this.#addresses = addresses;
this.#contracts = contracts;
this._store = new BrowserStore();
}
public get accounts (): AddressSubject {
return this._accounts;
return this.#accounts;
}
public get addresses (): AddressSubject {
return this._addresses;
return this.#addresses;
}
public get contracts (): AddressSubject {
return this._contracts;
return this.#contracts;
}
public get keyring (): KeyringInstance {
if (this._keyring) {
return this._keyring;
if (this.#keyring) {
return this.#keyring;
}
throw new Error('Keyring should be initialised via \'loadAll\' before use');
@@ -93,11 +89,13 @@ export default class Base {
}
public isPassValid (password: string): boolean {
return password.length > 0 && password.length <= MAX_PASS_LEN;
return password.length > 0;
}
public setSS58Format (ss58Format: Prefix): void {
this._ss58Format = ss58Format;
public setSS58Format (ss58Format?: Prefix): void {
if (this.#keyring && ss58Format) {
this.#keyring.setSS58Format(ss58Format);
}
}
public setDevMode (isDevelopment: boolean): void {
@@ -105,15 +103,19 @@ export default class Base {
}
protected initKeyring (options: KeyringOptions): void {
const keyring = testKeyring({ ss58Format: this._ss58Format, ...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._store = options.store || new BrowserStore();
this.#keyring = keyring;
this._genesisHash = options.genesisHash && (
isString(options.genesisHash)
? options.genesisHash.toString()
: options.genesisHash.toHex()
);
this._store = options.store || this._store;
this.addAccountPairs();
}
+80 -54
View File
@@ -1,20 +1,22 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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 { KeyringPair, KeyringPair$Json, KeyringPair$Meta } from '@polkadot/keyring/types';
import type { KeypairType } from '@polkadot/util-crypto/types';
import type { AddressSubject, SingleAddress } from './observable/types';
import type { CreateResult, KeyringAddress, KeyringAddressType, KeyringItemType, KeyringJson, KeyringJson$Meta, KeyringOptions, KeyringStruct } from './types';
import createPair from '@polkadot/keyring/pair';
import chains from '@polkadot/ui-settings/defaults/chains';
import { hexToU8a, isHex, isString } from '@polkadot/util';
import BN from 'bn.js';
import env from './observable/development';
import Base from './Base';
import { accountKey, addressKey, accountRegex, addressRegex, contractKey, contractRegex } from './defaults';
import keyringOption from './options';
import { createPair } from '@polkadot/keyring/pair';
import { chains } from '@polkadot/ui-settings/defaults/chains';
import { bnToBn, hexToU8a, isHex, isString, u8aSorted } from '@polkadot/util';
import { base64Decode, createKeyMulti } from '@polkadot/util-crypto';
import { env } from './observable/env';
import { Base } from './Base';
import { accountKey, accountRegex, addressKey, addressRegex, contractKey, contractRegex } from './defaults';
import { KeyringOption } from './options';
const RECENT_EXPIRY = 24 * 60 * 60;
@@ -22,10 +24,12 @@ 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 {
private stores = {
public readonly keyringOption = new KeyringOption();
#stores = {
account: (): AddressSubject => this.accounts,
address: (): AddressSubject => this.addresses,
contract: (): AddressSubject => this.contracts,
account: (): AddressSubject => this.accounts
contract: (): AddressSubject => this.contracts
};
public addExternal (address: string | Uint8Array, meta: KeyringPair$Meta = {}): CreateResult {
@@ -41,6 +45,15 @@ export class Keyring extends Base implements KeyringStruct {
return this.addExternal(address, { ...meta, hardwareType, isHardware: true });
}
public addMultisig (addresses: (string | Uint8Array)[], threshold: BigInt | BN | number, meta: KeyringPair$Meta = {}): CreateResult {
const address = createKeyMulti(addresses, threshold);
// we could use `sortAddresses`, but rather use internal encode/decode so we are 100%
const who = u8aSorted(addresses.map((who) => this.decodeAddress(who))).map((who) => this.encodeAddress(who));
return this.addExternal(address, { ...meta, isMultisig: true, threshold: bnToBn(threshold).toNumber(), who });
}
public addPair (pair: KeyringPair, password: string): CreateResult {
this.keyring.addPair(pair);
@@ -69,6 +82,10 @@ export class Keyring extends Base implements KeyringStruct {
return pair.toJson(password);
}
public createFromJson (json: KeyringPair$Json, meta: KeyringPair$Meta = {}): KeyringPair {
return this.keyring.createFromJson({ ...json, meta: { ...(json.meta || {}), meta } });
}
public createFromUri (suri: string, meta: KeyringPair$Meta = {}, type?: KeypairType): KeyringPair {
return this.keyring.createFromUri(suri, meta, type);
}
@@ -79,7 +96,7 @@ export class Keyring extends Base implements KeyringStruct {
json.meta.whenEdited = Date.now();
this.keyring.addFromJson(json);
this.accounts.add(this._store, pair.address, json);
this.accounts.add(this._store, pair.address, json, pair.type);
}
public forgetAccount (address: string): void {
@@ -105,7 +122,7 @@ export class Keyring extends Base implements KeyringStruct {
return Object
.keys(available)
.map((address): KeyringAddress => this.getAddress(address, 'account') as KeyringAddress)
.filter((account): boolean => env.isDevelopment() || account.meta.isTesting !== true);
.filter((account) => env.isDevelopment() || account.meta.isTesting !== true);
}
public getAddress (_address: string | Uint8Array, type: KeyringItemType | null = null): KeyringAddress | undefined {
@@ -114,16 +131,16 @@ export class Keyring extends Base implements KeyringStruct {
: this.encodeAddress(_address);
const publicKey = this.decodeAddress(address);
const stores = type
? [this.stores[type]]
: Object.values(this.stores);
? [this.#stores[type]]
: Object.values(this.#stores);
const info = stores.reduce<SingleAddress | undefined>((lastInfo, store): SingleAddress | undefined =>
(store().subject.getValue()[address] || lastInfo), undefined);
return info && {
address,
publicKey,
meta: info.json.meta
meta: info.json.meta,
publicKey
};
}
@@ -164,7 +181,7 @@ export class Keyring extends Base implements KeyringStruct {
// FIXME Just for the transition period (ignoreChecksum)
const pair = this.keyring.addFromJson(json as KeyringPair$Json, true);
this.accounts.add(this._store, pair.address, json);
this.accounts.add(this._store, pair.address, json, pair.type);
}
const [, hexAddr] = key.split(':');
@@ -177,15 +194,21 @@ export class Keyring extends Base implements KeyringStruct {
if (isRecent && (Date.now() - whenCreated) > RECENT_EXPIRY) {
this._store.remove(key);
return;
}
const address = this.encodeAddress(
isHex(json.address)
? hexToU8a(json.address)
// FIXME Just for the transition period (ignoreChecksum)
: this.decodeAddress(json.address, true)
);
// We assume anything hex that is not 32bytes (64 + 2 bytes hex) is an Ethereum-like address
// (this caters for both H160 addresses as well as full or compressed publicKeys) - in the case
// of both ecdsa and ethereum, we keep it as-is
const address = isHex(json.address) && json.address.length !== 66
? json.address
: this.encodeAddress(
isHex(json.address)
? hexToU8a(json.address)
// FIXME Just for the transition period (ignoreChecksum)
: this.decodeAddress(json.address, true)
);
const [, hexAddr] = key.split(':');
this.addresses.add(this._store, address, json);
@@ -215,7 +238,7 @@ export class Keyring extends Base implements KeyringStruct {
};
const pair = this.keyring.addFromAddress(address, json.meta);
this.accounts.add(this._store, pair.address, json);
this.accounts.add(this._store, pair.address, json, pair.type);
}
private allowGenesis (json?: KeyringJson | { meta: KeyringJson$Meta } | null): boolean {
@@ -239,37 +262,44 @@ export class Keyring extends Base implements KeyringStruct {
this._store.all((key: string, json: KeyringJson): void => {
if (options.filter ? options.filter(json) : true) {
if (this.allowGenesis(json)) {
if (accountRegex.test(key)) {
this.loadAccount(json, key);
} else if (addressRegex.test(key)) {
this.loadAddress(json, key);
} else if (contractRegex.test(key)) {
this.loadContract(json, key);
try {
if (this.allowGenesis(json)) {
if (accountRegex.test(key)) {
this.loadAccount(json, key);
} else if (addressRegex.test(key)) {
this.loadAddress(json, key);
} else if (contractRegex.test(key)) {
this.loadContract(json, key);
}
}
} catch (error) {
// ignore
}
}
});
injected.forEach((account): void => {
if (this.allowGenesis(account)) {
this.loadInjected(account.address, account.meta);
try {
this.loadInjected(account.address, account.meta);
} catch (error) {
// ignore
}
}
});
keyringOption.init(this);
this.keyringOption.init(this);
}
public restoreAccount (json: KeyringPair$Json, password: string): KeyringPair {
const type = Array.isArray(json.encoding.content) ? json.encoding.content[1] : 'ed25519';
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(
type,
{
// FIXME Just for the transition period (ignoreChecksum)
publicKey: this.decodeAddress(json.address, true)
},
{ toSS58: this.encodeAddress, type: cryptoType as KeypairType },
{ publicKey: this.decodeAddress(json.address, true) },
json.meta,
hexToU8a(json.encoded)
isHex(json.encoded) ? hexToU8a(json.encoded) : base64Decode(json.encoded),
encType
);
// unlock, save account and then lock (locking cleans secretKey, so needs to be last)
@@ -286,7 +316,7 @@ export class Keyring extends Base implements KeyringStruct {
const json = pair.toJson(password);
this.keyring.addFromJson(json);
this.accounts.add(this._store, pair.address, json);
this.accounts.add(this._store, pair.address, json, pair.type);
return json;
}
@@ -298,7 +328,7 @@ export class Keyring extends Base implements KeyringStruct {
pair.setMeta(meta);
json.meta = pair.meta;
this.accounts.add(this._store, address, json);
this.accounts.add(this._store, address, json, pair.type);
});
}
@@ -319,7 +349,7 @@ export class Keyring extends Base implements KeyringStruct {
delete json.meta.isRecent;
this.stores[type]().add(this._store, address, json);
this.#stores[type]().add(this._store, address, json);
return json as KeyringPair$Json;
}
@@ -345,7 +375,3 @@ export class Keyring extends Base implements KeyringStruct {
return this.addresses.subject.getValue()[address];
}
}
const keyringInstance = new Keyring();
export default keyringInstance;
+4 -7
View File
@@ -1,14 +1,12 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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:';
const CONTRACT_PREFIX = 'contract:';
const MAX_PASS_LEN = 32;
function toHex (address: string): string {
return u8aToHex(
@@ -38,6 +36,5 @@ export {
addressKey,
addressRegex,
contractKey,
contractRegex,
MAX_PASS_LEN
contractRegex
};
+9
View File
@@ -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]);
+8 -18
View File
@@ -1,25 +1,15 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// 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 './Keyring';
let pkgJson;
export { Ledger } from '@polkadot/hw-ledger';
export { packageInfo } from './packageInfo';
try {
pkgJson = require('./package.json');
} catch (error) {
pkgJson = require('../package.json');
}
const keyring = new Keyring();
detectPackage(pkgJson);
export { Keyring, keyring };
export default keyring;
export {
Keyring,
Ledger
};
+11
View File
@@ -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;
}
-103
View File
@@ -1,103 +0,0 @@
// Copyright 2017-2020 @polkadot/ui-keyring authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { LedgerAddress, LedgerSignature, LedgerTypes, LedgerVersion } from './types';
import LedgerApp, { ResponseBase } from '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);
// 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 {
private app: LedgerApp | null = null;
private type: LedgerTypes;
constructor (type: LedgerTypes) {
assert(['hid', 'u2f', 'webusb'].includes(type), `Unsupported transport ${type}`);
this.type = type;
}
private async getApp (): Promise<LedgerApp> {
if (!this.app) {
const def = transports.find(({ type }): boolean => type === this.type);
assert(def, `Unable to find a transport for ${this.type}`);
const transport = await def.create();
this.app = new LedgerApp(transport);
}
return this.app;
}
private async withApp <T> (fn: (app: LedgerApp) => Promise<T>): Promise<T> {
try {
const app = await this.getApp();
return await fn(app);
} catch (error) {
this.app = null;
throw error;
}
}
private async wrapError <T extends ResponseBase> (promise: Promise<T>): Promise<T> {
const result = await promise;
assert(result.return_code === SUCCESS_CODE, result.error_message);
return result;
}
public async getAddress (confirm = false, account = LEDGER_DEFAULT_ACCOUNT, change = LEDGER_DEFAULT_CHANGE, addressIndex = LEDGER_DEFAULT_INDEX): Promise<LedgerAddress> {
return this.withApp(async (app: LedgerApp): Promise<LedgerAddress> => {
const { address, pubKey } = await this.wrapError(app.getAddress(account, change, addressIndex, confirm));
return {
address,
publicKey: `0x${pubKey}`
};
});
}
public async getVersion (): Promise<LedgerVersion> {
return this.withApp(async (app: LedgerApp): Promise<LedgerVersion> => {
const { device_locked: isLocked, major, minor, patch, test_mode: isTestMode } = await this.wrapError(app.getVersion());
return {
isLocked,
isTestMode,
version: [major, minor, patch]
};
});
}
public async sign (message: Uint8Array, account = LEDGER_DEFAULT_ACCOUNT, change = LEDGER_DEFAULT_CHANGE, addressIndex = LEDGER_DEFAULT_INDEX): Promise<LedgerSignature> {
return this.withApp(async (app: LedgerApp): Promise<LedgerSignature> => {
const buffer = u8aToBuffer(message);
const { signature } = await this.wrapError(app.sign(account, change, addressIndex, buffer));
return {
signature: u8aToHex(bufferToU8a(signature))
};
});
}
}
@@ -1 +0,0 @@
declare module '@ledgerhq/hw-transport-webusb';

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