Compare commits

...
324 Commits
Author SHA1 Message Date
github-actions[bot] 5ca6575245 [CI Skip] release/stable 9.7.1
skip-checks: true
2022-07-01 14:45:17 +00:00
Jaco 4cadf3bcb7 9.7.1 (#1572) 2022-07-01 17:40:21 +03:00
github-actions[bot] 81f8f16b98 [CI Skip] bump/beta 9.6.3-1-x
skip-checks: true
2022-06-30 11:38:33 +00:00
Jaco 8edfb1139f Bump dev deps (#1570) 2022-06-30 14:35:05 +03:00
github-actions[bot] 69d1d896d1 [CI Skip] bump/beta 9.6.3-0-x
skip-checks: true
2022-06-28 07:56:25 +00:00
Jaco 3bc62adf6f Sprinkle in readonly on array inputs (#1568) 2022-06-28 10:52:57 +03:00
github-actions[bot] 691a8e9b18 [CI Skip] release/stable 9.6.2
skip-checks: true
2022-06-25 05:26:53 +00:00
Jaco fc812590e5 Fix hexToU8a where 0x is not correctly converted (#1567)
* Fix `hexToU8a` where `0x` is not correctly converted

* 9.6.2

* CHANGELOG
2022-06-25 08:23:36 +03:00
github-actions[bot] 05499abcd5 [CI Skip] bump/beta 9.6.2-2-x
skip-checks: true
2022-06-23 17:05:08 +00:00
Jaco e375dd8a9d Bump dev (w/ deno build fix) (#1566) 2022-06-23 20:01:35 +03:00
github-actions[bot] 3269883e8f [CI Skip] bump/beta 9.6.2-1-x
skip-checks: true
2022-06-23 11:19:10 +00:00
Jaco c99129ee06 Rebump dev 2022-06-23 14:14:53 +03:00
github-actions[bot] 2514e107bf [CI Skip] bump/beta 9.6.2-0-x
skip-checks: true
2022-06-23 11:08:07 +00:00
Jaco 3c34a0e1f2 Bump dev 2022-06-23 14:04:35 +03:00
github-actions[bot] f704e371c8 [CI Skip] release/stable 9.6.1
skip-checks: true
2022-06-23 08:14:26 +00:00
Jaco 97e3443e74 9.6.1 (#1565) 2022-06-23 11:10:14 +03:00
github-actions[bot] a84e101666 [CI Skip] release/beta 9.5.2-19
skip-checks: true
2022-06-23 07:56:55 +00:00
Jaco a799918d58 Bump wasm & dev (#1564) 2022-06-23 10:53:26 +03:00
github-actions[bot] 429390fb62 [CI Skip] release/beta 9.5.2-18
skip-checks: true
2022-06-22 11:38:19 +00:00
Jaco 05d0109b72 Bump dev (w/ 3rd-part from esm.sh) (#1563) 2022-06-22 14:34:06 +03:00
github-actions[bot] 02b1429979 [CI Skip] release/beta 9.5.2-17
skip-checks: true
2022-06-22 10:46:27 +00:00
Jaco 6e1853d01f Bump dev (w/ deno ensure filename fixes) (#1562) 2022-06-22 13:42:58 +03:00
github-actions[bot] aa9c406d01 [CI Skip] release/beta 9.5.2-16
skip-checks: true
2022-06-22 10:10:41 +00:00
Jaco f9ec44823d Added mapping for @noble/secp256k1 to deno.land/x (#1561) 2022-06-22 13:07:12 +03:00
github-actions[bot] 54218651f9 [CI Skip] release/beta 9.5.2-15
skip-checks: true
2022-06-22 08:56:23 +00:00
Jaco 571c9eff6a Bump dev (& ignore perf tests on CI) (#1560) 2022-06-22 11:52:18 +03:00
github-actions[bot] 5b7333b8dd [CI Skip] release/beta 9.5.2-14
skip-checks: true
2022-06-22 08:17:21 +00:00
Jaco 938fa8b967 Bump dev (w/ publish updates) (#1559) 2022-06-22 11:13:18 +03:00
github-actions[bot] b99a69871e [CI Skip] release/beta 9.5.2-13
skip-checks: true
2022-06-22 06:45:47 +00:00
Jaco b1da8f575b Trigger deno build 2022-06-22 09:40:32 +03:00
github-actions[bot] a960aaf6ae [CI Skip] release/beta 9.5.2-12
skip-checks: true
2022-06-22 06:34:30 +00:00
Jaco f88c647ad0 Bump deps (#1558)
* Bump deps

* 3rd party bumps
2022-06-22 09:30:31 +03:00
github-actions[bot] 7ff11925d9 [CI Skip] release/beta 9.5.2-11
skip-checks: true
2022-06-21 13:03:57 +00:00
Jaco cb5a588489 Bump dev (w/ stable deno publish) (#1557)
* Bump dev (w/ stable deno publish)

* Adjust

* Bump dev
2022-06-21 15:59:46 +03:00
github-actions[bot] 09019224e3 [CI Skip] release/beta 9.5.2-10
skip-checks: true
2022-06-21 04:49:51 +00:00
Jaco 2d7031831a Bump TS to 4.7.4 (#1556) 2022-06-21 07:44:57 +03:00
github-actions[bot] faf7ea2b17 [CI Skip] release/beta 9.5.2-9
skip-checks: true
2022-06-21 03:32:33 +00:00
Jaco af973de694 Bump deps (#1555) 2022-06-21 06:28:19 +03:00
github-actions[bot] dfede866b2 [CI Skip] release/beta 9.5.2-8
skip-checks: true
2022-06-20 14:11:41 +00:00
Jaco 0f0b243815 Adjust isNull & isUndefined checks (#1554) 2022-06-20 17:06:35 +03:00
github-actions[bot] 29f53fe906 [CI Skip] release/beta 9.5.2-7
skip-checks: true
2022-06-20 13:30:11 +00:00
Jaco 225c250634 Adjust asserts (#1548)
* Adjust asserts

* Fix linting & build
2022-06-20 16:26:07 +03:00
github-actions[bot] c871e9d735 [CI Skip] release/beta 9.5.2-6
skip-checks: true
2022-06-20 10:19:45 +00:00
Jaco b42ead28e5 Optimize isAsicc check (#1553) 2022-06-20 13:15:00 +03:00
github-actions[bot] db0581c051 [CI Skip] release/beta 9.5.2-5
skip-checks: true
2022-06-20 08:54:49 +00:00
Jaco e7ac095ace Slight improvment to hexToU8a (#1552) 2022-06-20 11:49:41 +03:00
github-actions[bot] a7d9fc48e9 [CI Skip] release/beta 9.5.2-4
skip-checks: true
2022-06-20 08:34:19 +00:00
Jaco 3db2990ce7 Change Date.now() to performance.now() (#1551)
* Change Date.now() to performance.now()

* Adjust
2022-06-20 11:29:59 +03:00
github-actions[bot] 4b7cda243b [CI Skip] release/beta 9.5.2-3
skip-checks: true
2022-06-20 05:13:47 +00:00
Jaco c4ceeb8382 Additional float conversion tests (#1550) 2022-06-20 08:09:51 +03:00
github-actions[bot] 540971d388 [CI Skip] release/beta 9.5.2-2
skip-checks: true
2022-06-19 18:33:38 +00:00
Jaco b4d65a1c49 floatToU8a adjustment (#1549) 2022-06-19 21:29:34 +03:00
github-actions[bot] 4fd4660853 [CI Skip] release/beta 9.5.2-1
skip-checks: true
2022-06-19 07:22:23 +00:00
Jaco 4b46c179b2 floatToU8a & u8aToFloat (#1547)
* floatToU8a & u8aToFloat

* test for asserts
2022-06-19 10:17:35 +03:00
github-actions[bot] 3c6d297ecd [CI Skip] release/beta 9.5.2-0
skip-checks: true
2022-06-18 18:37:12 +00:00
Jaco 4a6e620acc Adjust isUndefined check (#1546) 2022-06-18 21:33:19 +03:00
github-actions[bot] 50b494ee2e [CI Skip] release/stable 9.5.1
skip-checks: true
2022-06-18 11:21:50 +00:00
Jaco 5b551ca976 9.5.1 (#1545) 2022-06-18 14:18:04 +03:00
github-actions[bot] 5f2a0e25f9 [CI Skip] release/beta 9.4.2-25
skip-checks: true
2022-06-18 10:35:02 +00:00
Jaco 4edb0f00b6 Adjust asserts (#1544) 2022-06-18 13:31:25 +03:00
github-actions[bot] 096c772d7d [CI Skip] release/beta 9.4.2-24
skip-checks: true
2022-06-18 06:02:51 +00:00
Jaco d771d4c243 Performance test for isCodec vs instanceof (#1543) 2022-06-18 08:58:59 +03:00
github-actions[bot] e038c36719 [CI Skip] release/beta 9.4.2-23
skip-checks: true
2022-06-17 06:28:47 +00:00
Jaco 19c8799986 Additional property tests (#1542) 2022-06-17 09:25:01 +03:00
github-actions[bot] e7f642e7fb [CI Skip] release/beta 9.4.2-22
skip-checks: true
2022-06-17 04:59:00 +00:00
Jaco 90e05a7907 Adjust objectProperties with key in that check (#1541) 2022-06-17 07:55:08 +03:00
github-actions[bot] 1ad961eb93 [CI Skip] release/beta 9.4.2-21
skip-checks: true
2022-06-16 18:38:27 +00:00
Jaco 8549f1fe89 Adjust isAscii str vs u8a loops (#1540) 2022-06-16 21:34:35 +03:00
github-actions[bot] 0be212bd49 [CI Skip] release/beta 9.4.2-20
skip-checks: true
2022-06-16 14:18:23 +00:00
Jaco 2dd2f78f7e Use \d in regex (as applicable) (#1539)
* Use \d in regex (as applicable)

* Adjust
2022-06-16 17:13:34 +03:00
github-actions[bot] d5ce0ff4d1 [CI Skip] release/beta 9.4.2-19
skip-checks: true
2022-06-16 13:52:39 +00:00
Jaco 4d887e889a Adjust testing for uppercase words in stringCamelCase (#1538)
* Adjust testing for uppercase words in stringCamelCase

* Use \d

* Revert
2022-06-16 16:47:52 +03:00
github-actions[bot] 1113d09315 [CI Skip] release/beta 9.4.2-18
skip-checks: true
2022-06-16 13:12:24 +00:00
Jaco b774b7804b Small camelCase conversion adjustments (#1537)
* Small camelCase conversion adjustments

* Remove unused exports

* Extract formatRuns
2022-06-16 16:07:45 +03:00
github-actions[bot] 6c1b0e7346 [CI Skip] release/beta 9.4.2-17
skip-checks: true
2022-06-16 11:56:18 +00:00
Jaco 68ba664c4c hexToU8a adjustments (#1536)
* hexToU8a adjustments

* Adjust test
2022-06-16 14:51:34 +03:00
github-actions[bot] c3c4ceab8b [CI Skip] release/beta 9.4.2-16
skip-checks: true
2022-06-16 08:34:08 +00:00
Jaco fff30601a0 Unroll u8aToBn loops (#1535)
* Unroll u8aToBn loops

* Adjust with additional xor shortcuts

* Adjust mult -> shift (where below u32)

* assertUnreachable

* Add u8aToNumber
2022-06-16 11:29:23 +03:00
github-actions[bot] cfb5d24a87 [CI Skip] release/beta 9.4.2-15
skip-checks: true
2022-06-15 18:51:31 +00:00
Jaco 7ce4ed1504 Cleanup comments (#1534) 2022-06-15 21:47:23 +03:00
github-actions[bot] 5a00b146fc [CI Skip] release/beta 9.4.2-14
skip-checks: true
2022-06-15 18:22:28 +00:00
Jaco 1a73a3407e Adjust option extraction for helpers (#1533)
* Adjust option extraction for helpers

* Adjust
2022-06-15 21:17:07 +03:00
github-actions[bot] 0db66346a6 [CI Skip] release/beta 9.4.2-13
skip-checks: true
2022-06-14 04:28:47 +00:00
Jaco a07bfe1234 Bump dev (#1532) 2022-06-14 07:24:11 +03:00
github-actions[bot] 5feb233abc [CI Skip] release/beta 9.4.2-12
skip-checks: true
2022-06-13 05:15:51 +00:00
Jaco 16951c6feb Bump 3rd-party deps 2022-06-13 08:11:43 +03:00
github-actions[bot] 22aa8d7adb [CI Skip] release/beta 9.4.2-11
skip-checks: true
2022-06-12 08:16:35 +00:00
Jaco dfaf954f75 Update issue template (#1530) 2022-06-12 11:12:07 +03:00
github-actions[bot] 78911607e8 [CI Skip] release/beta 9.4.2-10
skip-checks: true
2022-06-12 06:15:23 +00:00
Jaco cdcc331e6e Additional internal comments for exposed functions (#1529) 2022-06-12 09:11:12 +03:00
github-actions[bot] 882b29eebd [CI Skip] release/beta 9.4.2-9
skip-checks: true
2022-06-11 20:37:42 +00:00
Jaco de5c9a1594 Inline function for min/max creator (#1528) 2022-06-11 23:33:42 +03:00
github-actions[bot] 2fc26b5533 [CI Skip] release/beta 9.4.2-8
skip-checks: true
2022-06-11 15:21:18 +00:00
Jaco 6d795ecc5d Shared helper function for bn/bi min/max compares (#1527)
* Shared helper function for bn/bi min/max compares

* min/max test
2022-06-11 18:17:21 +03:00
github-actions[bot] a0c3aa3059 [CI Skip] release/beta 9.4.2-7
skip-checks: true
2022-06-11 14:32:46 +00:00
Jaco e30bac1ed6 Test for sqrt(MAX_SAFE_INT) (w/ comments for excluded functions) (#1526)
* Test for sqrt(MAX_SAFE_INT) (w/ comments for excluded functions)

* Adjust {bi, bn}{Max, Min} with factory
2022-06-11 17:28:55 +03:00
github-actions[bot] 50a061eab3 [CI Skip] release/beta 9.4.2-6
skip-checks: true
2022-06-11 07:52:58 +00:00
Jaco f2064f059f Additional @internal markers (#1525) 2022-06-11 10:48:51 +03:00
github-actions[bot] 768cd68146 [CI Skip] release/beta 9.4.2-5
skip-checks: true
2022-06-11 05:43:44 +00:00
Jaco 0a5bfdca5e Bump deps (& issue template) (#1524) 2022-06-11 08:39:52 +03:00
github-actions[bot] 3ec2f6dcb2 [CI Skip] release/beta 9.4.2-4
skip-checks: true
2022-06-10 11:53:05 +00:00
Jaco 0f2a3a142f CHANGELOG (#1523) 2022-06-10 14:48:56 +03:00
github-actions[bot] 6f5a706ec9 [CI Skip] release/beta 9.4.2-3
skip-checks: true
2022-06-10 10:56:44 +00:00
pan 7e0f917c2b update bifrost genesis hash (#1521) 2022-06-10 13:52:50 +03:00
github-actions[bot] 99731a6664 [CI Skip] release/beta 9.4.2-2
skip-checks: true
2022-06-07 06:02:06 +00:00
Jaco 7765476a26 Use bitwise not as Math.floor replacement (#1518)
* Use bitwise not as Math.floor replacement

* No objectSpread in extractTime

* Flatten extractTime calls
2022-06-07 08:58:11 +03:00
github-actions[bot] 2cd9633afe [CI Skip] release/beta 9.4.2-1
skip-checks: true
2022-06-07 05:47:38 +00:00
Jaco 72749d083f Bump deps (#1519) 2022-06-07 08:43:50 +03:00
github-actions[bot] 9ede85f99a [CI Skip] release/beta 9.4.2-0
skip-checks: true
2022-06-06 06:00:31 +00:00
Carlo SalaandJaco d6a390beb4 add Composable support for ledger (#1515)
* fix(networks): move centrifuge to new parachain chain

* feat: add composable support for ledger

* Update packages/networks/src/defaults/genesis.ts

Co-authored-by: Jaco <jacogr@gmail.com>
2022-06-06 08:55:46 +03:00
github-actions[bot] a14bec79f8 [CI Skip] release/stable 9.4.1
skip-checks: true
2022-06-04 05:10:26 +00:00
Jaco c0de5ac3c8 9.4.1 (#1514) 2022-06-04 08:05:32 +03:00
github-actions[bot] 8d7f810556 [CI Skip] release/beta 9.3.2-4
skip-checks: true
2022-06-04 04:48:08 +00:00
Jaco 5c6526a6bd Bump deps (#1513) 2022-06-04 07:44:30 +03:00
github-actions[bot] e9635ab75b [CI Skip] release/beta 9.3.2-3
skip-checks: true
2022-06-03 15:57:54 +00:00
Jaco e946243b6f Additional performance tests (#1512) 2022-06-03 18:53:57 +03:00
github-actions[bot] ca6a4177b5 [CI Skip] release/beta 9.3.2-2
skip-checks: true
2022-06-03 07:24:22 +00:00
Jaco 7817311f84 Bump dev deps (#1511) 2022-06-03 10:20:26 +03:00
github-actions[bot] 77659aae2a [CI Skip] release/beta 9.3.2-1
skip-checks: true
2022-06-01 05:18:41 +00:00
Jaco 7cc619fbb0 Add nextTick (#1510)
* Add nextTick

* ss58Registry test results
2022-06-01 08:14:42 +03:00
github-actions[bot] 887654049e [CI Skip] release/beta 9.3.2-0
skip-checks: true
2022-05-30 07:51:32 +00:00
Jaco d07b79f578 Bump TS (#1508)
* Bump TS

* Override
2022-05-30 10:46:38 +03:00
github-actions[bot] cefeb0bb51 [CI Skip] release/stable 9.3.1
skip-checks: true
2022-05-29 06:27:05 +00:00
Jaco 1d675ec803 9.3.1 (#1507) 2022-05-29 09:23:01 +03:00
github-actions[bot] 7596dfa65c [CI Skip] release/beta 9.2.2-16
skip-checks: true
2022-05-28 10:40:10 +00:00
Jaco 508e997c64 Bump deps (#1506) 2022-05-28 13:35:56 +03:00
github-actions[bot] 89563ee05c [CI Skip] release/beta 9.2.2-15
skip-checks: true
2022-05-27 08:15:04 +00:00
Jaco 8b72584d53 Add compactFromU8aLim (Remove extraneous *Strict) (#1505)
* Add compactFromU8aLim (Remove extraoneous *Strict)

* Fix build
2022-05-27 11:10:56 +03:00
github-actions[bot] 4ae62c114b [CI Skip] release/beta 9.2.2-14
skip-checks: true
2022-05-27 06:20:09 +00:00
Jaco 823fb51d18 Use for loop in string{Came, Pascal}Case conversions (#1504)
* Use for loop in string{Came, Pascal}Case conversions

* Missing +-= (removed as test)
2022-05-27 09:15:56 +03:00
github-actions[bot] a840b815bd [CI Skip] release/beta 9.2.2-13
skip-checks: true
2022-05-25 07:06:12 +00:00
Jaco fbf973dc2a Add u8a-only strict variants (#1503) 2022-05-25 10:02:01 +03:00
github-actions[bot] 2698f6779f [CI Skip] release/beta 9.2.2-12
skip-checks: true
2022-05-25 04:30:46 +00:00
Jaco 3b5de80c54 Compact loop unrolling (#1502) 2022-05-25 07:26:07 +03:00
github-actions[bot] 041f5a7c2b [CI Skip] release/beta 9.2.2-11
skip-checks: true
2022-05-24 15:32:58 +00:00
Jaco cb8f1130af No indirection via isCompact call (#1501) 2022-05-24 18:28:43 +03:00
github-actions[bot] f480df7504 [CI Skip] release/beta 9.2.2-10
skip-checks: true
2022-05-24 15:00:08 +00:00
Jaco 51763d3bf9 Adjust instanceof checks (#1500) 2022-05-24 17:56:01 +03:00
github-actions[bot] d2b7e88060 [CI Skip] release/beta 9.2.2-9
skip-checks: true
2022-05-24 14:31:54 +00:00
Jaco b20df563ce Buffer short-circuit (onlky convert when non-Uint8Array) (#1499) 2022-05-24 17:27:47 +03:00
github-actions[bot] 5ada180d66 [CI Skip] release/beta 9.2.2-8
skip-checks: true
2022-05-24 13:47:16 +00:00
Jaco a4256de444 Small u8aToU8a optimizations (#1498)
* Small u8aToU8a optimizations

* Slight order adjustments

* Adjust
2022-05-24 16:42:58 +03:00
github-actions[bot] bce5553a4b [CI Skip] release/beta 9.2.2-7
skip-checks: true
2022-05-24 11:44:49 +00:00
Carlo Sala 670743cbcf some changes to KnownLedger (#1497)
* add `nodle-para` chain

* add astar and polkadex to KnownLedger

* remove `nodle-chain`
2022-05-24 14:39:50 +03:00
github-actions[bot] ffed9ceb6d [CI Skip] release/beta 9.2.2-6
skip-checks: true
2022-05-22 08:44:56 +00:00
Jaco bbacb1b80a Bump deps (#1496) 2022-05-22 11:40:09 +03:00
github-actions[bot] 5ea38c9898 [CI Skip] release/beta 9.2.2-5
skip-checks: true
2022-05-20 12:21:52 +00:00
Jaco 7177722a49 Fix buffer imports (#1495) 2022-05-20 15:17:39 +03:00
github-actions[bot] 6083923604 [CI Skip] release/beta 9.2.2-4
skip-checks: true
2022-05-20 10:04:53 +00:00
Jaco 7a3e1c23aa Internal bip32 mnemonicGenerate takes numWords param (#1494)
* Internal bip32 mnemonicGenerate takes numWords param

* Bump deps

* Calculate Calculate strength

* Remove duplicated assert
2022-05-20 13:00:07 +03:00
github-actions[bot] cab50dbf7a [CI Skip] release/beta 9.2.2-3
skip-checks: true
2022-05-20 09:01:11 +00:00
Jaco 9964b308ce Small readability cleanups (#1493) 2022-05-20 11:56:01 +03:00
github-actions[bot] 247a0e7227 [CI Skip] release/beta 9.2.2-2
skip-checks: true
2022-05-20 06:07:23 +00:00
Jaco f2dba8aff8 Small typo cleanups (#1492) 2022-05-20 09:02:32 +03:00
github-actions[bot] 2ef18335e3 [CI Skip] release/beta 9.2.2-1
skip-checks: true
2022-05-20 05:59:47 +00:00
Jaco fa0818d088 Small addressToEvm non-local change (#1491) 2022-05-20 08:55:58 +03:00
github-actions[bot] 2106626f22 [CI Skip] release/beta 9.2.2-0
skip-checks: true
2022-05-16 09:17:38 +00:00
Carlo Sala fceab0becc add parallel to KnownLedger (#1490) 2022-05-16 12:13:31 +03:00
github-actions[bot] bdf42368f7 [CI Skip] release/stable 9.2.1
skip-checks: true
2022-05-13 19:21:22 +00:00
Jaco 36ab5ea5e2 9.2.1 (#1489) 2022-05-13 22:16:25 +03:00
github-actions[bot] c5c8469038 [CI Skip] release/beta 9.1.2-11
skip-checks: true
2022-05-13 08:24:30 +00:00
Jaco 83d0121a28 Additional deprecations (#1488)
* Additional deprecations

* Unsigned shift

* Adjust

* offset calc
2022-05-13 11:19:20 +03:00
github-actions[bot] aff74ebde3 [CI Skip] release/beta 9.1.2-10
skip-checks: true
2022-05-13 06:46:09 +00:00
Jaco be4619ba3d MArk deprecated function signatures (#1487) 2022-05-13 09:40:43 +03:00
github-actions[bot] 17bc2e9fa0 [CI Skip] release/beta 9.1.2-9
skip-checks: true
2022-05-13 05:39:36 +00:00
Jaco 66e2382f26 Re-add top-level cryptoWaitReady (#1486) 2022-05-13 08:34:53 +03:00
github-actions[bot] 6c299f81c6 [CI Skip] release/beta 9.1.2-8
skip-checks: true
2022-05-13 04:33:17 +00:00
Nantian a4fcba6ff6 add acala ledger config (#1485) 2022-05-13 07:29:10 +03:00
github-actions[bot] 1a3507366e [CI Skip] release/beta 9.1.2-7
skip-checks: true
2022-05-12 09:18:43 +00:00
Jaco 65939dbe9d Signed conversion on empty u8a (#1484) 2022-05-12 12:14:34 +03:00
github-actions[bot] 6914411232 [CI Skip] release/beta 9.1.2-6
skip-checks: true
2022-05-12 07:59:10 +00:00
Jaco c79f46aaa2 Bump to beta @polkadot/wasm-* (#1483) 2022-05-12 10:55:00 +03:00
github-actions[bot] cea09b2c8b [CI Skip] release/beta 9.1.2-5
skip-checks: true
2022-05-12 05:14:44 +00:00
Jaco bc23ed9fc9 Bump deps (#1482) 2022-05-12 08:09:53 +03:00
github-actions[bot] a4f286e89a [CI Skip] release/beta 9.1.2-4
skip-checks: true
2022-05-10 07:02:34 +00:00
Jaco f112f9eb5e Bump deps (#1480) 2022-05-10 09:57:45 +03:00
github-actions[bot] 010552ca44 [CI Skip] release/beta 9.1.2-3
skip-checks: true
2022-05-09 09:54:37 +00:00
Jaco 9ae4b1066e Change all occurences of .substr(...) to .substring(...) (#1479) 2022-05-09 12:50:13 +03:00
github-actions[bot] 1a57abde6e [CI Skip] release/beta 9.1.2-2
skip-checks: true
2022-05-09 08:11:13 +00:00
Jaco cf4b44940e Bump dev (#1478) 2022-05-09 11:05:53 +03:00
github-actions[bot] 81e19aace4 [CI Skip] release/beta 9.1.2-1
skip-checks: true
2022-05-07 08:58:12 +00:00
Jaco 7341c32df5 Optimize u8aToHex with direct (non-hex) conversion (#1477)
* Optimize `u8aToHex` with direct (non-hex) conversion

* Adjust compactFromU8a tests
2022-05-07 11:54:08 +03:00
github-actions[bot] bb1ed6cfcd [CI Skip] release/beta 9.1.2-0
skip-checks: true
2022-05-05 06:07:20 +00:00
Jaco 55dcfb5e18 Bump @polkadot/dev (#1476) 2022-05-05 09:03:33 +03:00
github-actions[bot] 2fe9e5a125 [CI Skip] release/stable 9.1.1
skip-checks: true
2022-04-30 05:30:01 +00:00
Jaco e24385213d 9.1.1 (#1473) 2022-04-30 08:25:32 +03:00
github-actions[bot] 9cd81a23e7 [CI Skip] release/beta 9.0.2-11
skip-checks: true
2022-04-30 05:08:24 +00:00
Jaco 64348860cb Bump dev (#1472) 2022-04-30 08:04:24 +03:00
github-actions[bot] ecfceb5d0a [CI Skip] release/beta 9.0.2-10
skip-checks: true
2022-04-29 11:28:19 +00:00
Jaco cc840c37a2 Bump TS (#1471) 2022-04-29 14:24:27 +03:00
github-actions[bot] 527af12b0f [CI Skip] release/beta 9.0.2-9
skip-checks: true
2022-04-29 05:40:33 +00:00
Jaco 9f2b98d5a8 New Rococo genesis (#1470)
* New Rococo genesis

* CHANGELOG
2022-04-29 08:35:39 +03:00
github-actions[bot] 4bd767fb62 [CI Skip] release/beta 9.0.2-8
skip-checks: true
2022-04-28 10:18:44 +00:00
Jaco cff29dfd2d Jg type comments (#1469)
* Add some field-level comments on the keyring

* CHANGELOG
2022-04-28 13:13:32 +03:00
github-actions[bot] d26b80905c [CI Skip] release/beta 9.0.2-7
skip-checks: true
2022-04-27 17:26:43 +00:00
Carlo Sala 4249679882 feat(networks): add statemint to KnownLedger (#1467)
* feat(networks): add statemint

* feat(hw-ledger): add statemint
2022-04-27 20:21:27 +03:00
github-actions[bot] ff27055808 [CI Skip] release/beta 9.0.2-6
skip-checks: true
2022-04-27 06:57:00 +00:00
Jaco 54f8acb27f Bump @polkadot/dev (#1466) 2022-04-27 09:51:59 +03:00
github-actions[bot] 017bebe8bb [CI Skip] release/beta 9.0.2-5
skip-checks: true
2022-04-24 09:21:21 +00:00
Jaco 89f5670d8b Bump @polkadot/dev (#1464) 2022-04-24 12:17:18 +03:00
github-actions[bot] b9e2293bee [CI Skip] release/beta 9.0.2-4
skip-checks: true
2022-04-20 17:40:13 +00:00
xx networkandBernardo Cardoso 3b45418e47 Add xxnetwork genesis hash and ledger app (#1463)
* Add xxnetwork genesis hash and ledger app

* Update test

Co-authored-by: Bernardo Cardoso <bernardo@xx.network>
2022-04-20 20:35:20 +03:00
github-actions[bot] 6af7f6ef24 [CI Skip] release/beta 9.0.2-3
skip-checks: true
2022-04-19 14:02:14 +00:00
Jaco a0b85ee7f8 Bump deps (#1462) 2022-04-19 16:58:00 +03:00
github-actions[bot] 2e0c6c3368 [CI Skip] release/beta 9.0.2-2
skip-checks: true
2022-04-14 04:21:59 +00:00
Jaco 1d36284369 Adjust isHex performance test (#1461) 2022-04-14 07:18:01 +03:00
github-actions[bot] 94788692bb [CI Skip] release/beta 9.0.2-1
skip-checks: true
2022-04-13 05:37:51 +00:00
Jaco 1f3f5d5980 Adjust detectPackage formatting (#1460) 2022-04-13 08:33:37 +03:00
github-actions[bot] 90c2638221 [CI Skip] release/beta 9.0.2-0
skip-checks: true
2022-04-12 05:02:30 +00:00
Jaco 98e02a0baa Bump deps (#1459) 2022-04-12 07:58:00 +03:00
github-actions[bot] e96a204bb5 [CI Skip] release/stable 9.0.1
skip-checks: true
2022-04-09 07:44:36 +00:00
Jaco 0dc4ec48da 9.0.1 (#1457) 2022-04-09 10:40:27 +03:00
github-actions[bot] 5d5c7e4c0a [CI Skip] release/beta 8.7.2-3
skip-checks: true
2022-04-06 08:53:01 +00:00
Jaco 76c973f5c5 Be explicit in re-exports from @polkadot/networks (#1455) 2022-04-06 11:48:34 +03:00
github-actions[bot] 7608f2eed9 [CI Skip] release/beta 8.7.2-2
skip-checks: true
2022-04-06 08:20:38 +00:00
Jaco e585aa1899 Bump dev (w/ bundleInit shim build) (#1454) 2022-04-06 11:15:52 +03:00
github-actions[bot] 82152352ea [CI Skip] release/beta 8.7.2-1
skip-checks: true
2022-04-05 05:29:20 +00:00
Jaco 515e1d62af Bump to latest @polkadot/dev (#1453) 2022-04-05 08:25:15 +03:00
github-actions[bot] 2d2e6bc1bf [CI Skip] release/beta 8.7.2-0
skip-checks: true
2022-04-01 07:50:06 +00:00
Jaco 5bb89db279 Bump dev deps (#1451) 2022-04-01 10:45:59 +03:00
github-actions[bot] 36d8f6c922 [CI Skip] release/stable 8.7.1
skip-checks: true
2022-03-27 07:22:56 +00:00
Jaco 8224beb85d 8.7.1 (#1449) 2022-03-27 10:17:39 +03:00
github-actions[bot] ae6856f124 [CI Skip] release/beta 8.6.2-6
skip-checks: true
2022-03-27 06:27:30 +00:00
Jaco 6953e22168 Bump TypeScript (#1448) 2022-03-27 09:23:26 +03:00
github-actions[bot] 8c815ac601 [CI Skip] release/beta 8.6.2-5
skip-checks: true
2022-03-26 20:00:08 +00:00
Jaco 9f1f5c9f5f Re-add browser entry for util-crypto (#1447) 2022-03-26 21:56:05 +02:00
github-actions[bot] b4acb2afa8 [CI Skip] release/beta 8.6.2-4
skip-checks: true
2022-03-26 16:12:55 +00:00
Jaco 7287e746e3 Bump dev deps (#1446) 2022-03-26 18:08:40 +02:00
github-actions[bot] ea4d5ab2e9 [CI Skip] release/beta 8.6.2-3
skip-checks: true
2022-03-26 15:13:34 +00:00
Jaco 0dbc359f07 s/cryptoInit/bundleInit/ (#1445)
* s/cryptoInit/bundleInit/

* Adjust imports
2022-03-26 17:09:34 +02:00
github-actions[bot] 1e380ca1eb [CI Skip] release/beta 8.6.2-2
skip-checks: true
2022-03-26 11:22:32 +00:00
Jaco 6bbe961a0f Adjust browser entry (#1444) 2022-03-26 13:18:30 +02:00
github-actions[bot] 0fa8484208 [CI Skip] release/beta 8.6.2-1
skip-checks: true
2022-03-23 12:22:19 +00:00
Jaco 30d5f5c118 Additional BN & BigInt negative tests (#1443) 2022-03-23 14:18:14 +02:00
github-actions[bot] 3bcd1d17f6 [CI Skip] release/beta 8.6.2-0
skip-checks: true
2022-03-23 05:19:18 +00:00
Jaco befdfca6b2 Bump dev (#1442) 2022-03-23 07:15:12 +02:00
github-actions[bot] c9b9f80987 [CI Skip] release/stable 8.6.1
skip-checks: true
2022-03-19 07:57:33 +00:00
Jaco 0eae8fb0f7 8.6.1 (#1439)
* 8.6.1

* CHANGELOG
2022-03-19 09:53:48 +02:00
github-actions[bot] 903c3b120f [CI Skip] release/beta 8.5.2-9
skip-checks: true
2022-03-19 07:20:08 +00:00
Jaco 6f8ffcbb99 Bump deps & CHANGELOG (#1438) 2022-03-19 09:16:02 +02:00
github-actions[bot] 2563a0ac3d [CI Skip] release/beta 8.5.2-8
skip-checks: true
2022-03-19 07:03:23 +00:00
Jaco d73ca5805a Fail on invalid secp256k1 publicKey generation (#1437) 2022-03-19 08:59:31 +02:00
github-actions[bot] 1e20b7725b [CI Skip] release/beta 8.5.2-7
skip-checks: true
2022-03-18 14:14:26 +00:00
Lovesh Harchandani 97ec9e6626 Update genesis hash of Dock mainnet (#1436)
Signed-off-by: lovesh <lovesh.bond@gmail.com>
2022-03-18 16:09:24 +02:00
github-actions[bot] 120d5304f1 [CI Skip] release/beta 8.5.2-6
skip-checks: true
2022-03-16 19:15:14 +00:00
Jaco 7c59232204 Bump @polkadot/dev (#1434) 2022-03-16 20:55:13 +02:00
github-actions[bot] 0df0bf094e [CI Skip] release/beta 8.5.2-5
skip-checks: true
2022-03-16 07:22:49 +00:00
Jaco 5b16f0cf36 Bump dev (#1433)
* Bump dev

* Bump dev
2022-03-16 09:17:26 +02:00
github-actions[bot] c1b7cd5885 [CI Skip] release/beta 8.5.2-4
skip-checks: true
2022-03-15 18:25:20 +00:00
Jaco ec7bae841e Bump dev (w/ CJS react-native key) (#1432)
* Bump dev (w/ CJS react-native key)

* Latest dev
2022-03-15 20:21:13 +02:00
github-actions[bot] 06fba7bdca [CI Skip] release/beta 8.5.2-3
skip-checks: true
2022-03-15 17:24:51 +00:00
Jaco b3f19247d5 Cater for Expo v41+ in getRandomValues (#1431) 2022-03-15 19:20:44 +02:00
github-actions[bot] 5e562d7a59 [CI Skip] release/beta 8.5.2-2
skip-checks: true
2022-03-15 10:52:18 +00:00
Jaco b4479f3747 Aplit and organize network defaults (#1430)
* Aplit and organize network defaults

* Update include paths
2022-03-15 12:47:22 +02:00
github-actions[bot] 6dc79a0b7c [CI Skip] release/beta 8.5.2-1
skip-checks: true
2022-03-15 08:33:25 +00:00
Kami e2aa034843 Adding Westend genesis. (#1429)
* Update README.md

ss58-registry.json link is updated the previous link does not work.

* Adding Westend genesis.

We are working on projects that utilize this package, In our projects we need to have Westend testnet, to let the community to try and learn Polkadot ecosystem.

Sometimes Developers have issues adding this manually as asked here: w3f/Grant-Milestone-Delivery#387 (comment),
hence merging this pull request will help a lot.

Thank you.

* Update genesis.ts
2022-03-15 10:28:29 +02:00
github-actions[bot] e99bc1163b [CI Skip] release/beta 8.5.2-0
skip-checks: true
2022-03-15 06:53:18 +00:00
Kami a29dae61c5 Update README.md (#1427)
ss58-registry.json link is updated the previous link does not work.
2022-03-15 08:48:07 +02:00
github-actions[bot] 777a04cc64 [CI Skip] release/stable 8.5.1
skip-checks: true
2022-03-12 08:12:28 +00:00
Jaco 1f22566934 8.5.1 (#1426)
* 8.5.1

* Update test expectations
2022-03-12 10:08:09 +02:00
github-actions[bot] 0011e5219a [CI Skip] release/beta 8.4.2-12
skip-checks: true
2022-03-10 07:39:12 +00:00
Jaco ce331bf6bd Bump deps (& yarn 3.2.0) (#1425) 2022-03-10 09:35:02 +02:00
github-actions[bot] 60d795f480 [CI Skip] release/beta 8.4.2-11
skip-checks: true
2022-03-07 08:13:22 +00:00
Jaco 75a5f2fe48 Support bundlers where import.meta.url is undefined (#1423) 2022-03-07 10:08:38 +02:00
github-actions[bot] dfda191c8b [CI Skip] release/beta 8.4.2-10
skip-checks: true
2022-03-03 13:26:38 +00:00
Jaco de09a2aa90 Rename auto step (#1421) 2022-03-03 15:23:00 +02:00
github-actions[bot] 5e7cb9db9e [CI Skip] release/beta 8.4.2-9
skip-checks: true
2022-03-03 09:32:42 +00:00
Jaco 61eca6100b Remove checkout from auto-{approve, merge} actions (#1420) 2022-03-03 11:27:34 +02:00
github-actions[bot] 4ef36d51ad [CI Skip] release/beta 8.4.2-8
skip-checks: true
2022-03-02 05:18:25 +00:00
Jaco 880f560613 Replace mergify with action (#1419) 2022-03-02 05:13:32 +00:00
github-actions[bot] 3f21278634 [CI Skip] release/beta 8.4.2-7
skip-checks: true
2022-03-01 10:20:56 +00:00
Jaco 3c1e3573c9 Bump TS (#1417) 2022-03-01 10:16:17 +00:00
github-actions[bot] 6f8b14759d [CI Skip] release/beta 8.4.2-6
skip-checks: true
2022-02-27 17:45:01 +00:00
Jaco 057e233cbf Approve action adjust (#1416)
* Approve action adjust

* Only labelled
2022-02-27 17:40:23 +00:00
github-actions[bot] 5dcc12e94d [CI Skip] release/beta 8.4.2-5
skip-checks: true
2022-02-26 08:24:03 +00:00
Jaco 17886d60c0 Dev bump (#1415) 2022-02-26 08:19:32 +00:00
github-actions[bot] b40fca79cb [CI Skip] release/beta 8.4.2-4
skip-checks: true
2022-02-23 10:38:26 +00:00
Jaco c04a228100 Skip job on non-local repo 2022-02-23 12:33:35 +02:00
github-actions[bot] b3b1c7622c [CI Skip] release/beta 8.4.2-3
skip-checks: true
2022-02-23 10:03:20 +00:00
Jaco 06f0813f2f Use jacogr/action-approve (#1412) 2022-02-23 11:58:15 +02:00
github-actions[bot] 5e086d6579 [CI Skip] release/beta 8.4.2-2
skip-checks: true
2022-02-21 10:31:13 +00:00
Jaco 6fef3e0b2e Bump deps (#1411)
* Bump deps

* Bump @noble/secp256k1
2022-02-21 10:27:20 +00:00
github-actions[bot] 7a7ee378c8 [CI Skip] release/beta 8.4.2-1
skip-checks: true
2022-02-15 18:22:10 +00:00
Jaco 6fd2edcd76 Bump deps (#1410) 2022-02-15 18:17:55 +00:00
github-actions[bot] 73d17faaaa [CI Skip] release/beta 8.4.2-0
skip-checks: true
2022-02-15 07:49:34 +00:00
Jaco 47bed3a2ba Add mergify (#1409) 2022-02-15 09:45:31 +02:00
github-actions[bot] 280a8f89bd [CI Skip] release/stable 8.4.1
skip-checks: true
2022-02-14 04:55:25 +00:00
Jaco 8140d44d8a 8.4.1 (#1408)
* 8.4.1

* Disable yarn scripts on CI

* 14
2022-02-14 06:51:08 +02:00
github-actions[bot] 8b7717961f [CI Skip] release/beta 8.3.4-12
skip-checks: true
2022-02-13 08:03:39 +00:00
Jaco e462046c82 Bump deps (#1407) 2022-02-13 09:59:33 +02:00
github-actions[bot] d261b2e464 [CI Skip] release/beta 8.3.4-11
skip-checks: true
2022-02-11 08:56:34 +00:00
Jaco 73898ada43 ss58registry test (#1406)
* ss58registry test

* ss58 reg update

* Remove require

* json resolve

* Include test output
2022-02-11 10:52:35 +02:00
github-actions[bot] bb0831a023 [CI Skip] release/beta 8.3.4-10
skip-checks: true
2022-02-09 05:54:23 +00:00
Jaco 012719b0bf Bump dev deps (#1405) 2022-02-09 07:50:07 +02:00
github-actions[bot] c8dc222435 [CI Skip] release/beta 8.3.4-9
skip-checks: true
2022-02-08 13:39:52 +00:00
Jaco 7e0588b690 Bump dev (#1403) 2022-02-08 15:33:01 +02:00
github-actions[bot] 3dc6e8a128 [CI Skip] release/beta 8.3.4-8
skip-checks: true
2022-02-07 11:53:37 +00:00
Jaco eb5cebfb7c Remove networks:sync (& cron check) (#1402) 2022-02-07 13:49:22 +02:00
github-actions[bot] 1f6417a9a8 [CI Skip] release/beta 8.3.4-7
skip-checks: true
2022-02-07 10:05:36 +00:00
Jaco 306592f6b1 Bump bn.js (#1401)
* Bump bn.js

* Adjust expecatation
2022-02-07 11:59:57 +02:00
github-actions[bot] 673945c8cb [CI Skip] release/beta 8.3.4-6
skip-checks: true
2022-02-05 17:55:53 +00:00
Jaco 8a30f168c3 Bump deps (#1400) 2022-02-05 19:51:39 +02:00
github-actions[bot] 35708e8414 [CI Skip] release/beta 8.3.4-5
skip-checks: true
2022-02-04 06:09:32 +00:00
Jaco fb55db7797 Bump deps (#1399) 2022-02-04 08:04:56 +02:00
github-actions[bot] 2aca02ecd4 [CI Skip] release/beta 8.3.4-4
skip-checks: true
2022-02-02 15:45:46 +00:00
Hoon Kim bba72e7191 replace plasm genesis with astar (#1397) 2022-02-02 17:41:27 +02:00
github-actions[bot] a3ea860144 [CI Skip] release/beta 8.3.4-3
skip-checks: true
2022-02-01 18:42:44 +00:00
Jakub Pánik 6e20baf317 Add basilisk 🐍 (#1396) 2022-02-01 20:38:41 +02:00
github-actions[bot] f8742c8523 [CI Skip] release/beta 8.3.4-2
skip-checks: true
2022-01-29 10:22:29 +00:00
Jaco c6b84b8c7e Bump deps (#1394) 2022-01-29 12:18:20 +02:00
github-actions[bot] 815c1f5eeb [CI Skip] release/beta 8.3.4-1
skip-checks: true
2022-01-26 05:44:45 +00:00
Jaco e7d454787d Swap to @scure/base (micro-base rename) (#1392) 2022-01-26 07:40:28 +02:00
github-actions[bot] d5c541db67 [CI Skip] release/beta 8.3.4-0
skip-checks: true
2022-01-24 11:34:02 +00:00
Jaco 2cf12616ed Use upstream @substrate/ss58-registry (#1391)
* Use upstream @substrate/ss58-registry

* Fix expectation

* Adjust
2022-01-24 13:29:05 +02:00
github-actions[bot] 2dee1c86e6 [CI Skip] release/stable 8.3.3
skip-checks: true
2022-01-23 06:34:58 +00:00
Jaco 023b1e8610 8.3.3 (#1390) 2022-01-23 08:30:08 +02:00
github-actions[bot] e9f3efa0ec [CI Skip] release/beta 8.3.3-3
skip-checks: true
2022-01-22 12:01:57 +00:00
Jaco 529119d9c3 Bump deps (#1389) 2022-01-22 13:56:45 +02:00
github-actions[bot] 3748d578e0 [CI Skip] release/beta 8.3.3-2
skip-checks: true
2022-01-21 14:05:47 +00:00
Jaco 6af09d344d Rococo genesisHash update (another day, another reset) (#1388) 2022-01-21 16:01:38 +02:00
github-actions[bot] 951ee2be17 [CI Skip] release/beta 8.3.3-1
skip-checks: true
2022-01-20 12:39:32 +00:00
Jaco 7d902d1b6e Sync ss58 registry (#1387) 2022-01-20 14:34:40 +02:00
github-actions[bot] cba373ab8a [CI Skip] release/beta 8.3.3-0
skip-checks: true
2022-01-17 06:31:11 +00:00
Jaco ab1c1bf311 Bump deps (incl. node-fetch security fix) (#1383) 2022-01-17 08:27:01 +02:00
250 changed files with 7200 additions and 4730 deletions
+1
View File
@@ -0,0 +1 @@
9.7.1
+3 -1
View File
@@ -26,4 +26,6 @@
8.0.5
8.1.2
8.2.2
8.3.2
8.3.2
8.3.3
9.6.2
+50
View File
@@ -0,0 +1,50 @@
<!--
For general support, howto, coding and bundling questions, please use the Substrate & Polkadot StackExchange at https://substrate.stackexchange.com/ and get other ecosystem developers involved. This issues in this repository are meant for the tracking of feature requests and bug reports.
While all issues are looked at non-bug and non-features would take quite a bit longer to get to and may yield less than satisfactory responses in this format.
Additionally, please ensure you have done a search on the existing and closed issues before logging a new request. This saves time on all sides.
-->
* **I'm submitting a ...**
<!--- Try and classify your actual report -->
- [ ] Bug report
- [ ] Feature request
- [ ] Support request (please bear the comments above in mind)
- [ ] Other
* **What is the current behavior and expected behavior?**
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->
* **What is the motivation for changing the behavior?**
<!--- Not obligatory, but suggest a motivation for the request -->
<!--- or ideas how to implement the addition or change -->
* **Please tell us about your environment:**
<!--- Include as many relevant details about the environment you experienced the issue in -->
<!--- Also snsure that you have tested against the latest stable releases if a bug -->
- Version:
- Environment:
- [ ] Node.js
- [ ] Browser
- [ ] Other (limited support for other environments available)
- Language:
- [ ] JavaScript
- [ ] TypeScript
- [ ] Other
-10
View File
@@ -1,10 +0,0 @@
---
title: SS58 registry is outdated
labels: ['ci', '@networks']
---
cc @polkadot-js/notifications
Discrepancies detected between https://github.com/paritytech/substrate/blob/master/ss58-registry.json and https://github.com/polkadot-js/common/blob/master/packages/networks/src/substrate.ts
Check the nightly cron output (or via `yarn networks:crosscheck` locally) and run `yarn networks:sync` to update. The output as found from the test includes:
+16
View File
@@ -0,0 +1,16 @@
name: bot
on:
pull_request:
types: [labeled]
jobs:
approve:
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && (!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository)"
runs-on: ubuntu-latest
steps:
- uses: jacogr/action-approve@master
with:
authors: jacogr
labels: -auto
token: ${{ secrets.GH_PAT_BOT }}
+16
View File
@@ -0,0 +1,16 @@
name: bot
on:
pull_request:
types: [labeled]
jobs:
merge:
runs-on: ubuntu-latest
steps:
- uses: jacogr/action-merge@master
with:
checks: build,lint,test
labels: -auto
strategy: squash
token: ${{ secrets.GH_PAT_BOT }}
+2
View File
@@ -7,6 +7,8 @@ on:
jobs:
lock:
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
steps:
- uses: dessant/lock-threads@v2
with:
+3 -2
View File
@@ -8,11 +8,12 @@ jobs:
step: ['lint', 'test', 'build']
name: ${{ matrix.step }}
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
steps:
- uses: actions/checkout@v2
- name: ${{ matrix.step }}
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
yarn install --immutable | grep -v 'YN0013'
yarn ${{ matrix.step }}
+6 -5
View File
@@ -12,17 +12,18 @@ jobs:
step: ['build:release']
name: ${{ matrix.step }}
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
GH_PAT: ${{ secrets.GH_PAT }}
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
- name: ${{ matrix.step }}
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
GH_PAT: ${{ secrets.GH_PAT }}
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
yarn install --immutable | grep -v 'YN0013'
yarn ${{ matrix.step }}
+2
View File
@@ -9,6 +9,8 @@ jobs:
check:
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && (!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository)"
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
steps:
- uses: actions/checkout@v2
- uses: returntocorp/semgrep-action@v1
-26
View File
@@ -1,26 +0,0 @@
name: SS58
on:
schedule:
- cron: '15 4/6 * * *'
jobs:
ss58:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: check
env:
CI_LOG: 123
run: |
yarn install --immutable | grep -v 'YN0013'
yarn build
yarn networks:crosscheck
- name: issue
if: ${{ failure() }}
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_BOT }}
with:
filename: .github/ss58-check.md
update_existing: true
+2
View File
@@ -6,6 +6,8 @@ on:
jobs:
stale:
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
steps:
- uses: actions/stale@v3
with:
+3
View File
@@ -1,6 +1,9 @@
--test-*
_book/
build/
build-cjs/
build-esm/
build-deno/
build-docs/
coverage/
docs/.vuepress/dist/
-768
View File
File diff suppressed because one or more lines are too long
+785
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -10,4 +10,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
yarnPath: .yarn/releases/yarn-3.1.1.cjs
yarnPath: .yarn/releases/yarn-3.2.0.cjs
+166
View File
@@ -1,5 +1,171 @@
# CHANGELOG
## 9.7.1 Jul 1, 2022
Changes:
- Update signatures where `readonly` arrays are used
- Upgrade dependencies to latest stable versions
- Upgrade to `@polkadot/wasm-crypto` 6.2.1
## 9.6.2 Jun 25, 2022
Changes:
- Fix `hexToU8a` where `0x` is not correctly converted
## 9.6.1 Jun 23, 2022
Changes:
- Add `floatToU8a` and `u8aToFloat` (both 32 & 64-bit, le & be)
- Adjust `isUndefined` check (local variable available)
- Adjust use of `assert`, `isUndefined` & `isNull`
## 9.5.1 Jun 18, 2022
Contributed:
- Update Bifrost genesisHash (Thanks to https://github.com/awesomepan)
- Add Ledger support for Composable (Thanks to https://github.com/carlosala)
Changes:
- Add `u8aToNumber` (limited, <= 48 bits) function
- Use `~~` as bitwise/faster `Math.floor` replacement
- Remove unneeded `objectSpread` option expansions
- Optimize `hexToU8a` operations
- Optimize `stringCamelCase` operations
- Optimize `u8aToBn` operations
- Additional internal/external comments (as missing)
- Upgrade dependencies to latest stable versions
## 9.4.1 Jun 4, 2022
Changes:
- Add `nextTick` to `@polkadot/util` to defer execution to the queue
- Upgrade dependencies to latest stable versions
## 9.3.1 May 29, 2022
Contributed:
- Add Ledger support for Parallel (Thanks to https://github.com/carlosala)
- Add Ledger support for Astar & Polkadex (Thanks to https://github.com/carlosala)
Changes:
- Adjust `u8aToU8a` checks with better `isU8a` shortcut
- Adjust compact conversion with unrolled loops
- Adjust `string{Camel, Pascal}Case` with loop (no map)
- Add `compactFromU8aLim` variant with Uint8Array-only inputs
- Add `u8aConcatStrict` variant with Uint8Array-only inputs
- Internal code maintainability enhancements
- Upgrade dependencies to latest stable versions
## 9.2.1 May 13, 2022
Contributed:
- Add Ledger support for Acala (Thanks to https://github.com/ntduan)
Changes:
- Optimize `u8aToHex` with direct (non-hex) conversion
- Change all occurences of `.substr(...)` to `.substring(...)`
- Sync with upstream Substrate ss58 registry
- Mark deprecated function signatures (no removals)
- Re-enable auto init of `cryptoWaitReady()`
- Upgrade to `@polkadot/wasm-crypto` 6.1.1
## 9.1.1 Apr 30, 2022
Contributed:
- Add Ledger support for Statemint (Thanks to https://github.com/carlosala)
- Add Ledger support for xxnetwork (Thanks to https://github.com/xx-labs)
Changes:
- Adjust/dedupe output from `detectPackage`
- Adjust `isHex` performance test
- Add field-level comments to some `*Options` structures
- Add new Rococo genesisHash (reset)
## 9.0.1 Apr 9, 2022
- **Breaking change** In this major version the commonjs outputs are moved to a sub-folder. Since the export map and main field in package.json does reflect this change, there should be no usage changes. However the packages here will all need to be on the same version for internal linkage.
Changes:
- Be explicit in `@polkadot/util-crypto` re-exports from `@polkadot/networks`
- Output commonjs files under the `cjs/**` root
- Upgrade to `@polkadot/wasm-crypto` 6.0.1
## 8.7.1 Mar 27, 2022
Changes:
- Fix race-condition with wasm overrides, make `cryptoWaitReady` lazy
- Additional tests for `BN` & `BigInt` negative conversions
- Upgrade to `@polkadot/wasm-crypto` 5.1.1
## 8.6.1 Mar 19, 2022
**Important** This contains an upgraded version of `@polkadot/wasm-crypto`. For users of asm.js, e.g. React Native, there are some additional upgrade instructions in the release notes for this version https://github.com/polkadot-js/wasm/releases/tag/v5.0.1
Contributed:
- Add aditional Dock mainnet genesis (Thanks to https://github.com/lovesh)
- Add Westend genesis (Thanks to https://github.com/Nick-1979)
- Update README with ss58 links (Thanks to https://github.com/Nick-197)
Changes:
- Ensure invalid secp256k1 publicKeys are not returned
- Cater for Expo v41+ in RN random value generation
- Fixed for RN environment imports
- Internal split of details in `@polkadot/networks`
- Additional workaround for Vite bundling
- Upgrade to `@polkadot/wasm-crypto` 5.0.1
## 8.5.1 Mar 12, 2022
Changes:
- Adjust for bundlers where `import.meta.url` is undefined
- Upgrade dependencies to latest stable versions
## 8.4.1 Feb 14, 2022
Changes:
- Use upstream `@substrate/ss58-registry` (instead of duplicating here)
- Swap `micro-base` to `@scure/base` (same package, audited)
- Bump `bn.js` library to latest 5.2.0 (has impact on e.g. API)
- Upgrade dependencies to latest stable versions
## 8.3.3 Jan 23, 2022
Changes:
- Sync with upstream Substrate ss58 registry
## 8.3.2 Jan 15, 2022
Changes:
+9 -4
View File
@@ -1,16 +1,19 @@
1241 Jaco 8.3.2 (#1382)
1391 Jaco 9.7.1 (#1572)
9 Antoine Estienne Add eth uri keyring test (#1291)
6 Amaury Martiny Add tests from Rust (#283)
5 kwingram25 Add BN consts and timeToString (#610)
4 Adam Dossa Update Polymesh Genesis Hash (#1193)
3 Jakub Pánik HydraDX Snakenet Gen3-1 (#977)
4 Carlo Sala add Composable support for ledger (#1515)
4 Jakub Pánik Add basilisk 🐍 (#1396)
3 Luke Schoen docs: Fix example in readme since we use default imports (#243)
3 pan update bifrost genesis hash (#1521)
2 AndreasGassmann feat(dependencies): remove moment.js (#530)
2 Gav Wood Fix stake:unstake (#182)
2 Hyungsuk Kang Add cross client Encryption/Decryption (#496)
2 Jared Norris Add Sora network (#1306)
2 Kami Adding Westend genesis. (#1429)
2 Lovesh Harchandani Update genesis hash of Dock mainnet (#1436)
2 Nantian fix bigint type (#1079)
2 pan add bifrost (#1296)
2 Stefanie Doll Add missing dependencies to util-crypto (#424)
1 Agustinus Theodorus docs: fix typo in naclSeal docs. (#1005)
1 Alexander Krupenkin Added ECDSA keypair support (#589)
@@ -21,16 +24,17 @@
1 Eliott Teissonniere add nodle ledger specs (#1089)
1 h4x3rotab Throws an error when signing with a locked keypair (#578)
1 Harry Liu Update README.md (#446)
1 Hoon Kim replace plasm genesis with astar (#1397)
1 Hussein Ait-Lahcen Add Picasso Genesis Hash (#1261)
1 Igor Support genshiro network (#1148)
1 Jake Naviasky Add evmToAddress and addressToEvm crypto utils. (#705)
1 JesseAbram added check if valid address to docs (#440)
1 joe petrowski Add example for multisig address creation (#590)
1 Lezek123 logger - wildcard include/exclude with DEBUG env (#932)
1 Lovesh Harchandani Add Dock network id for address generation (#640)
1 Mario Neises remove redudant export (#257)
1 Miguel Hervas Add CFG Ledger Support (#1057)
1 nahuseyoum Reserving 65 for Aventus based on the new extended range (#871)
1 Nantian add acala ledger config (#1485)
1 qwer951123 Add acala genesis (#1161)
1 Raoul Millais Fix yarn add instructions in x-global README (#873)
1 Raymond Zhong Add Edgeware ledger app (#1006)
@@ -42,4 +46,5 @@
1 Tore19 Add stafi genesis hash (#1096)
1 Wei Tang ss58: add Kulupu prefix to the list (#595)
1 WoeOm Handing high precision scenes (#450)
1 xx network Add xxnetwork genesis hash and ledger app (#1463)
1 Yuri Extra check for process for browser bundles (#923)
+7 -8
View File
@@ -2,15 +2,15 @@
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/common/issues",
"homepage": "https://github.com/polkadot-js/common#readme",
"license": "Apache-2",
"packageManager": "yarn@3.0.1",
"license": "Apache-2.0",
"packageManager": "yarn@3.2.0",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/polkadot-js/common.git"
},
"sideEffects": false,
"version": "8.3.2",
"version": "9.7.1",
"workspaces": [
"packages/*"
],
@@ -21,18 +21,17 @@
"clean": "polkadot-dev-clean-build",
"lint": "polkadot-dev-run-lint",
"networks:crosscheck": "polkadot-dev-run-test packages/networks/src/crosscheck",
"networks:sync": "yarn build && node packages/networks/scripts/fromSubstrate.mjs",
"postinstall": "polkadot-dev-yarn-only",
"test": "polkadot-dev-run-test --coverage --runInBand --testPathIgnorePatterns crosscheck --testPathIgnorePatterns toMiniSecretCmp",
"test:mnemonicCmp": "polkadot-dev-run-test packages/util-crypto/src/mnemonic/toMiniSecretCmp.spec.ts",
"test:one": "polkadot-dev-run-test --runInBand"
},
"devDependencies": {
"@babel/core": "^7.16.7",
"@polkadot/dev": "^0.65.37",
"@types/jest": "^27.4.0"
"@babel/core": "^7.18.6",
"@polkadot/dev": "^0.67.46",
"@types/jest": "^28.1.4"
},
"resolutions": {
"typescript": "^4.5.3"
"typescript": "^4.7.4"
}
}
+7 -7
View File
@@ -16,18 +16,18 @@
},
"sideEffects": false,
"type": "module",
"version": "8.3.2",
"version": "9.7.1",
"browser": "browser.js",
"main": "node.js",
"react-native": "react-native.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@ledgerhq/hw-transport": "^6.20.0",
"@ledgerhq/hw-transport-webhid": "^6.20.0",
"@ledgerhq/hw-transport-webusb": "^6.20.0",
"@polkadot/util": "8.3.2"
"@babel/runtime": "^7.18.6",
"@ledgerhq/hw-transport": "^6.27.1",
"@ledgerhq/hw-transport-webhid": "^6.27.1",
"@ledgerhq/hw-transport-webusb": "^6.27.1",
"@polkadot/util": "9.7.1"
},
"optionalDependencies": {
"@ledgerhq/hw-transport-node-hid-singleton": "^6.23.0"
"@ledgerhq/hw-transport-node-hid-singleton": "^6.27.1"
}
}
@@ -0,0 +1,8 @@
// Copyright 2017-2022 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { TransportDef } from './types';
export { packageInfo } from './packageInfo';
export const transports: TransportDef[] = [];
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './empty';
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/hw-ledger-transports', path: 'auto', type: 'auto', version: '8.3.2' };
export const packageInfo = { name: '@polkadot/hw-ledger-transports', path: 'auto', type: 'auto', version: '9.7.1' };
@@ -1,8 +1,4 @@
// Copyright 2017-2022 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { TransportDef } from './types';
export { packageInfo } from './packageInfo';
export const transports: TransportDef[] = [];
export * from './empty';
+6 -6
View File
@@ -19,13 +19,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.3.2",
"version": "9.7.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@ledgerhq/hw-transport": "^6.20.0",
"@polkadot/hw-ledger-transports": "8.3.2",
"@polkadot/util": "8.3.2",
"@zondax/ledger-substrate": "^0.24.0"
"@babel/runtime": "^7.18.6",
"@ledgerhq/hw-transport": "^6.27.1",
"@polkadot/hw-ledger-transports": "9.7.1",
"@polkadot/util": "9.7.1",
"@zondax/ledger-substrate": "^0.31.0"
}
}
+12 -5
View File
@@ -5,7 +5,7 @@ import type { ResponseBase, SubstrateApp } from '@zondax/ledger-substrate';
import type { AccountOptions, LedgerAddress, LedgerSignature, LedgerTypes, LedgerVersion } from './types';
import { transports } from '@polkadot/hw-ledger-transports';
import { assert, u8aToBuffer } from '@polkadot/util';
import { u8aToBuffer } from '@polkadot/util';
import { LEDGER_DEFAULT_ACCOUNT, LEDGER_DEFAULT_CHANGE, LEDGER_DEFAULT_INDEX, LEDGER_SUCCESS_CODE } from './constants';
import { ledgerApps } from './defaults';
@@ -26,8 +26,11 @@ export class Ledger {
constructor (transport: LedgerTypes, chain: Chain) {
// u2f is deprecated
assert(['hid', 'webusb'].includes(transport), () => `Unsupported transport ${transport}`);
assert(Object.keys(ledgerApps).includes(chain), () => `Unsupported chain ${chain}`);
if (!['hid', 'webusb'].includes(transport)) {
throw new Error(`Unsupported transport ${transport}`);
} else if (!Object.keys(ledgerApps).includes(chain)) {
throw new Error(`Unsupported chain ${chain}`);
}
this.#chain = chain;
this.#transport = transport;
@@ -71,7 +74,9 @@ export class Ledger {
if (!this.#app) {
const def = transports.find(({ type }) => type === this.#transport);
assert(def, () => `Unable to find a transport for ${this.#transport}`);
if (!def) {
throw new Error(`Unable to find a transport for ${this.#transport}`);
}
const transport = await def.create();
@@ -96,7 +101,9 @@ export class Ledger {
#wrapError = async <T extends ResponseBase> (promise: Promise<T>): Promise<T> => {
const result = await promise;
assert(result.return_code === LEDGER_SUCCESS_CODE, () => result.error_message);
if (result.return_code !== LEDGER_SUCCESS_CODE) {
throw new Error(result.error_message);
}
return result;
};
+12 -4
View File
@@ -4,20 +4,28 @@
import type Transport from '@ledgerhq/hw-transport';
import type { SubstrateApp } from '@zondax/ledger-substrate';
import { newBifrostApp, newCentrifugeApp, newDockApp, newEdgewareApp, newEquilibriumApp, newGenshiroApp, newKusamaApp, newNodleApp, newPolkadotApp, newPolymeshApp, newSoraApp, newStatemineApp } from '@zondax/ledger-substrate';
import { newAcalaApp, newAstarApp, newBifrostApp, newCentrifugeApp, newComposableApp, newDockApp, newEdgewareApp, newEquilibriumApp, newGenshiroApp, newKaruraApp, newKusamaApp, newNodleApp, newParallelApp, newPolkadexApp, newPolkadotApp, newPolymeshApp, newSoraApp, newStatemineApp, newStatemintApp, newXXNetworkApp } from '@zondax/ledger-substrate';
// These match up with the keys of the knownLedger object in the @polkadot/networks/defaults.ts
// These match up with the keys of the knownLedger object in the @polkadot/networks/defaults/ledger.ts
export const ledgerApps: Record<string, (transport: Transport) => SubstrateApp> = {
acala: newAcalaApp,
astar: newAstarApp,
bifrost: newBifrostApp,
centrifuge: newCentrifugeApp,
composable: newComposableApp,
'dock-mainnet': newDockApp,
edgeware: newEdgewareApp,
equilibrium: newEquilibriumApp,
genshiro: newGenshiroApp,
karura: newKaruraApp,
kusama: newKusamaApp,
'nodle-chain': newNodleApp,
'nodle-para': newNodleApp,
parallel: newParallelApp,
polkadex: newPolkadexApp,
polkadot: newPolkadotApp,
polymesh: newPolymeshApp,
sora: newSoraApp,
statemine: newStatemineApp
statemine: newStatemineApp,
statemint: newStatemintApp,
xxnetwork: newXXNetworkApp
};
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/hw-ledger', path: 'auto', type: 'auto', version: '8.3.2' };
export const packageInfo = { name: '@polkadot/hw-ledger', path: 'auto', type: 'auto', version: '9.7.1' };
+4 -1
View File
@@ -13,7 +13,7 @@ export interface AccountOptions {
export interface LedgerAddress {
address: string;
publicKey: string;
publicKey: HexString;
}
export interface LedgerSignature {
@@ -23,5 +23,8 @@ export interface LedgerSignature {
export interface LedgerVersion {
isLocked: boolean;
isTestMode: boolean;
/**
* @description Tuple with major, minor, patch
*/
version: [number, number, number];
}
+6 -6
View File
@@ -20,15 +20,15 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.3.2",
"version": "9.7.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/util": "8.3.2",
"@polkadot/util-crypto": "8.3.2"
"@babel/runtime": "^7.18.6",
"@polkadot/util": "9.7.1",
"@polkadot/util-crypto": "9.7.1"
},
"peerDependencies": {
"@polkadot/util": "8.3.2",
"@polkadot/util-crypto": "8.3.2"
"@polkadot/util": "9.7.1",
"@polkadot/util-crypto": "9.7.1"
}
}
+14 -6
View File
@@ -4,7 +4,7 @@
import type { EncryptedJsonEncoding, Keypair, KeypairType } from '@polkadot/util-crypto/types';
import type { KeyringInstance, KeyringOptions, KeyringPair, KeyringPair$Json, KeyringPair$Meta } from './types';
import { assert, hexToU8a, isHex, isUndefined, stringToU8a } from '@polkadot/util';
import { hexToU8a, isHex, stringToU8a } from '@polkadot/util';
import { base64Decode, decodeAddress, ed25519PairFromSeed as ed25519FromSeed, encodeAddress, ethereumEncode, hdEthereum, keyExtractSuri, keyFromPath, mnemonicToLegacySeed, mnemonicToMiniSecret, secp256k1PairFromSeed as secp256k1FromSeed, sr25519PairFromSeed as sr25519FromSeed } from '@polkadot/util-crypto';
import { DEV_PHRASE } from './defaults';
@@ -50,7 +50,9 @@ export class Keyring implements KeyringInstance {
constructor (options: KeyringOptions = {}) {
options.type = options.type || 'ed25519';
assert(['ecdsa', 'ethereum', 'ed25519', 'sr25519'].includes(options.type || 'undefined'), () => `Expected a keyring type of either 'ed25519', 'sr25519', 'ethereum' or 'ecdsa', found '${options.type || 'unknown'}`);
if (!['ecdsa', 'ethereum', 'ed25519', 'sr25519'].includes(options.type || 'undefined')) {
throw new Error(`Expected a keyring type of either 'ed25519', 'sr25519', 'ethereum' or 'ecdsa', found '${options.type || 'unknown'}`);
}
this.#pairs = new Pairs();
this.#ss58 = options.ss58Format;
@@ -162,7 +164,9 @@ export class Keyring implements KeyringInstance {
* @description Creates a pair from a JSON keyfile
*/
public createFromJson ({ address, encoded, encoding: { content, type, version }, meta }: KeyringPair$Json, ignoreChecksum?: boolean): KeyringPair {
assert(version !== '3' || content[0] === 'pkcs8', () => `Unable to decode non-pkcs8 type, [${content.join(',')}] found}`);
if (version === '3' && content[0] !== 'pkcs8') {
throw new Error(`Unable to decode non-pkcs8 type, [${content.join(',')}] found}`);
}
const cryptoType = version === '0' || !Array.isArray(content)
? this.type
@@ -171,7 +175,9 @@ export class Keyring implements KeyringInstance {
? [type]
: type;
assert(['ed25519', 'sr25519', 'ecdsa', 'ethereum'].includes(cryptoType), () => `Unknown crypto type ${cryptoType}`);
if (!['ed25519', 'sr25519', 'ecdsa', 'ethereum'].includes(cryptoType)) {
throw new Error(`Unknown crypto type ${cryptoType}`);
}
// Here the address and publicKey are 32 bytes and isomorphic. This is why the address field needs to be the public key for ethereum type pairs
const publicKey = isHex(address)
@@ -216,7 +222,9 @@ export class Keyring implements KeyringInstance {
? mnemonicToLegacySeed(phrase, '', false, 64)
: mnemonicToMiniSecret(phrase, password);
} else {
assert(phrase.length <= 32, 'specified phrase is not a valid mnemonic and is invalid as a raw seed at > 32 bytes');
if (phrase.length > 32) {
throw new Error('specified phrase is not a valid mnemonic and is invalid as a raw seed at > 32 bytes');
}
seed = stringToU8a(phrase.padEnd(32));
}
@@ -238,7 +246,7 @@ export class Keyring implements KeyringInstance {
public encodeAddress = (address: Uint8Array | string, ss58Format?: number): string => {
return this.type === 'ethereum'
? ethereumEncode(address)
: encodeAddress(address, isUndefined(ss58Format) ? this.#ss58 : ss58Format);
: encodeAddress(address, ss58Format === undefined ? this.#ss58 : ss58Format);
};
/**
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/keyring', path: 'auto', type: 'auto', version: '8.3.2' };
export const packageInfo = { name: '@polkadot/keyring', path: 'auto', type: 'auto', version: '9.7.1' };
+2 -2
View File
@@ -4,7 +4,7 @@
import type { EncryptedJsonEncoding } from '@polkadot/util-crypto/types';
import type { PairInfo } from './types';
import { assert, isUndefined, u8aEq } from '@polkadot/util';
import { assert, u8aEq } from '@polkadot/util';
import { jsonDecryptData } from '@polkadot/util-crypto';
import { PKCS8_DIVIDER, PKCS8_HEADER, PUB_LENGTH, SEC_LENGTH, SEED_LENGTH } from './defaults';
@@ -16,7 +16,7 @@ type DecodeResult = PairInfo & {
};
export function decodePair (passphrase?: string, encrypted?: Uint8Array | null, _encType?: EncryptedJsonEncoding | EncryptedJsonEncoding[]): DecodeResult {
const encType = Array.isArray(_encType) || isUndefined(_encType)
const encType = Array.isArray(_encType) || _encType === undefined
? _encType
: [_encType];
const decrypted = jsonDecryptData(encrypted, passphrase, encType);
+8 -6
View File
@@ -4,7 +4,7 @@
import type { HexString } from '@polkadot/util/types';
import type { KeyringPair, KeyringPairs } from './types';
import { assert, isHex, isU8a, u8aToHex, u8aToU8a } from '@polkadot/util';
import { isHex, isU8a, u8aToHex, u8aToU8a } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
type KeyringPairMap = Record<string, KeyringPair>;
@@ -25,11 +25,13 @@ export class Pairs implements KeyringPairs {
public get (address: HexString | string | Uint8Array): KeyringPair {
const pair = this.#map[decodeAddress(address).toString()];
assert(pair, () => `Unable to retrieve keypair '${
isU8a(address) || isHex(address)
? u8aToHex(u8aToU8a(address))
: address
}'`);
if (!pair) {
throw new Error(`Unable to retrieve keypair '${
isU8a(address) || isHex(address)
? u8aToHex(u8aToU8a(address))
: address
}'`);
}
return pair;
}
+4 -2
View File
@@ -3,7 +3,7 @@
import type { KeyringInstance, KeyringOptions } from './types';
import { assert, hexToU8a } from '@polkadot/util';
import { hexToU8a } from '@polkadot/util';
import { KeypairType } from '@polkadot/util-crypto/types';
import { Keyring } from './keyring';
@@ -112,7 +112,9 @@ export const PAIRSETHEREUM: PairDef[] = [
];
function createMeta (name?: string, seed?: string) {
assert(name || seed, 'Testing pair should have either a name or a seed');
if (!name && !seed) {
throw new Error('Testing pair should have either a name or a seed');
}
return {
isTesting: true,
+3 -1
View File
@@ -65,7 +65,9 @@ describe('testingPairs', (): void => {
delete ring.nobody;
Object.keys(ring).forEach((testKeyring, i) => {
if (i < 6) { expect(u8aToHex(ring[testKeyring].publicKey)).toEqual(u8aToHex(keyring.createFromUri(privKeys[i]).publicKey)); }
if (i < 6) {
expect(u8aToHex(ring[testKeyring].publicKey)).toEqual(u8aToHex(keyring.createFromUri(privKeys[i]).publicKey));
}
});
});
});
+9
View File
@@ -5,7 +5,13 @@ import type { HexString } from '@polkadot/util/types';
import type { EncryptedJson, Keypair, KeypairType, Prefix } from '@polkadot/util-crypto/types';
export interface KeyringOptions {
/**
* @description The ss58Format to use for address encoding (defaults to 42)
*/
ss58Format?: Prefix;
/**
* @description The type of keyring to create (defaults to ed25519)
*/
type?: KeypairType;
}
@@ -17,6 +23,9 @@ export interface KeyringPair$Json extends EncryptedJson {
}
export interface SignOptions {
/**
* @description Create a MultiSignature-compatible output with an indicator type
**/
withType?: boolean;
}
+1 -1
View File
@@ -2,4 +2,4 @@
A list of all available Substrate networks and their applicable prefixes.
This list is periodically checked against the master list available at https://github.com/paritytech/substrate/blob/master/ss58-registry.json
This list is periodically checked against the master list available at https://github.com/paritytech/ss58-registry/blob/main/ss58-registry.json
+6 -5
View File
@@ -17,14 +17,15 @@
},
"sideEffects": false,
"type": "module",
"version": "8.3.2",
"version": "9.7.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@polkadot/util": "8.3.2"
"@babel/runtime": "^7.18.6",
"@polkadot/util": "9.7.1",
"@substrate/ss58-registry": "^1.23.0"
},
"devDependencies": {
"@polkadot/hw-ledger": "8.3.2",
"@polkadot/x-fetch": "8.3.2"
"@polkadot/hw-ledger": "9.7.1",
"@polkadot/x-fetch": "9.7.1"
}
}
@@ -1,72 +0,0 @@
// Copyright 2017-2022 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import fs from 'fs';
import fetch from 'node-fetch';
import { substrateRegistry } from '../build/defaults.js';
const substrateRegistryRepo = substrateRegistry
.replace('raw.githubusercontent.com', 'github.com')
.split('main')[0];
function outputField (k, v) {
if (typeof v === 'string') {
return `'${v}'`;
} else if (Array.isArray(v)) {
// new format is [] to indicate optionality
return (['decimals', 'symbols'].includes(k) && !v.length)
? null
: `[${v.map((v) => outputField(k, v)).join(', ')}]`;
}
return v;
}
async function getSubstrateRegistry () {
const original = await fetch(substrateRegistry);
const json = await original.json();
return json.registry
.map((e) =>
` {\n${Object
.entries(e)
.sort(([a], [b]) => a.localeCompare(b))
.map(([k, v]) => ` ${k}: ${outputField(k, v)}`)
.join(',\n')}\n }`
)
.join(',\n');
}
getSubstrateRegistry()
.then((entries) => {
fs.writeFileSync('packages/networks/src/substrate.ts', `// Copyright 2017-2022 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
//
// Auto-generated by yarn networks:sync (via scripts/fromSubstrate.mjs)
//
// This file should never be edited manually. Rather the process is as follow -
//
// - make a PR to the upstream registry found at ${substrateRegistryRepo}
// - ensure the PR gets merged
// - yarn networks:sync in this repo to sync
//
// Any manual changes to this file will make CI cron checks fail and will be
// lost when the registry is updated alongside the above sync.
//
import type { KnownSubstrate } from './types';
export const knownSubstrate: KnownSubstrate[] = [\n${entries}\n];
`);
console.log('Completed.');
process.exit(0);
})
.catch((error) => {
console.error('Error:', error.message);
process.exit(-1);
});
+2 -2
View File
@@ -8,9 +8,9 @@ import fs from 'fs';
import { objectKeys, stringify } from '@polkadot/util';
import { fetch } from '@polkadot/x-fetch';
import { substrateRegistry } from './defaults';
import { allNetworks } from './';
const REGISTRY = 'https://raw.githubusercontent.com/paritytech/ss58-registry/main/ss58-registry.json';
const OUTPUT = './.github/ss58-check.md';
function assertAndLog (check: boolean, error: string): void {
@@ -28,7 +28,7 @@ describe('check latest Substrate ss58 registry', (): void => {
let original: Ss58Registry;
beforeAll(async (): Promise<void> => {
original = (await (await fetch(substrateRegistry)).json()) as Ss58Registry;
original = (await (await fetch(REGISTRY)).json()) as Ss58Registry;
});
it('has the same number as the original', (): void => {
-48
View File
@@ -1,48 +0,0 @@
// Copyright 2017-2022 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KnownIcon, KnownLedger, KnownTestnet } from './types';
export { knownGenesis } from './genesis';
export const substrateRegistry = 'https://raw.githubusercontent.com/paritytech/ss58-registry/main/ss58-registry.json';
// these are icon overrides
export const knownIcon: KnownIcon = {
centrifuge: 'polkadot',
kusama: 'polkadot',
polkadot: 'polkadot',
sora: 'polkadot',
statemine: 'polkadot',
statemint: 'polkadot',
westmint: 'polkadot'
};
// These match up with the keys of the ledgerApps object in the @polkadot/hw-ledger/defaults.ts
// and maps to the known slip44 (minus the `0x8` hard derivation flag)
// NOTE: Any network here needs to have a genesisHash attached in the config above
export const knownLedger: KnownLedger = {
bifrost: 0x00000314,
centrifuge: 0x000002eb,
'dock-mainnet': 0x00000252,
edgeware: 0x0000020b,
equilibrium: 0x05f5e0fd,
genshiro: 0x05f5e0fc,
kusama: 0x000001b2,
'nodle-chain': 0x000003eb,
polkadot: 0x00000162,
polymesh: 0x00000253,
sora: 0x00000269,
statemine: 0x000001b2 // common-good on Kusama, shares derivation
};
// testnets should not allow selection
export const knownTestnet: KnownTestnet = {
'': true, // this is the default non-network entry
'cess-testnet': true,
'dock-testnet': true,
jupiter: true,
'mathchain-testnet': true,
subspace_testnet: true,
'zero-alphaville': true
};
@@ -1,7 +1,7 @@
// Copyright 2017-2022 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KnownGenesis } from './types';
import type { KnownGenesis } from '../types';
// NOTE: In the case where the network was hard-spooned and multiple genesisHashes
// are provided, it needs to be in reverse order, i.e. most-recent first, oldest
@@ -11,13 +11,24 @@ export const knownGenesis: KnownGenesis = {
acala: [
'0xfc41b9bd8ef8fe53d58c7ea67c794c7ec9a73daf05e6d54b14ff6342c99ba64c'
],
astar: [
'0x9eb76c5184c4ab8679d2d5d819fdf90b9c001403e9e17da2e14b6d8aec4029c6'
],
basilisk: [
'0xa85cfb9b9fd4d622a5b28289a02347af987d8f73fa3108450e2b4a11c1ce5755'
],
bifrost: [
'0x9f28c6a68e0fc9646eff64935684f6eeeece527e37bbe1f213d22caa1d9d6bed'
'0x262e1b2ad728475fd6fe88e62d34c200abe6fd693931ddad144059b1eb884e5b'
],
centrifuge: [
'0xb3db41421702df9a7fcac62b53ffeac85f7853cc4e689e0b93aeb3db18c09d82',
'0x67dddf2673b69e5f875f6f25277495834398eafd67f492e09f3f3345e003d1b5'
],
composable: [
'0xdaab8df776eb52ec604a5df5d388bb62a050a0aaec4556a64265b9d42755552d'
],
'dock-mainnet': [
'0x6bfe24dca2a3be10f22212678ac13a6446ec764103c0f3471c71609eac384aae',
'0xf73467c6544aa68df2ee546b135f955c46b90fa627e9b5d7935f41061bb8a5a9'
],
edgeware: [
@@ -46,14 +57,17 @@ export const knownGenesis: KnownGenesis = {
'0xe3777fa922cafbff200cadeaea1a76bd7898ad5b89f7848999058b50e715f636', // Kusama CC2
'0x3fd7b9eb6a00376e5be61f01abb429ffb0b104be05eaff4d458da48fcd425baf' // Kusama CC1
],
'nodle-chain': [
'0xa3d114c2b8d0627c1aa9b134eafcf7d05ca561fdc19fb388bb9457f81809fb23'
'nodle-para': [
'0x97da7ede98d7bad4e36b4d734b6055425a3be036da2a332ea5a7037656427a21'
],
parallel: [
'0xe61a41c53f5dcd0beb09df93b34402aada44cb05117b71059cce40a2723a4e97'
],
picasso: [
'0xe8e7f0f4c4f5a00720b4821dbfddefea7490bcf0b19009961cc46957984e2c1c'
],
plasm: [
'0x3e86364d4b4894021cb2a0390bcf2feb5517d5292f2de2bb9404227e908b0b8b'
polkadex: [
'0x3920bcb4960a1eef5580cd5367ff3f430eef052774f78468852f7b9cb39f8a3c'
],
polkadot: [
'0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3'
@@ -62,6 +76,8 @@ export const knownGenesis: KnownGenesis = {
'0x6fbd74e5e1d0a61d52ccfe9d4adaed16dd3a7caa37c6bc4d0c2fa12e8b2f4063'
],
rococo: [
'0x6408de7737c59c238890533af25896a2c20608d8b380bb01029acb392781063e',
'0xaaf2cd1b74b5f726895921259421b534124726263982522174147046b8827897',
'0x037f5f3c8e67b314062025fc886fcd6238ea25a4a9b45dce8d246815c9ebe770',
'0xc196f81260cf1686172b47a79cf002120735d7cb0eb1474e8adce56618456fff',
'0xf6e9983c37baf68846fedafe21e56718790e39fb1c582abc408b81bc7b208f9a',
@@ -82,7 +98,16 @@ export const knownGenesis: KnownGenesis = {
statemine: [
'0x48239ef607d7928874027a43a67689209727dfb3d3dc5e5b03a39bdc2eda771a'
],
statemint: [
'0x68d56f15f85d3136970ec16946040bc1752654e906147f7e43e9d539d7c3de2f'
],
subsocial: [
'0x0bd72c1c305172e1275278aaeb3f161e02eccb7a819e63f62d47bd53a28189f8'
],
westend: [
'0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e'
],
xxnetwork: [
'0x50dd5d206917bf10502c68fb4d18a59fc8aa31586f4e8856b493e43544aa82aa'
]
};
+15
View File
@@ -0,0 +1,15 @@
// Copyright 2017-2022 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KnownIcon } from '../types';
// these are icon overrides
export const knownIcon: KnownIcon = {
centrifuge: 'polkadot',
kusama: 'polkadot',
polkadot: 'polkadot',
sora: 'polkadot',
statemine: 'polkadot',
statemint: 'polkadot',
westmint: 'polkadot'
};
+7
View File
@@ -0,0 +1,7 @@
// Copyright 2017-2022 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { knownGenesis } from './genesis';
export { knownIcon } from './icons';
export { knownLedger } from './ledger';
export { knownTestnet } from './testnets';
+31
View File
@@ -0,0 +1,31 @@
// Copyright 2017-2022 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KnownLedger } from '../types';
// These match up with the keys of the ledgerApps object in the @polkadot/hw-ledger/defaults.ts
// and maps to the known slip44 (minus the `0x8` hard derivation flag)
//
// NOTE: Any network here needs to have a genesisHash attached in the ./genesis.ts config
export const knownLedger: KnownLedger = {
acala: 0x00000313,
astar: 0x0000032a,
bifrost: 0x00000314,
centrifuge: 0x000002eb,
composable: 0x00000162,
'dock-mainnet': 0x00000252,
edgeware: 0x0000020b,
equilibrium: 0x05f5e0fd,
genshiro: 0x05f5e0fc,
karura: 0x000002ae,
kusama: 0x000001b2,
'nodle-para': 0x000003eb,
parallel: 0x00000162,
polkadex: 0x0000031f,
polkadot: 0x00000162,
polymesh: 0x00000253,
sora: 0x00000269,
statemine: 0x000001b2, // common-good on Kusama, shares derivation
statemint: 0x00000162, // common-good on Polkadot, shares derivation
xxnetwork: 0x000007a3
};
@@ -0,0 +1,15 @@
// Copyright 2017-2022 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KnownTestnet } from '../types';
// testnets should not allow selection
export const knownTestnet: KnownTestnet = {
'': true, // this is the default non-network entry
'cess-testnet': true,
'dock-testnet': true,
jupiter: true,
'mathchain-testnet': true,
subspace_testnet: true,
'zero-alphaville': true
};
+21 -1
View File
@@ -67,6 +67,26 @@ describe('availableNetworks', (): void => {
)
).toEqual([]);
});
it('has all the correct fields', (): void => {
expect(availableNetworks[0]).toEqual({
decimals: [10],
displayName: 'Polkadot Relay Chain',
genesisHash: [
'0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3'
],
hasLedgerSupport: true,
icon: 'polkadot',
isIgnored: false,
isTestnet: false,
network: 'polkadot',
prefix: 0,
slip44: 354,
standardAccount: '*25519',
symbols: ['DOT'],
website: 'https://polkadot.network'
});
});
});
describe('allNetworks', (): void => {
@@ -93,6 +113,6 @@ describe('selectableNetworks', (): void => {
it('has a sorted list (first external, last external)', (): void => {
expect(selectableNetworks[3].displayName).toEqual('Acala');
expect(selectableNetworks[selectableNetworks.length - 1].displayName).toEqual('Stafi');
expect(selectableNetworks[selectableNetworks.length - 1].displayName).toEqual('xx network');
});
});
+4
View File
@@ -1,5 +1,9 @@
// Copyright 2017-2022 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
// TODO: This was removed, really cannot recall the reason...
// ... put it back, but keep it removed
// import './detectPackage';
export * from './interfaces';
export { packageInfo } from './packageInfo';
+10 -2
View File
@@ -3,8 +3,9 @@
import type { KnownSubstrate, Network, SubstrateNetwork } from './types';
import knownSubstrate from '@substrate/ss58-registry';
import { knownGenesis, knownIcon, knownLedger, knownTestnet } from './defaults';
import { knownSubstrate } from './substrate';
// These are known prefixes that are not sorted
const UNSORTED = [0, 2, 42];
@@ -25,7 +26,14 @@ function toExpanded (o: KnownSubstrate): SubstrateNetwork {
// filtering
n.isTestnet = !!knownTestnet[network] || TESTNETS.includes(nameParts[nameParts.length - 1]);
n.isIgnored = n.isTestnet || (!(o.standardAccount && o.decimals && o.symbols) && o.prefix !== 42);
n.isIgnored = n.isTestnet || (
!(
o.standardAccount &&
o.decimals && o.decimals.length &&
o.symbols && o.symbols.length
) &&
o.prefix !== 42
);
return n;
}
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/networks', path: 'auto', type: 'auto', version: '8.3.2' };
export const packageInfo = { name: '@polkadot/networks', path: 'auto', type: 'auto', version: '9.7.1' };
@@ -0,0 +1,26 @@
// Copyright 2017-2022 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import known from '@substrate/ss58-registry';
import fs from 'fs';
import path from 'path';
import other from './test/ss58registry.test.json';
describe('@substrate/ss58-registry', (): void => {
it('has known values', (): void => {
const json = JSON.stringify(known, null, 2);
try {
expect(JSON.parse(json)).toEqual(other);
} catch (error) {
if (process.env.GITHUB_REPOSITORY) {
console.error(json);
throw error;
}
fs.writeFileSync(path.join(__dirname, './test/ss58registry.test.json'), json, { flag: 'w' });
}
});
});
-794
View File
@@ -1,794 +0,0 @@
// Copyright 2017-2022 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
//
// Auto-generated by yarn networks:sync (via scripts/fromSubstrate.mjs)
//
// This file should never be edited manually. Rather the process is as follow -
//
// - make a PR to the upstream registry found at https://github.com/paritytech/ss58-registry/
// - ensure the PR gets merged
// - yarn networks:sync in this repo to sync
//
// Any manual changes to this file will make CI cron checks fail and will be
// lost when the registry is updated alongside the above sync.
//
import type { KnownSubstrate } from './types';
export const knownSubstrate: KnownSubstrate[] = [
{
decimals: [10],
displayName: 'Polkadot Relay Chain',
network: 'polkadot',
prefix: 0,
standardAccount: '*25519',
symbols: ['DOT'],
website: 'https://polkadot.network'
},
{
decimals: null,
displayName: 'Bare 32-bit Schnorr/Ristretto (S/R 25519) public key.',
network: 'BareSr25519',
prefix: 1,
standardAccount: 'Sr25519',
symbols: null,
website: null
},
{
decimals: [12],
displayName: 'Kusama Relay Chain',
network: 'kusama',
prefix: 2,
standardAccount: '*25519',
symbols: ['KSM'],
website: 'https://kusama.network'
},
{
decimals: null,
displayName: 'Bare 32-bit Ed25519 public key.',
network: 'BareEd25519',
prefix: 3,
standardAccount: 'Ed25519',
symbols: null,
website: null
},
{
decimals: null,
displayName: 'Katal Chain',
network: 'katalchain',
prefix: 4,
standardAccount: '*25519',
symbols: null,
website: null
},
{
decimals: [18],
displayName: 'Astar Network',
network: 'astar',
prefix: 5,
standardAccount: '*25519',
symbols: ['ASTR'],
website: 'https://astar.network'
},
{
decimals: [12],
displayName: 'Bifrost',
network: 'bifrost',
prefix: 6,
standardAccount: '*25519',
symbols: ['BNC'],
website: 'https://bifrost.finance/'
},
{
decimals: [18],
displayName: 'Edgeware',
network: 'edgeware',
prefix: 7,
standardAccount: '*25519',
symbols: ['EDG'],
website: 'https://edgewa.re'
},
{
decimals: [12],
displayName: 'Karura',
network: 'karura',
prefix: 8,
standardAccount: '*25519',
symbols: ['KAR'],
website: 'https://karura.network/'
},
{
decimals: [18],
displayName: 'Laminar Reynolds Canary',
network: 'reynolds',
prefix: 9,
standardAccount: '*25519',
symbols: ['REY'],
website: 'http://laminar.network/'
},
{
decimals: [12],
displayName: 'Acala',
network: 'acala',
prefix: 10,
standardAccount: '*25519',
symbols: ['ACA'],
website: 'https://acala.network/'
},
{
decimals: [18],
displayName: 'Laminar',
network: 'laminar',
prefix: 11,
standardAccount: '*25519',
symbols: ['LAMI'],
website: 'http://laminar.network/'
},
{
decimals: [6],
displayName: 'Polymesh',
network: 'polymesh',
prefix: 12,
standardAccount: '*25519',
symbols: ['POLYX'],
website: 'https://polymath.network/'
},
{
decimals: [12],
displayName: 'Integritee',
network: 'integritee',
prefix: 13,
standardAccount: '*25519',
symbols: ['TEER'],
website: 'https://integritee.network'
},
{
decimals: [0],
displayName: 'Totem',
network: 'totem',
prefix: 14,
standardAccount: '*25519',
symbols: ['TOTEM'],
website: 'https://totemaccounting.com'
},
{
decimals: [12],
displayName: 'Synesthesia',
network: 'synesthesia',
prefix: 15,
standardAccount: '*25519',
symbols: ['SYN'],
website: 'https://synesthesia.network/'
},
{
decimals: [12],
displayName: 'Kulupu',
network: 'kulupu',
prefix: 16,
standardAccount: '*25519',
symbols: ['KLP'],
website: 'https://kulupu.network/'
},
{
decimals: null,
displayName: 'Dark Mainnet',
network: 'dark',
prefix: 17,
standardAccount: '*25519',
symbols: null,
website: null
},
{
decimals: [9, 9],
displayName: 'Darwinia Network',
network: 'darwinia',
prefix: 18,
standardAccount: '*25519',
symbols: ['RING', 'KTON'],
website: 'https://darwinia.network/'
},
{
decimals: [12],
displayName: 'GeekCash',
network: 'geek',
prefix: 19,
standardAccount: '*25519',
symbols: ['GEEK'],
website: 'https://geekcash.org'
},
{
decimals: [12],
displayName: 'Stafi',
network: 'stafi',
prefix: 20,
standardAccount: '*25519',
symbols: ['FIS'],
website: 'https://stafi.io'
},
{
decimals: [6],
displayName: 'Dock Testnet',
network: 'dock-testnet',
prefix: 21,
standardAccount: '*25519',
symbols: ['DCK'],
website: 'https://dock.io'
},
{
decimals: [6],
displayName: 'Dock Mainnet',
network: 'dock-mainnet',
prefix: 22,
standardAccount: '*25519',
symbols: ['DCK'],
website: 'https://dock.io'
},
{
decimals: null,
displayName: 'ShiftNrg',
network: 'shift',
prefix: 23,
standardAccount: '*25519',
symbols: null,
website: null
},
{
decimals: [18],
displayName: 'ZERO',
network: 'zero',
prefix: 24,
standardAccount: '*25519',
symbols: ['PLAY'],
website: 'https://zero.io'
},
{
decimals: [18],
displayName: 'ZERO Alphaville',
network: 'zero-alphaville',
prefix: 25,
standardAccount: '*25519',
symbols: ['PLAY'],
website: 'https://zero.io'
},
{
decimals: [10],
displayName: 'Jupiter',
network: 'jupiter',
prefix: 26,
standardAccount: '*25519',
symbols: ['jDOT'],
website: 'https://jupiter.patract.io'
},
{
decimals: null,
displayName: 'Subsocial',
network: 'subsocial',
prefix: 28,
standardAccount: '*25519',
symbols: null,
website: null
},
{
decimals: [12, 12],
displayName: 'CORD Network',
network: 'cord',
prefix: 29,
standardAccount: '*25519',
symbols: ['DHI', 'WAY'],
website: 'https://cord.network/'
},
{
decimals: [12],
displayName: 'Phala Network',
network: 'phala',
prefix: 30,
standardAccount: '*25519',
symbols: ['PHA'],
website: 'https://phala.network'
},
{
decimals: [12],
displayName: 'Litentry Network',
network: 'litentry',
prefix: 31,
standardAccount: '*25519',
symbols: ['LIT'],
website: 'https://litentry.com/'
},
{
decimals: [9],
displayName: 'Robonomics',
network: 'robonomics',
prefix: 32,
standardAccount: '*25519',
symbols: ['XRT'],
website: 'https://robonomics.network'
},
{
decimals: null,
displayName: 'DataHighway',
network: 'datahighway',
prefix: 33,
standardAccount: '*25519',
symbols: null,
website: null
},
{
decimals: [12],
displayName: 'Ares Protocol',
network: 'ares',
prefix: 34,
standardAccount: '*25519',
symbols: ['ARES'],
website: 'https://www.aresprotocol.com/'
},
{
decimals: [15],
displayName: 'Valiu Liquidity Network',
network: 'vln',
prefix: 35,
standardAccount: '*25519',
symbols: ['USDv'],
website: 'https://valiu.com/'
},
{
decimals: [18],
displayName: 'Centrifuge Chain',
network: 'centrifuge',
prefix: 36,
standardAccount: '*25519',
symbols: ['CFG'],
website: 'https://centrifuge.io/'
},
{
decimals: [18],
displayName: 'Nodle Chain',
network: 'nodle',
prefix: 37,
standardAccount: '*25519',
symbols: ['NODL'],
website: 'https://nodle.io/'
},
{
decimals: [18],
displayName: 'KILT Chain',
network: 'kilt',
prefix: 38,
standardAccount: '*25519',
symbols: ['KILT'],
website: 'https://kilt.io/'
},
{
decimals: [18],
displayName: 'MathChain mainnet',
network: 'mathchain',
prefix: 39,
standardAccount: '*25519',
symbols: ['MATH'],
website: 'https://mathwallet.org'
},
{
decimals: [18],
displayName: 'MathChain testnet',
network: 'mathchain-testnet',
prefix: 40,
standardAccount: '*25519',
symbols: ['MATH'],
website: 'https://mathwallet.org'
},
{
decimals: null,
displayName: 'Polimec Chain',
network: 'poli',
prefix: 41,
standardAccount: '*25519',
symbols: null,
website: 'https://polimec.io/'
},
{
decimals: null,
displayName: 'Substrate',
network: 'substrate',
prefix: 42,
standardAccount: '*25519',
symbols: null,
website: 'https://substrate.io/'
},
{
decimals: null,
displayName: 'Bare 32-bit ECDSA SECP-256k1 public key.',
network: 'BareSecp256k1',
prefix: 43,
standardAccount: 'secp256k1',
symbols: null,
website: null
},
{
decimals: [8],
displayName: 'ChainX',
network: 'chainx',
prefix: 44,
standardAccount: '*25519',
symbols: ['PCX'],
website: 'https://chainx.org/'
},
{
decimals: [12, 12],
displayName: 'UniArts Network',
network: 'uniarts',
prefix: 45,
standardAccount: '*25519',
symbols: ['UART', 'UINK'],
website: 'https://uniarts.me'
},
{
decimals: null,
displayName: 'This prefix is reserved.',
network: 'reserved46',
prefix: 46,
standardAccount: null,
symbols: null,
website: null
},
{
decimals: null,
displayName: 'This prefix is reserved.',
network: 'reserved47',
prefix: 47,
standardAccount: null,
symbols: null,
website: null
},
{
decimals: [12],
displayName: 'Neatcoin Mainnet',
network: 'neatcoin',
prefix: 48,
standardAccount: '*25519',
symbols: ['NEAT'],
website: 'https://neatcoin.org'
},
{
decimals: [12],
displayName: 'Picasso',
network: 'picasso',
prefix: 49,
standardAccount: '*25519',
symbols: ['PICA'],
website: 'https://picasso.composable.finance'
},
{
decimals: [12],
displayName: 'Composable',
network: 'composable',
prefix: 50,
standardAccount: '*25519',
symbols: ['LAYR'],
website: 'https://composable.finance'
},
{
decimals: [9],
displayName: 'xx network',
network: 'xxnetwork',
prefix: 55,
standardAccount: '*25519',
symbols: ['XX'],
website: 'https://xx.network'
},
{
decimals: [12],
displayName: 'HydraDX',
network: 'hydradx',
prefix: 63,
standardAccount: '*25519',
symbols: ['HDX'],
website: 'https://hydradx.io'
},
{
decimals: [18],
displayName: 'AvN Mainnet',
network: 'aventus',
prefix: 65,
standardAccount: '*25519',
symbols: ['AVT'],
website: 'https://aventus.io'
},
{
decimals: [12],
displayName: 'Crust Network',
network: 'crust',
prefix: 66,
standardAccount: '*25519',
symbols: ['CRU'],
website: 'https://crust.network'
},
{
decimals: [9, 9, 9],
displayName: 'Genshiro Network',
network: 'genshiro',
prefix: 67,
standardAccount: '*25519',
symbols: ['GENS', 'EQD', 'LPT0'],
website: 'https://genshiro.equilibrium.io'
},
{
decimals: [9],
displayName: 'Equilibrium Network',
network: 'equilibrium',
prefix: 68,
standardAccount: '*25519',
symbols: ['EQ'],
website: 'https://equilibrium.io'
},
{
decimals: [18],
displayName: 'SORA Network',
network: 'sora',
prefix: 69,
standardAccount: '*25519',
symbols: ['XOR'],
website: 'https://sora.org'
},
{
decimals: [10],
displayName: 'Zeitgeist',
network: 'zeitgeist',
prefix: 73,
standardAccount: '*25519',
symbols: ['ZTG'],
website: 'https://zeitgeist.pm'
},
{
decimals: [18],
displayName: 'Manta network',
network: 'manta',
prefix: 77,
standardAccount: '*25519',
symbols: ['MANTA'],
website: 'https://manta.network'
},
{
decimals: [12],
displayName: 'Calamari: Manta Canary Network',
network: 'calamari',
prefix: 78,
standardAccount: '*25519',
symbols: ['KMA'],
website: 'https://manta.network'
},
{
decimals: [12],
displayName: 'Polkadex Mainnet',
network: 'polkadex',
prefix: 88,
standardAccount: '*25519',
symbols: ['PDEX'],
website: 'https://polkadex.trade'
},
{
decimals: [18],
displayName: 'PolkaSmith Canary Network',
network: 'polkasmith',
prefix: 98,
standardAccount: '*25519',
symbols: ['PKS'],
website: 'https://polkafoundry.com'
},
{
decimals: [18],
displayName: 'PolkaFoundry Network',
network: 'polkafoundry',
prefix: 99,
standardAccount: '*25519',
symbols: ['PKF'],
website: 'https://polkafoundry.com'
},
{
decimals: [18],
displayName: 'OriginTrail Parachain',
network: 'origintrail-parachain',
prefix: 101,
standardAccount: 'secp256k1',
symbols: ['TRAC'],
website: 'https://origintrail.io'
},
{
decimals: [10],
displayName: 'Pontem Network',
network: 'pontem-network',
prefix: 105,
standardAccount: '*25519',
symbols: ['PONT'],
website: 'https://pontem.network'
},
{
decimals: [12],
displayName: 'Heiko',
network: 'heiko',
prefix: 110,
standardAccount: '*25519',
symbols: ['HKO'],
website: 'https://parallel.fi/'
},
{
decimals: null,
displayName: 'Integritee Incognito',
network: 'integritee-incognito',
prefix: 113,
standardAccount: '*25519',
symbols: null,
website: 'https://integritee.network'
},
{
decimals: [18],
displayName: 'Clover Finance',
network: 'clover',
prefix: 128,
standardAccount: '*25519',
symbols: ['CLV'],
website: 'https://clover.finance'
},
{
decimals: [18],
displayName: 'Altair',
network: 'altair',
prefix: 136,
standardAccount: '*25519',
symbols: ['AIR'],
website: 'https://centrifuge.io/'
},
{
decimals: [12],
displayName: 'Parallel',
network: 'parallel',
prefix: 172,
standardAccount: '*25519',
symbols: ['PARA'],
website: 'https://parallel.fi/'
},
{
decimals: [18],
displayName: 'Social Network',
network: 'social-network',
prefix: 252,
standardAccount: '*25519',
symbols: ['NET'],
website: 'https://social.network'
},
{
decimals: [15],
displayName: 'QUARTZ by UNIQUE',
network: 'quartz_mainnet',
prefix: 255,
standardAccount: '*25519',
symbols: ['QTZ'],
website: 'https://unique.network'
},
{
decimals: [18],
displayName: 'Pioneer Network by Bit.Country',
network: 'pioneer_network',
prefix: 268,
standardAccount: '*25519',
symbols: ['NEER'],
website: 'https://bit.country'
},
{
decimals: [18],
displayName: 'SORA Kusama Parachain',
network: 'sora_kusama_para',
prefix: 420,
standardAccount: '*25519',
symbols: ['XOR'],
website: 'https://sora.org'
},
{
decimals: [18],
displayName: 'Efinity',
network: 'efinity',
prefix: 1110,
standardAccount: 'Sr25519',
symbols: ['EFI'],
website: 'https://efinity.io/'
},
{
decimals: [18],
displayName: 'Moonbeam',
network: 'moonbeam',
prefix: 1284,
standardAccount: 'secp256k1',
symbols: ['GLMR'],
website: 'https://moonbeam.network'
},
{
decimals: [18],
displayName: 'Moonriver',
network: 'moonriver',
prefix: 1285,
standardAccount: 'secp256k1',
symbols: ['MOVR'],
website: 'https://moonbeam.network'
},
{
decimals: [12],
displayName: 'Kapex',
network: 'kapex',
prefix: 2007,
standardAccount: '*25519',
symbols: ['KAPEX'],
website: 'https://totemaccounting.com'
},
{
decimals: [10],
displayName: 'Interlay',
network: 'interlay',
prefix: 2032,
standardAccount: '*25519',
symbols: ['INTR'],
website: 'https://interlay.io/'
},
{
decimals: [12],
displayName: 'Kintsugi',
network: 'kintsugi',
prefix: 2092,
standardAccount: '*25519',
symbols: ['KINT'],
website: 'https://interlay.io/'
},
{
decimals: [18],
displayName: 'Subspace testnet',
network: 'subspace_testnet',
prefix: 2254,
standardAccount: '*25519',
symbols: ['tSSC'],
website: 'https://subspace.network'
},
{
decimals: [18],
displayName: 'Subspace',
network: 'subspace',
prefix: 6094,
standardAccount: '*25519',
symbols: ['SSC'],
website: 'https://subspace.network'
},
{
decimals: [12],
displayName: 'Basilisk',
network: 'basilisk',
prefix: 10041,
standardAccount: '*25519',
symbols: ['BSX'],
website: 'https://bsx.fi'
},
{
decimals: [12],
displayName: 'CESS Testnet',
network: 'cess-testnet',
prefix: 11330,
standardAccount: '*25519',
symbols: ['TCESS'],
website: 'https://cess.cloud'
},
{
decimals: [12],
displayName: 'CESS',
network: 'cess',
prefix: 11331,
standardAccount: '*25519',
symbols: ['CESS'],
website: 'https://cess.cloud'
},
{
decimals: [18],
displayName: 'Automata ContextFree',
network: 'contextfree',
prefix: 11820,
standardAccount: '*25519',
symbols: ['CTX'],
website: 'https://ata.network'
}
];
File diff suppressed because it is too large Load Diff
+4 -10
View File
@@ -1,17 +1,9 @@
// Copyright 2017-2022 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
export type Icon = 'beachball' | 'empty' | 'jdenticon' | 'polkadot' | 'substrate';
import type { RegistryEntry } from '@substrate/ss58-registry';
export interface KnownSubstrate {
decimals: number[] | null,
displayName: string;
network: string | null;
prefix: number;
standardAccount: '*25519' | 'Ed25519' | 'Sr25519' | 'secp256k1' | null;
symbols: string[] | null;
website: string | null;
}
export type Icon = 'beachball' | 'empty' | 'jdenticon' | 'polkadot' | 'substrate';
export type KnownIcon = Record<string, Icon>;
@@ -19,6 +11,8 @@ export type KnownLedger = Record<string, number>;
export type KnownGenesis = Record<string, string[]>;
export type KnownSubstrate = RegistryEntry;
export type KnownTestnet = Record<string, true>;
export interface SubstrateNetwork extends KnownSubstrate {
+5
View File
@@ -3,8 +3,13 @@
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"resolveJsonModule": true,
"rootDir": "./src"
},
"include": [
"**/src/**/*.ts",
"**/test/*.json"
],
"references": [
{ "path": "../hw-ledger/tsconfig.build.json" },
{ "path": "../util/tsconfig.build.json" },
+13 -13
View File
@@ -16,35 +16,35 @@
"url": "https://github.com/polkadot-js/common.git"
},
"sideEffects": [
"./cryptoInit.js",
"./cryptoInit.cjs",
"./bundleInit.js",
"./bundleInit.cjs",
"./detectPackage.js",
"./detectPackage.cjs"
],
"type": "module",
"version": "8.3.2",
"version": "9.7.1",
"browser": {
"crypto": false,
"stream": false
},
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.7",
"@noble/hashes": "0.5.7",
"@noble/secp256k1": "1.3.4",
"@polkadot/networks": "8.3.2",
"@polkadot/util": "8.3.2",
"@polkadot/wasm-crypto": "^4.5.1",
"@polkadot/x-bigint": "8.3.2",
"@polkadot/x-randomvalues": "8.3.2",
"@babel/runtime": "^7.18.6",
"@noble/hashes": "1.1.2",
"@noble/secp256k1": "1.6.0",
"@polkadot/networks": "9.7.1",
"@polkadot/util": "9.7.1",
"@polkadot/wasm-crypto": "^6.2.1",
"@polkadot/x-bigint": "9.7.1",
"@polkadot/x-randomvalues": "9.7.1",
"@scure/base": "1.1.1",
"ed2curve": "^0.3.0",
"micro-base": "^0.10.2",
"tweetnacl": "^1.0.3"
},
"devDependencies": {
"@types/ed2curve": "^0.2.2"
},
"peerDependencies": {
"@polkadot/util": "8.3.2"
"@polkadot/util": "9.7.1"
}
}
@@ -10,7 +10,5 @@ import { decodeAddress } from './decode';
* @summary Converts an SS58 address to its corresponding EVM address.
*/
export function addressToEvm (address: HexString | string | Uint8Array, ignoreChecksum?: boolean): Uint8Array {
const decoded = decodeAddress(address, ignoreChecksum);
return decoded.subarray(0, 20);
return decodeAddress(address, ignoreChecksum).subarray(0, 20);
}
+1 -7
View File
@@ -1,18 +1,12 @@
// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Network } from '@polkadot/networks/types';
import { availableNetworks } from '../networks';
function networkToPrefix ({ prefix }: Network): number {
return prefix;
}
export const defaults = {
allowedDecodedLengths: [1, 2, 4, 8, 32, 33],
// publicKey has prefix + 2 checksum bytes, short only prefix + 1 checksum byte
allowedEncodedLengths: [3, 4, 6, 10, 35, 36, 37, 38],
allowedPrefix: availableNetworks.map(networkToPrefix),
allowedPrefix: availableNetworks.map(({ prefix }) => prefix),
prefix: 42
};
@@ -14,7 +14,7 @@ const l = logger('setSS58Format');
* @deprecated Use keyring.setSS58Format
*/
export function setSS58Format (prefix: Prefix): void {
l.warn('Global setting of the ss58Format is deprecated and not recommended. Set format on the keyring (if used) or as pat of the address encode function');
l.warn('Global setting of the ss58Format is deprecated and not recommended. Set format on the keyring (if used) or as part of the address encode function');
defaults.prefix = prefix;
}
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { utils } from 'micro-base';
import { utils } from '@scure/base';
import { createDecode, createEncode, createIs, createValidate } from './helpers';
+5 -1
View File
@@ -27,18 +27,20 @@ type EncodeFn = (value: U8aLike, ipfsCompat?: boolean) => string;
type ValidateFn = (value?: unknown, ipfsCompat?: boolean) => value is string;
/** @internal */
export function createDecode ({ coder, ipfs }: Config, validate: ValidateFn): DecodeFn {
return (value: string, ipfsCompat?: boolean): Uint8Array => {
validate(value, ipfsCompat);
return coder.decode(
ipfs && ipfsCompat
? value.substr(1)
? value.substring(1)
: value
);
};
}
/** @internal */
export function createEncode ({ coder, ipfs }: Config): EncodeFn {
return (value: U8aLike, ipfsCompat?: boolean): string => {
const out = coder.encode(u8aToU8a(value));
@@ -49,6 +51,7 @@ export function createEncode ({ coder, ipfs }: Config): EncodeFn {
};
}
/** @internal */
export function createIs (validate: ValidateFn): ValidateFn {
return (value?: unknown, ipfsCompat?: boolean): value is string => {
try {
@@ -59,6 +62,7 @@ export function createIs (validate: ValidateFn): ValidateFn {
};
}
/** @internal */
export function createValidate ({ chars, ipfs, type }: Config): ValidateFn {
return (value?: unknown, ipfsCompat?: boolean): value is string => {
assert(value && typeof value === 'string', () => `Expected non-null, non-empty ${type} string input`);
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { base58 } from 'micro-base';
import { base58 } from '@scure/base';
import { createDecode, createEncode, createIs, createValidate } from '../base32/helpers';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { base64 } from 'micro-base';
import { base64 } from '@scure/base';
import { createDecode, createEncode, createIs, createValidate } from '../base32/helpers';
+1 -3
View File
@@ -10,8 +10,6 @@ import { blake2b, isReady } from '@polkadot/wasm-crypto';
import { createAsHex } from '../helpers';
type BitLength = 64 | 128 | 256 | 384 | 512;
/**
* @name blake2AsU8a
* @summary Creates a blake2b u8a from the input.
@@ -26,7 +24,7 @@ type BitLength = 64 | 128 | 256 | 384 | 512;
* blake2AsU8a('abc'); // => [0xba, 0x80, 0xa5, 0x3f, 0x98, 0x1c, 0x4d, 0x0d]
* ```
*/
export function blake2AsU8a (data: HexString | Uint8Array | string, bitLength: BitLength = 256, key?: Uint8Array | null, onlyJs?: boolean): Uint8Array {
export function blake2AsU8a (data: HexString | Uint8Array | string, bitLength: 64 | 128 | 256 | 384 | 512 = 256, key?: Uint8Array | null, onlyJs?: boolean): Uint8Array {
const byteLength = Math.ceil(bitLength / 8);
const u8a = u8aToU8a(data);
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './cryptoInit';
import './bundleInit';
export { packageInfo } from './packageInfo';
@@ -17,5 +17,5 @@ utilsNobleSecp256k1.hmacSha256Sync = (key: Uint8Array, ...messages: Uint8Array[]
// start init process immediately
cryptoWaitReady().catch((): void => {
// shouldn't happen, logged above
// shouldn't happen, logged and caught inside cryptoWaitReady
});
+5 -3
View File
@@ -14,17 +14,19 @@ interface DualHash {
512: (u8a: Uint8Array) => Uint8Array;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function createAsHex <T extends (...args: any[]) => Uint8Array> (fn: T): (...args: Parameters<T>) => HexString {
/** @internal */
export function createAsHex <T extends (...args: never[]) => Uint8Array> (fn: T): (...args: Parameters<T>) => HexString {
return (...args: Parameters<T>): HexString =>
u8aToHex(fn(...args));
}
export function createBitHasher <T> (bitLength: T, fn: (data: HexString | Buffer | Uint8Array | string, bitLength: T, onlyJs?: boolean) => Uint8Array): (data: HexString | Buffer | Uint8Array | string, onlyJs?: boolean) => Uint8Array {
/** @internal */
export function createBitHasher (bitLength: 256 | 512, fn: (data: HexString | Buffer | Uint8Array | string, bitLength: 256 | 512, onlyJs?: boolean) => Uint8Array): (data: HexString | Buffer | Uint8Array | string, onlyJs?: boolean) => Uint8Array {
return (data: HexString | Buffer | Uint8Array | string, onlyJs?: boolean): Uint8Array =>
fn(data, bitLength, onlyJs);
}
/** @internal */
export function createDualHasher (wa: DualHash, js: DualHash): (value: HexString | Buffer | Uint8Array | string, bitLength?: 256 | 512, onlyJs?: boolean) => Uint8Array {
return (value: HexString | Buffer | Uint8Array | string, bitLength: 256 | 512 = 256, onlyJs?: boolean): Uint8Array => {
const u8a = u8aToU8a(value);
+2 -4
View File
@@ -8,8 +8,6 @@ import { sha512 } from '@noble/hashes/sha512';
import { hasBigInt, u8aToU8a } from '@polkadot/util';
import { hmacSha256, hmacSha512, isReady } from '@polkadot/wasm-crypto';
type BitLength = 256 | 512;
const JS_HASH = {
256: sha256,
512: sha512
@@ -20,7 +18,7 @@ const WA_MHAC = {
512: hmacSha512
};
function createSha (bitLength: BitLength): (key: Uint8Array | string, data: Uint8Array, onlyJs?: boolean) => Uint8Array {
function createSha (bitLength: 256 | 512): (key: Uint8Array | string, data: Uint8Array, onlyJs?: boolean) => Uint8Array {
return (key: Uint8Array | string, data: Uint8Array, onlyJs?: boolean): Uint8Array =>
hmacShaAsU8a(key, data, bitLength, onlyJs);
}
@@ -29,7 +27,7 @@ function createSha (bitLength: BitLength): (key: Uint8Array | string, data: Uint
* @name hmacShaAsU8a
* @description creates a Hmac Sha (256/512) Uint8Array from the key & data
*/
export function hmacShaAsU8a (key: Uint8Array | string, data: Uint8Array, bitLength: BitLength = 256, onlyJs?: boolean): Uint8Array {
export function hmacShaAsU8a (key: Uint8Array | string, data: Uint8Array, bitLength: 256 | 512 = 256, onlyJs?: boolean): Uint8Array {
const u8aKey = u8aToU8a(key);
return !hasBigInt || (!onlyJs && isReady())
@@ -20,7 +20,7 @@ export class DeriveJunction {
public static from (value: string): DeriveJunction {
const result = new DeriveJunction();
const [code, isHard] = value.startsWith('/')
? [value.substr(1), true]
? [value.substring(1), true]
: [value, false];
result.soft(
+1 -1
View File
@@ -24,7 +24,7 @@ export function keyExtractPath (derivePath: string): ExtractResult {
constructed = parts.join('');
for (const p of parts) {
path.push(DeriveJunction.from(p.substr(1)));
path.push(DeriveJunction.from(p.substring(1)));
}
}
+3 -3
View File
@@ -1,8 +1,6 @@
// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { assert, isNull } from '@polkadot/util';
import { DeriveJunction } from './DeriveJunction';
import { keyExtractPath } from './extractPath';
@@ -22,7 +20,9 @@ export function keyExtractSuri (suri: string): ExtractResult {
// eslint-disable-next-line @typescript-eslint/prefer-regexp-exec
const matches = suri.match(RE_CAPTURE);
assert(!isNull(matches), 'Unable to match provided value to a secret URI');
if (matches === null) {
throw new Error('Unable to match provided value to a secret URI');
}
const [, phrase, , derivePath, , , password] = matches as string[];
const { path } = keyExtractPath(derivePath);
+5 -8
View File
@@ -12,6 +12,7 @@
// - Use util-crypto randomAsU8a (instead of randombytes)
// - Remove setting of wordlist passing of wordlist in functions
// - Remove mnemonicToSeed (we only use the sync variant)
// - generateMnemonic takes number of words (instead of strength)
import { assert, stringToU8a, u8aToU8a } from '@polkadot/util';
@@ -73,7 +74,7 @@ export function mnemonicToEntropy (mnemonic: string): Uint8Array {
// calculate the checksum and compare
const entropyBytes = entropyBits.match(/(.{1,8})/g)?.map(binaryToByte);
assert(entropyBytes && entropyBytes.length % 4 === 0 && entropyBytes.length >= 16 && entropyBytes.length <= 32, INVALID_ENTROPY);
assert(entropyBytes && (entropyBytes.length % 4 === 0) && (entropyBytes.length >= 16) && (entropyBytes.length <= 32), INVALID_ENTROPY);
const entropy = u8aToU8a(entropyBytes);
const newChecksum = deriveChecksumBits(entropy);
@@ -85,7 +86,7 @@ export function mnemonicToEntropy (mnemonic: string): Uint8Array {
export function entropyToMnemonic (entropy: Uint8Array): string {
// 128 <= ENT <= 256
assert(entropy.length % 4 === 0 && entropy.length >= 16 && entropy.length <= 32, INVALID_ENTROPY);
assert((entropy.length % 4 === 0) && (entropy.length >= 16) && (entropy.length <= 32), INVALID_ENTROPY);
const entropyBits = bytesToBinary(Array.from(entropy));
const checksumBits = deriveChecksumBits(entropy);
@@ -97,12 +98,8 @@ export function entropyToMnemonic (entropy: Uint8Array): string {
.join(' ');
}
export function generateMnemonic (strength?: number): string {
strength = strength || 128;
assert(strength % 32 === 0, INVALID_ENTROPY);
return entropyToMnemonic(randomAsU8a(strength / 8));
export function generateMnemonic (numWords: 12 | 15 | 18 | 21 | 24): string {
return entropyToMnemonic(randomAsU8a((numWords / 3) * 4));
}
export function validateMnemonic (mnemonic: string): boolean {
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import { cryptoWaitReady } from '..';
import { mnemonicGenerate, WordCount } from './generate';
import { mnemonicGenerate } from './generate';
import { mnemonicValidate } from './validate';
describe('mnemonicGenerate', (): void => {
@@ -17,7 +17,7 @@ describe('mnemonicGenerate', (): void => {
});
describe.each([false, true])('onlyJs=%p', (onlyJs): void => {
it.each([12, 15, 18, 21, 24] as WordCount[])('generates a valid mnemonic (%p words)', (num): void => {
it.each([12, 15, 18, 21, 24] as 12[])('generates a valid mnemonic (%p words)', (num): void => {
const mnemonic = mnemonicGenerate(num, onlyJs);
const isValid = mnemonicValidate(mnemonic);
+2 -13
View File
@@ -6,17 +6,6 @@ import { bip39Generate, isReady } from '@polkadot/wasm-crypto';
import { generateMnemonic } from './bip39';
export type WordCount = 12 | 15 | 18 | 21 | 24;
// mapping of words to the actual strength (as expected)
const STRENGTH_MAP = {
12: 16 * 8,
15: 20 * 8,
18: 24 * 8,
21: 28 * 8,
24: 32 * 8
};
/**
* @name mnemonicGenerate
* @summary Creates a valid mnemonic string using using [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki).
@@ -29,8 +18,8 @@ const STRENGTH_MAP = {
* const mnemonic = mnemonicGenerate(); // => string
* ```
*/
export function mnemonicGenerate (numWords: WordCount = 12, onlyJs?: boolean): string {
export function mnemonicGenerate (numWords: 12 | 15 | 18 | 21 | 24 = 12, onlyJs?: boolean): string {
return !hasBigInt || (!onlyJs && isReady())
? bip39Generate(numWords)
: generateMnemonic(STRENGTH_MAP[numWords]);
: generateMnemonic(numWords);
}
@@ -1,7 +1,7 @@
// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { assert, hasBigInt } from '@polkadot/util';
import { hasBigInt } from '@polkadot/util';
import { bip39ToSeed, isReady } from '@polkadot/wasm-crypto';
import { mnemonicToSeedSync } from './bip39';
@@ -25,8 +25,11 @@ import { mnemonicValidate } from './validate';
* ```
*/
export function mnemonicToLegacySeed (mnemonic: string, password = '', onlyJs?: boolean, byteLength: 32 | 64 = 32): Uint8Array {
assert(mnemonicValidate(mnemonic), 'Invalid bip39 mnemonic specified');
assert([32, 64].includes(byteLength), () => `Invalid seed length ${byteLength}, expected 32 or 64`);
if (!mnemonicValidate(mnemonic)) {
throw new Error('Invalid bip39 mnemonic specified');
} else if (![32, 64].includes(byteLength)) {
throw new Error(`Invalid seed length ${byteLength}, expected 32 or 64`);
}
return byteLength === 32
? !hasBigInt || (!onlyJs && isReady())
@@ -43,7 +43,7 @@ describe('mnemonicToMiniSecret', (): void => {
u8aToHex(mnemonicToMiniSecret(mnemonic, 'Substrate', onlyJs))
).toEqual(
// mini returned here, only check first 32-bytes (64 hex + 2 prefix)
seed.substr(0, 66)
seed.substring(0, 66)
);
});
});
@@ -1,7 +1,7 @@
// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { assert, stringToU8a } from '@polkadot/util';
import { stringToU8a } from '@polkadot/util';
import { bip39ToMiniSecret, isReady } from '@polkadot/wasm-crypto';
import { pbkdf2Encode } from '../pbkdf2';
@@ -9,7 +9,9 @@ import { mnemonicToEntropy } from './toEntropy';
import { mnemonicValidate } from './validate';
export function mnemonicToMiniSecret (mnemonic: string, password = '', onlyJs?: boolean): Uint8Array {
assert(mnemonicValidate(mnemonic), 'Invalid bip39 mnemonic specified');
if (!mnemonicValidate(mnemonic)) {
throw new Error('Invalid bip39 mnemonic specified');
}
if (!onlyJs && isReady()) {
return bip39ToMiniSecret(mnemonic, password);
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+2 -1
View File
@@ -1,4 +1,5 @@
// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from '@polkadot/networks/interfaces';
// Don't use a export * since we don't want to duplicate packageInfo
export { allNetworks, availableNetworks, selectableNetworks } from '@polkadot/networks';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/util-crypto', path: 'auto', type: 'auto', version: '8.3.2' };
export const packageInfo = { name: '@polkadot/util-crypto', path: 'auto', type: 'auto', version: '9.7.1' };
+4 -2
View File
@@ -3,7 +3,7 @@
import type { Params } from './types';
import { assert, u8aToBn } from '@polkadot/util';
import { u8aToBn } from '@polkadot/util';
import { BN_LE_OPTS } from '../bn';
import { DEFAULT_PARAMS } from './defaults';
@@ -23,7 +23,9 @@ export function scryptFromU8a (data: Uint8Array): Result {
// and updates for greater security. However we need some protection against carefully-crafted params that can
// eat up CPU since these are user inputs. So we need to get very clever here, but atm we only allow the defaults
// and if no match, bail out
assert(N === DEFAULT_PARAMS.N && p === DEFAULT_PARAMS.p && r === DEFAULT_PARAMS.r, 'Invalid injected scrypt params found');
if (N !== DEFAULT_PARAMS.N || p !== DEFAULT_PARAMS.p || r !== DEFAULT_PARAMS.r) {
throw new Error('Invalid injected scrypt params found');
}
return { params: { N, p, r }, salt };
}
@@ -3,7 +3,7 @@
import { Point } from '@noble/secp256k1';
import { assert, hasBigInt } from '@polkadot/util';
import { hasBigInt } from '@polkadot/util';
import { isReady, secp256k1Compress as wasm } from '@polkadot/wasm-crypto';
export function secp256k1Compress (publicKey: Uint8Array, onlyJs?: boolean): Uint8Array {
@@ -11,7 +11,9 @@ export function secp256k1Compress (publicKey: Uint8Array, onlyJs?: boolean): Uin
return publicKey;
}
assert(publicKey.length === 65, 'Invalid publicKey provided');
if (publicKey.length !== 65) {
throw new Error('Invalid publicKey provided');
}
return !hasBigInt || (!onlyJs && isReady())
? wasm(publicKey)
@@ -1,14 +1,16 @@
// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { assert, compactAddLength, isU8a, stringToU8a, u8aConcat } from '@polkadot/util';
import { compactAddLength, isU8a, stringToU8a, u8aConcat } from '@polkadot/util';
import { blake2AsU8a } from '../blake2/asU8a';
const HDKD = compactAddLength(stringToU8a('Secp256k1HDKD'));
export function secp256k1DeriveHard (seed: Uint8Array, chainCode: Uint8Array): Uint8Array {
assert(isU8a(chainCode) && chainCode.length === 32, 'Invalid chainCode passed to derive');
if (!isU8a(chainCode) || chainCode.length !== 32) {
throw new Error('Invalid chainCode passed to derive');
}
// NOTE This is specific to the Substrate HDD derivation, so always use the blake2 hasher
return blake2AsU8a(u8aConcat(HDKD, seed, chainCode), 256);
+4 -2
View File
@@ -3,7 +3,7 @@
import { Point } from '@noble/secp256k1';
import { assert, bnToU8a, hasBigInt, u8aConcat } from '@polkadot/util';
import { bnToU8a, hasBigInt, u8aConcat } from '@polkadot/util';
import { isReady, secp256k1Expand as wasm } from '@polkadot/wasm-crypto';
import { BN_BE_256_OPTS } from '../bn';
@@ -13,7 +13,9 @@ export function secp256k1Expand (publicKey: Uint8Array, onlyJs?: boolean): Uint8
return publicKey.subarray(1);
}
assert(publicKey.length === 33, 'Invalid publicKey provided');
if (publicKey.length !== 33) {
throw new Error('Invalid publicKey provided');
}
if (!hasBigInt || (!onlyJs && isReady())) {
return wasm(publicKey).subarray(1);
@@ -5,7 +5,7 @@ import type { Keypair } from '../../types';
import { getPublicKey } from '@noble/secp256k1';
import { assert, hasBigInt } from '@polkadot/util';
import { hasBigInt, u8aEmpty } from '@polkadot/util';
import { isReady, secp256k1FromSeed } from '@polkadot/wasm-crypto';
/**
@@ -13,13 +13,24 @@ import { isReady, secp256k1FromSeed } from '@polkadot/wasm-crypto';
* @description Returns a object containing a `publicKey` & `secretKey` generated from the supplied seed.
*/
export function secp256k1PairFromSeed (seed: Uint8Array, onlyJs?: boolean): Keypair {
assert(seed.length === 32, 'Expected valid 32-byte private key as a seed');
if (seed.length !== 32) {
throw new Error('Expected valid 32-byte private key as a seed');
}
if (!hasBigInt || (!onlyJs && isReady())) {
const full = secp256k1FromSeed(seed);
const publicKey = full.slice(32);
// There is an issue with the secp256k1 when running in an ASM.js environment where
// it seems that the lazy static section yields invalid results on the _first_ run.
// If this happens, fail outright, we cannot allow invalid return values
// https://github.com/polkadot-js/wasm/issues/307
if (u8aEmpty(publicKey)) {
throw new Error('Invalid publicKey generated from WASM interface');
}
return {
publicKey: full.slice(32),
publicKey,
secretKey: full.slice(0, 32)
};
}
@@ -6,7 +6,7 @@ import type { HashType } from './types';
import { recoverPublicKey, Signature } from '@noble/secp256k1';
import { assert, hasBigInt, u8aToU8a } from '@polkadot/util';
import { hasBigInt, u8aToU8a } from '@polkadot/util';
import { isReady, secp256k1Recover as wasm } from '@polkadot/wasm-crypto';
import { secp256k1Compress } from './compress';
@@ -23,7 +23,9 @@ export function secp256k1Recover (msgHash: HexString | Uint8Array | string, sign
? wasm(msg, sig, recovery)
: recoverPublicKey(msg, Signature.fromCompact(sig).toRawBytes(), recovery);
assert(publicKey, 'Unable to recover publicKey from signature');
if (!publicKey) {
throw new Error('Unable to recover publicKey from signature');
}
return hashType === 'keccak'
? secp256k1Expand(publicKey, onlyJs)
+4 -2
View File
@@ -6,7 +6,7 @@ import type { HashType } from './types';
import { Signature, signSync } from '@noble/secp256k1';
import { assert, bnToU8a, hasBigInt, u8aConcat } from '@polkadot/util';
import { bnToU8a, hasBigInt, u8aConcat } from '@polkadot/util';
import { isReady, secp256k1Sign as wasm } from '@polkadot/wasm-crypto';
import { BN_BE_256_OPTS } from '../bn';
@@ -17,7 +17,9 @@ import { hasher } from './hasher';
* @description Returns message signature of `message`, using the supplied pair
*/
export function secp256k1Sign (message: Uint8Array | string, { secretKey }: Partial<Keypair>, hashType: HashType = 'blake2', onlyJs?: boolean): Uint8Array {
assert(secretKey?.length === 32, 'Expected valid secp256k1 secretKey, 32-bytes');
if (secretKey?.length !== 32) {
throw new Error('Expected valid secp256k1 secretKey, 32-bytes');
}
const data = hasher(hashType, message, onlyJs);
@@ -1,7 +1,7 @@
// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import '../cryptoInit';
import '../bundleInit';
import { stringToU8a } from '@polkadot/util';
+18 -7
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { _0n, assert, BN, bnToU8a, hasBigInt, isU8a, nToU8a, u8aToBigInt } from '@polkadot/util';
import { _0n, BN, bnToU8a, hasBigInt, isU8a, nToU8a, u8aToBigInt } from '@polkadot/util';
import { BigInt } from '@polkadot/x-bigint';
import { BN_BE_256_OPTS, BN_BE_OPTS } from '../bn';
@@ -15,7 +15,9 @@ const N_BN = new BN(N, 'hex');
function addBi (seckey: Uint8Array, tweak: Uint8Array): Uint8Array {
let res = u8aToBigInt(tweak, BN_BE_OPTS);
assert(res < N_BI, 'Tweak parameter is out of range');
if (res >= N_BI) {
throw new Error('Tweak parameter is out of range');
}
res += u8aToBigInt(seckey, BN_BE_OPTS);
@@ -23,7 +25,9 @@ function addBi (seckey: Uint8Array, tweak: Uint8Array): Uint8Array {
res -= N_BI;
}
assert(res !== _0n, 'Invalid resulting private key');
if (res === _0n) {
throw new Error('Invalid resulting private key');
}
return nToU8a(res, BN_BE_256_OPTS);
}
@@ -31,7 +35,9 @@ function addBi (seckey: Uint8Array, tweak: Uint8Array): Uint8Array {
function addBn (seckey: Uint8Array, tweak: Uint8Array): Uint8Array {
const res = new BN(tweak);
assert(res.cmp(N_BN) < 0, 'Tweak parameter is out of range');
if (res.cmp(N_BN) >= 0) {
throw new Error('Tweak parameter is out of range');
}
res.iadd(new BN(seckey));
@@ -39,14 +45,19 @@ function addBn (seckey: Uint8Array, tweak: Uint8Array): Uint8Array {
res.isub(N_BN);
}
assert(!res.isZero(), 'Invalid resulting private key');
if (res.isZero()) {
throw new Error('Invalid resulting private key');
}
return bnToU8a(res, BN_BE_256_OPTS);
}
export function secp256k1PrivateKeyTweakAdd (seckey: Uint8Array, tweak: Uint8Array, onlyBn?: boolean): Uint8Array {
assert(isU8a(seckey) && seckey.length === 32, 'Expected seckey to be an Uint8Array with length 32');
assert(isU8a(tweak) && tweak.length === 32, 'Expected tweak to be an Uint8Array with length 32');
if (!isU8a(seckey) || seckey.length !== 32) {
throw new Error('Expected seckey to be an Uint8Array with length 32');
} else if (!isU8a(tweak) || tweak.length !== 32) {
throw new Error('Expected tweak to be an Uint8Array with length 32');
}
return !hasBigInt || onlyBn
? addBn(seckey, tweak)
@@ -1,7 +1,7 @@
// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import '../cryptoInit';
import '../bundleInit';
import { hexToU8a } from '@polkadot/util';
import { waitReady } from '@polkadot/wasm-crypto';
+4 -2
View File
@@ -4,7 +4,7 @@
import type { HexString } from '@polkadot/util/types';
import type { HashType } from './types';
import { assert, u8aEq, u8aToU8a } from '@polkadot/util';
import { u8aEq, u8aToU8a } from '@polkadot/util';
import { hasher } from './hasher';
import { secp256k1Recover } from './recover';
@@ -16,7 +16,9 @@ import { secp256k1Recover } from './recover';
export function secp256k1Verify (msgHash: HexString | Uint8Array | string, signature: HexString | Uint8Array | string, address: HexString | Uint8Array | string, hashType: HashType = 'blake2', onlyJs?: boolean): boolean {
const sig = u8aToU8a(signature);
assert(sig.length === 65, `Expected signature with 65 bytes, ${sig.length} found instead`);
if (sig.length !== 65) {
throw new Error(`Expected signature with 65 bytes, ${sig.length} found instead`);
}
const publicKey = secp256k1Recover(hasher(hashType, msgHash), sig, sig[64], hashType, onlyJs);
const signerAddr = hasher(hashType, publicKey, onlyJs);
+10 -4
View File
@@ -4,7 +4,7 @@
import type { HexString } from '@polkadot/util/types';
import type { KeypairType, VerifyResult } from '../types';
import { assert, u8aIsWrapped, u8aToU8a, u8aUnwrapBytes, u8aWrapBytes } from '@polkadot/util';
import { u8aIsWrapped, u8aToU8a, u8aUnwrapBytes, u8aWrapBytes } from '@polkadot/util';
import { decodeAddress } from '../address/decode';
import { ed25519Verify } from '../ed25519/verify';
@@ -57,7 +57,9 @@ function verifyDetect (result: VerifyResult, { message, publicKey, signature }:
}
function verifyMultisig (result: VerifyResult, { message, publicKey, signature }: VerifyInput): VerifyResult {
assert([0, 1, 2].includes(signature[0]), () => `Unknown crypto type, expected signature prefix [0..2], found ${signature[0]}`);
if (![0, 1, 2].includes(signature[0])) {
throw new Error(`Unknown crypto type, expected signature prefix [0..2], found ${signature[0]}`);
}
const type = CRYPTO_TYPES[signature[0]] || 'none';
@@ -67,7 +69,9 @@ function verifyMultisig (result: VerifyResult, { message, publicKey, signature }
result.isValid = {
ecdsa: () => verifyDetect(result, { message, publicKey, signature: signature.subarray(1) }, VERIFIERS_ECDSA).isValid,
ed25519: () => ed25519Verify(message, signature.subarray(1), publicKey),
none: () => { throw Error('no verify for `none` crypto type'); },
none: () => {
throw Error('no verify for `none` crypto type');
},
sr25519: () => sr25519Verify(message, signature.subarray(1), publicKey)
}[type]();
} catch (error) {
@@ -86,7 +90,9 @@ function getVerifyFn (signature: Uint8Array): VerifyFn {
export function signatureVerify (message: HexString | Uint8Array | string, signature: HexString | Uint8Array | string, addressOrPublicKey: HexString | Uint8Array | string): VerifyResult {
const signatureU8a = u8aToU8a(signature);
assert([64, 65, 66].includes(signatureU8a.length), () => `Invalid signature length, expected [64..66] bytes, found ${signatureU8a.length}`);
if (![64, 65, 66].includes(signatureU8a.length)) {
throw new Error(`Invalid signature length, expected [64..66] bytes, found ${signatureU8a.length}`);
}
const publicKey = decodeAddress(addressOrPublicKey);
const input = { message: u8aToU8a(message), publicKey, signature: signatureU8a };
@@ -3,7 +3,7 @@
import type { HexString } from '@polkadot/util/types';
import { assert, u8aToU8a } from '@polkadot/util';
import { u8aToU8a } from '@polkadot/util';
import { sr25519Agree } from '@polkadot/wasm-crypto';
/**
@@ -14,8 +14,11 @@ export function sr25519Agreement (secretKey: HexString | Uint8Array | string, pu
const secretKeyU8a = u8aToU8a(secretKey);
const publicKeyU8a = u8aToU8a(publicKey);
assert(publicKeyU8a.length === 32, () => `Invalid publicKey, received ${publicKeyU8a.length} bytes, expected 32`);
assert(secretKeyU8a.length === 64, () => `Invalid secretKey, received ${secretKeyU8a.length} bytes, expected 64`);
if (publicKeyU8a.length !== 32) {
throw new Error(`Invalid publicKey, received ${publicKeyU8a.length} bytes, expected 32`);
} else if (secretKeyU8a.length !== 64) {
throw new Error(`Invalid secretKey, received ${secretKeyU8a.length} bytes, expected 64`);
}
return sr25519Agree(publicKeyU8a, secretKeyU8a);
}
+4 -2
View File
@@ -3,14 +3,16 @@
import type { Keypair } from '../types';
import { assert, isU8a } from '@polkadot/util';
import { isU8a } from '@polkadot/util';
import { sr25519PairFromU8a } from './pair/fromU8a';
import { sr25519KeypairToU8a } from './pair/toU8a';
export function createDeriveFn (derive: (pair: Uint8Array, cc: Uint8Array) => Uint8Array): (keypair: Keypair, chainCode: Uint8Array) => Keypair {
return (keypair: Keypair, chainCode: Uint8Array): Keypair => {
assert(isU8a(chainCode) && chainCode.length === 32, 'Invalid chainCode passed to derive');
if (!isU8a(chainCode) || chainCode.length !== 32) {
throw new Error('Invalid chainCode passed to derive');
}
return sr25519PairFromU8a(
derive(sr25519KeypairToU8a(keypair), chainCode)
@@ -3,14 +3,17 @@
import type { HexString } from '@polkadot/util/types';
import { assert, isU8a, u8aToU8a } from '@polkadot/util';
import { isU8a, u8aToU8a } from '@polkadot/util';
import { sr25519DerivePublicSoft } from '@polkadot/wasm-crypto';
export function sr25519DerivePublic (publicKey: HexString | Uint8Array | string, chainCode: Uint8Array): Uint8Array {
const publicKeyU8a = u8aToU8a(publicKey);
assert(isU8a(chainCode) && chainCode.length === 32, 'Invalid chainCode passed to derive');
assert(publicKeyU8a.length === 32, () => `Invalid publicKey, received ${publicKeyU8a.length} bytes, expected 32`);
if (!isU8a(chainCode) || chainCode.length !== 32) {
throw new Error('Invalid chainCode passed to derive');
} else if (publicKeyU8a.length !== 32) {
throw new Error(`Invalid publicKey, received ${publicKeyU8a.length} bytes, expected 32`);
}
return sr25519DerivePublicSoft(publicKeyU8a, chainCode);
}
@@ -4,7 +4,7 @@
import type { HexString } from '@polkadot/util/types';
import type { Keypair } from '../../types';
import { assert, u8aToU8a } from '@polkadot/util';
import { u8aToU8a } from '@polkadot/util';
import { sr25519KeypairFromSeed } from '@polkadot/wasm-crypto';
import { sr25519PairFromU8a } from './fromU8a';
@@ -16,7 +16,9 @@ import { sr25519PairFromU8a } from './fromU8a';
export function sr25519PairFromSeed (seed: HexString | Uint8Array | string): Keypair {
const seedU8a = u8aToU8a(seed);
assert(seedU8a.length === 32, () => `Expected a seed matching 32 bytes, found ${seedU8a.length}`);
if (seedU8a.length !== 32) {
throw new Error(`Expected a seed matching 32 bytes, found ${seedU8a.length}`);
}
return sr25519PairFromU8a(
sr25519KeypairFromSeed(seedU8a)

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