Compare commits

..
82 Commits
Author SHA1 Message Date
github-actions[bot] 44f7443d13 [CI Skip] release/stable 13.0.2
skip-checks: true
2024-07-13 00:18:37 +00:00
Tarik Gul 2b800577a5 13.0.2 (#1929)
* 13.0.2

* credit
2024-07-13 03:12:51 +03:00
github-actions[bot] c9ca01e96b [CI Skip] bump/beta 13.0.2-0-x
skip-checks: true
2024-07-12 23:22:45 +00:00
Lovish Arora ca93f3337f Add peaq support for ledger (#1928) 2024-07-12 19:16:57 -04:00
github-actions[bot] 557a681fe9 [CI Skip] release/stable 13.0.1
skip-checks: true
2024-07-12 17:51:16 +00:00
Tarik Gul 97b1fdf089 13.0.1 (#1927)
* 13.0.1

* Fix changelog
2024-07-12 13:45:20 -04:00
github-actions[bot] 9971684972 [CI Skip] bump/beta 12.6.3-13-x
skip-checks: true
2024-07-12 16:29:52 +00:00
Tarik Gul 04ab9dd77d Bump yarn to 4.3.1 (#1926) 2024-07-12 19:23:58 +03:00
github-actions[bot] b2bf9f4d53 [CI Skip] bump/beta 12.6.3-12-x
skip-checks: true
2024-07-12 15:59:29 +00:00
Tarik Gulandbee344 4d629fd8ce Add support for latest ledger app (#1925)
* Update ledger deps

* Update code to fit within interface

* additional changes

* fix import

* Get a working version with ledger

* Add metaUrl

* Ensure no breaking changes by keeping legacy Ledger class

* Update to include signWithMetadata

* lint

* Ensure error code is part of the message

* Update interface

* Fix address

* remove wrapped bytes for sign with metadata

* rolled back derivation path changes

* Update naming

* Fix inline docs

* Deprecate Ledger

---------

Co-authored-by: bee344 <alberto.penayo@parity.io>
2024-07-12 11:53:35 -04:00
github-actions[bot] 37fa211fdb [CI Skip] bump/beta 12.6.3-11-x
skip-checks: true
2024-05-14 00:45:17 +00:00
Tarik Gul a4a9a3dead Bump yarn to 4.2.2 (#1922) 2024-05-14 03:39:22 +03:00
github-actions[bot] e025195a9b [CI Skip] bump/beta 12.6.3-10-x
skip-checks: true
2024-05-14 00:21:30 +00:00
Tarik Gul 744e4c72d5 Bump @polkadot/dev to 0.79.1 w/ topo sort (#1921) 2024-05-14 03:15:44 +03:00
github-actions[bot] f23f0944a8 [CI Skip] bump/beta 12.6.3-9-x
skip-checks: true
2024-04-08 17:31:00 +00:00
Tarik Gul 6e28612f34 Update ci to checkout and setup_node v4 (#1918) 2024-04-08 20:25:08 +03:00
github-actions[bot] 57b0601f9b [CI Skip] bump/beta 12.6.3-8-x
skip-checks: true
2024-03-26 01:12:02 +00:00
Tarik Gul ee9d76639c Bump yarn to 4.1.1 (#1915) 2024-03-26 03:06:57 +02:00
github-actions[bot] db25938ad7 [CI Skip] bump/beta 12.6.3-7-x
skip-checks: true
2024-02-17 14:09:08 +00:00
Tarik Gul 175b0ef307 chore(yarn): update yarn to 4.1.0 (#1913) 2024-02-17 16:03:52 +02:00
github-actions[bot] 944c50d015 [CI Skip] bump/beta 12.6.3-6-x
skip-checks: true
2024-02-17 02:04:09 +00:00
Tarik Gul 191db8ea10 ci: add user (TarikGul) to auto-approve (#1914) 2024-02-17 03:58:55 +02:00
github-actions[bot] 095db555ba [CI Skip] bump/beta 12.6.3-5-x
skip-checks: true
2024-01-24 06:17:12 +00:00
Jaco a23989ca9d Bump deps (#1912) 2024-01-24 08:11:46 +02:00
github-actions[bot] a82ebdf6f9 [CI Skip] bump/beta 12.6.3-4-x
skip-checks: true
2024-01-09 07:35:28 +00:00
Jaco e6fbf01aa1 Comments around pair encode/decode 1-3 (#1910)
* Comments around pair generation 1-3

* Encoding comments
2024-01-09 09:30:21 +02:00
github-actions[bot] 00876f0b64 [CI Skip] bump/beta 12.6.3-3-x
skip-checks: true
2024-01-08 13:13:36 +00:00
Jaco 22aab4a4e6 2024 (#1909) 2024-01-08 15:08:27 +02:00
github-actions[bot] 6971012f4a [CI Skip] bump/beta 12.6.3-2-x
skip-checks: true
2023-12-19 10:31:18 +00:00
Jaco fc217b66ce Bump dev (#1905) 2023-12-19 12:26:12 +02:00
github-actions[bot] fb42e8f7ee [CI Skip] bump/beta 12.6.3-1-x
skip-checks: true
2023-12-19 08:48:01 +00:00
Jaco b4e3ed0a42 Bump dev w/ sideEffects adjustments (#1904) 2023-12-19 10:42:57 +02:00
github-actions[bot] e1218157a3 [CI Skip] bump/beta 12.6.3-0-x
skip-checks: true
2023-12-19 08:20:52 +00:00
Jaco 2dc171639d Bump dev w/ detectPackage adjustments (#1903)
* Bump dev w/ detectPackage adjustments

* Fix spec import

* Adjust line flow
2023-12-19 10:15:38 +02:00
github-actions[bot] 4da1e8ba62 [CI Skip] release/stable 12.6.2
skip-checks: true
2023-12-18 09:47:28 +00:00
Jaco d498ad4424 12.6.2 (#1902) 2023-12-18 11:42:21 +02:00
github-actions[bot] 9a9650261b [CI Skip] bump/beta 12.6.2-1-x
skip-checks: true
2023-12-18 08:35:49 +00:00
Jaco 6dfff0d40c Bump yarn berry, bump deps (#1901) 2023-12-18 10:30:39 +02:00
github-actions[bot] 0770bed5fd [CI Skip] bump/beta 12.6.2-0-x
skip-checks: true
2023-12-12 05:39:14 +00:00
Jaco 6fde7bc5a0 Bump dev deps (w/ TS 5.3.3.) (#1900)
* Bump dev deps (w/ TS 5.3.3.)

* Deno override to any

* Exdplicit around esm.sh work-around
2023-12-12 07:33:59 +02:00
github-actions[bot] f55e88c116 [CI Skip] release/stable 12.6.1
skip-checks: true
2023-11-18 05:02:49 +00:00
Jaco abd4cfdd1f 12.6.1 (#1897) 2023-11-18 06:57:34 +02:00
github-actions[bot] f261ea2924 [CI Skip] bump/beta 12.5.2-10-x
skip-checks: true
2023-11-17 19:50:01 +00:00
Jaco f14d2681b1 Fix build for esm/cjs warning additions (#1896) 2023-11-17 21:44:51 +02:00
github-actions[bot] b9be030f12 [CI Skip] bump/beta 12.5.2-9-x
skip-checks: true
2023-11-17 19:14:46 +00:00
Chris bc103d9479 Get rid of warnings for dual esm and cjs packages of the same version (#1890)
* Get rid of warnings for dual esm and cjs packages of the same version

* Add command line flag for suppressing ESM CJS warnings when all packages are of the same version
2023-11-17 21:09:29 +02:00
github-actions[bot] c76c754741 [CI Skip] bump/beta 12.5.2-8-x
skip-checks: true
2023-11-17 14:40:49 +00:00
Jaco bd21e730b3 Adjust isRiscV helper to check for PVM\0 bytes (#1895)
* Adjust `isRiscV` helper to check for `PVM\0` bytes

* Also check for ELF

* Adjust tests

* Update description
2023-11-17 16:35:32 +02:00
github-actions[bot] a2cfdb8ca7 [CI Skip] bump/beta 12.5.2-7-x
skip-checks: true
2023-11-17 10:16:21 +00:00
Jaco 4857de9f38 Bump wasm + slight adj. to logger process.env (#1894)
* Bump wasm + slight adj. to logger process.env

* Adjust for Deno

* Adjust globalThis definition

* Adjust
2023-11-17 12:10:53 +02:00
github-actions[bot] d525b8c92d [CI Skip] bump/beta 12.5.2-6-x
skip-checks: true
2023-11-17 08:40:25 +00:00
Jaco 2afbce2652 Bump dev deps, drop Node 16 (#1892)
* Bump dev deps, drop Node 16

* Rebuild networks
2023-11-17 10:35:10 +02:00
github-actions[bot] 3c7525649e [CI Skip] bump/beta 12.5.2-5-x
skip-checks: true
2023-10-23 08:36:24 +00:00
Jaco 6ebcc2dd6d Bump dev deps (#1888) 2023-10-23 11:30:02 +03:00
github-actions[bot] 120438d7e6 [CI Skip] bump/beta 12.5.2-4-x
skip-checks: true
2023-10-15 10:50:18 +00:00
Jaco f5f1bc6f4f Bump TS (#1887) 2023-10-15 13:43:48 +03:00
github-actions[bot] 28d5302fd6 [CI Skip] bump/beta 12.5.2-3-x
skip-checks: true
2023-10-11 08:58:45 +00:00
Jaco 773cc29b11 Bump deps (#1886) 2023-10-11 11:51:04 +03:00
github-actions[bot] a20c7eb2e5 [CI Skip] bump/beta 12.5.2-2-x
skip-checks: true
2023-10-03 06:07:45 +00:00
Jaco 487d0d9a57 Bump dev deps (#1884)
* Bump dev deps

* CHANGELOG
2023-10-03 09:01:15 +03:00
github-actions[bot] a910e9ce6f [CI Skip] bump/beta 12.5.2-1-x
skip-checks: true
2023-09-23 17:44:23 +00:00
Jaco 1062de7aa8 Bump deps (#1883) 2023-09-23 20:36:41 +03:00
github-actions[bot] 4cabc67b24 [CI Skip] bump/beta 12.5.2-0-x
skip-checks: true
2023-09-23 14:03:03 +00:00
Yaroslav Bolyukin 13bc84e30b Add quartz support for ledger, update unique slip-0044 identifier (#1882)
* build: bump ledger-substrate dependency

* fix: update slip-0044 id for unique

* feat(ledger): add quartz support

* build: update yarn.lock
2023-09-23 16:56:57 +03:00
github-actions[bot] 67fe7738d8 [CI Skip] release/stable 12.5.1
skip-checks: true
2023-09-15 05:53:02 +00:00
Jaco 13c6b4e553 12.5.1 (#1881) 2023-09-15 08:45:57 +03:00
github-actions[bot] 9306f9db92 [CI Skip] bump/beta 12.4.3-7-x
skip-checks: true
2023-09-14 18:24:39 +00:00
Leonardo Custodio 62a30f258e Ledger support (#1879) 2023-09-14 21:18:10 +03:00
github-actions[bot] 81609aba59 [CI Skip] bump/beta 12.4.3-6-x
skip-checks: true
2023-09-14 05:19:48 +00:00
Jaco 301d73d13f Bump deps (w/ ledger) (#1880) 2023-09-14 08:13:48 +03:00
github-actions[bot] 92abf4463d [CI Skip] bump/beta 12.4.3-5-x
skip-checks: true
2023-09-06 10:02:03 +00:00
peetzweg/ b018f78b77 adds isRiscV guard function similar to isWasm (#1878) 2023-09-06 12:55:36 +03:00
github-actions[bot] 608117f04a [CI Skip] bump/beta 12.4.3-4-x
skip-checks: true
2023-08-31 05:13:47 +00:00
Jaco 2ac00565b0 Bump deps (#1877) 2023-08-31 08:07:35 +03:00
github-actions[bot] 673a59af58 [CI Skip] bump/beta 12.4.3-3-x
skip-checks: true
2023-08-30 09:13:53 +00:00
Jaco aa394fe7cd Explicit note for test genesis (standalone or para) (#1876)
* Explicit note for test genesis (standalone or para)

* Add test for testnet exclusions

* Extract keys
2023-08-30 12:07:29 +03:00
github-actions[bot] ee7f2cc7f5 [CI Skip] bump/beta 12.4.3-2-x
skip-checks: true
2023-08-30 08:32:15 +00:00
Jaco da6efc821e Add additional comments on type interfaces (#1875) 2023-08-30 11:25:10 +03:00
github-actions[bot] a3b884d437 [CI Skip] bump/beta 12.4.3-1-x
skip-checks: true
2023-08-30 06:37:14 +00:00
Jaco 560c054750 Bump dev deps (#1874) 2023-08-30 09:31:15 +03:00
github-actions[bot] 09621d0010 [CI Skip] bump/beta 12.4.3-0-x
skip-checks: true
2023-08-24 05:17:05 +00:00
Jaco 37a81d9594 Bump deps (noble hashes/curves) (#1873)
* Bump deps (noble hashes/curves)

* Adjust dep range
2023-08-24 08:10:54 +03:00
642 changed files with 9137 additions and 6290 deletions
+1 -1
View File
@@ -11,6 +11,6 @@ jobs:
steps:
- uses: jacogr/action-approve@795afd1dd096a2071d7ec98740661af4e853b7da
with:
authors: jacogr
authors: jacogr, TarikGul
labels: -auto
token: ${{ secrets.GH_PAT_BOT }}
+2 -2
View File
@@ -12,8 +12,8 @@ jobs:
YARN_ENABLE_SCRIPTS: false
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- uses: denoland/setup-deno@v1
+2 -2
View File
@@ -18,11 +18,11 @@ jobs:
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT_BOT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT_BOT }}
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: ${{ matrix.step }}
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util authors & contributors
// Copyright 2017-2024 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = require('@polkadot/dev/config/prettier.cjs');
View File
File diff suppressed because one or more lines are too long
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
+894
View File
File diff suppressed because one or more lines are too long
+5 -8
View File
@@ -1,18 +1,15 @@
compressionLevel: mixed
enableGlobalCache: false
enableImmutableInstalls: false
enableProgressBars: false
logFilters:
# Discard any "cannot be found in cache" messages
- code: YN0013
level: discard
nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
yarnPath: .yarn/releases/yarn-3.2.0.cjs
yarnPath: .yarn/releases/yarn-4.3.1.cjs
+60
View File
@@ -1,5 +1,65 @@
# CHANGELOG
## 13.0.2 July 12, 2024
Contributed:
- Add peaq support for ledger (Thanks to https://github.com/lavish0000)
## 13.0.1 July 12, 2024
Breaking Changes:
- Add Support for latest Ledger App
- This deprecates `class Ledger` in favor of `class LedgerGeneric`
- More info in the following PR ([#1925](https://github.com/polkadot-js/common/pull/1925))
Changes:
- Bump dev to 0.79.1
- Comments around pair encode/decode 1-3
- Bump ws, react-native, ss58Registry
- Bump yarn to 4.3.1
- Update CI to checkout and setup_node v4
## 12.6.2 Dec 18, 2023
Changes:
- Update to latest `@polkadot/wasm-crypto`
- Upgrade dependencies to latest versions
## 12.6.1 Nov 18, 2023
Contributed:
- Ledger support for Quartz (Thanks to https://github.com/CertainLach)
- Add flag to disable same-version esm/cjs warnings (Thanks to https://github.com/forgetso)
Changes:
- Adjust logger check for `process.env`
- Adjust `isRiscV` helper to check for `PVM\0` bytes
- Drop support for Node 16 (EOL 11 Sep 2023)
- Upgrade dependencies to latest stable versions
## 12.5.1 Sep 15, 2023
Contributed:
- Add `isRiskV` helper (Thanks to https://github.com/peetzweg)
- Ledger support for Enjin & Matrixchain (Thanks to https://github.com/leonardocustodio)
Changes:
- Expand interface type comments (assists in-editor helpers)
- Upgrade dependencies to latest stable versions
## 12.4.2 Aug 23, 2023
Changes:
+7 -1
View File
@@ -1,5 +1,6 @@
1648 Jaco 12.4.2 (#1872)
1674 Jaco Bump deps (#1912)
13 Carlo Sala feat(networks): add zeitgeist Ledger support (#1840)
10 Tarik Gul 13.0.2 (#1929)
9 Antoine Estienne Add eth uri keyring test (#1291)
6 Amaury Martiny Add tests from Rust (#283)
5 Jakub Pánik Add HydraDX parachain to genesis (#1583)
@@ -25,6 +26,7 @@
1 Brad Larson [FIX] Adjust error message (#646)
1 Cameron Fairchild Add bittensor details (#1783)
1 Carlos Medeiros add hydradx to knownLedger (#1647)
1 Chris Get rid of warnings for dual esm and cjs packages of the same version (#1890)
1 Eliott Teissonniere add nodle ledger specs (#1089)
1 Guilane DENGUIR feat(VTB): Added support for VTB blockchain (#1651)
1 h4x3rotab Throws an error when signing with a locked keypair (#578)
@@ -36,13 +38,16 @@
1 JesseAbram added check if valid address to docs (#440)
1 joe petrowski Add example for multisig address creation (#590)
1 kaelnew add ledger support for stafi (#1569)
1 Leonardo Custodio Ledger support (#1879)
1 Lezek123 logger - wildcard include/exclude with DEBUG env (#932)
1 Lovish Arora Add peaq support for ledger (#1928)
1 Mario Neises remove redudant export (#257)
1 Miguel Hervas Add CFG Ledger Support (#1057)
1 Mikhail Fedosov feat: add 3dpass network (#1769)
1 Mohsan Riaz Add Ternoa for ledger hardware support (#1711)
1 nahuseyoum Reserving 65 for Aventus based on the new extended range (#871)
1 Nantian add acala ledger config (#1485)
1 peetzweg/ adds `isRiscV` guard function similar to isWasm (#1878)
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)
@@ -56,4 +61,5 @@
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 Yaroslav Bolyukin Add quartz support for ledger, update unique slip-0044 identifier (#1882)
1 Yuri Extra check for process for browser bundles (#923)
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util authors & contributors
// Copyright 2017-2024 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import baseConfig from '@polkadot/dev/config/eslint';
+7 -7
View File
@@ -6,7 +6,7 @@
},
"homepage": "https://github.com/polkadot-js/common#readme",
"license": "Apache-2.0",
"packageManager": "yarn@3.2.0",
"packageManager": "yarn@4.3.1",
"private": true,
"repository": {
"type": "git",
@@ -14,10 +14,10 @@
},
"sideEffects": false,
"type": "module",
"version": "12.4.2",
"version": "13.0.2",
"versions": {
"git": "12.4.2",
"npm": "12.4.2"
"git": "13.0.2",
"npm": "13.0.2"
},
"workspaces": [
"packages/*"
@@ -37,10 +37,10 @@
"test:one": "polkadot-dev-run-test --env browser"
},
"devDependencies": {
"@polkadot/dev": "^0.76.18",
"@types/node": "^20.5.3"
"@polkadot/dev": "^0.79.1",
"@types/node": "^20.11.5"
},
"resolutions": {
"typescript": "^5.1.6"
"typescript": "^5.3.3"
}
}
+7 -7
View File
@@ -2,7 +2,7 @@
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/common/issues",
"engines": {
"node": ">=16"
"node": ">=18"
},
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/hw-ledger-transports#readme",
"license": "Apache-2.0",
@@ -14,18 +14,18 @@
},
"sideEffects": false,
"type": "module",
"version": "12.4.2",
"version": "13.0.2",
"browser": "browser.js",
"main": "node.js",
"react-native": "react-native.js",
"dependencies": {
"@ledgerhq/hw-transport": "^6.28.8",
"@ledgerhq/hw-transport-webhid": "^6.27.19",
"@ledgerhq/hw-transport-webusb": "^6.27.19",
"@polkadot/util": "12.4.2",
"@ledgerhq/hw-transport": "^6.31.0",
"@ledgerhq/hw-transport-webhid": "^6.29.0",
"@ledgerhq/hw-transport-webusb": "^6.29.0",
"@polkadot/util": "13.0.2",
"tslib": "^2.6.2"
},
"optionalDependencies": {
"@ledgerhq/hw-transport-node-hid-singleton": "^6.28.18"
"@ledgerhq/hw-transport-node-hid-singleton": "^6.31.1"
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import LedgerHid from '@ledgerhq/hw-transport-webhid';
@@ -1,4 +0,0 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
export default [];
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { createDefs } from './util.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './empty.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import LedgerHid from '@ledgerhq/hw-transport-node-hid-singleton';
@@ -1,11 +1,11 @@
// Copyright 2017-2023 @polkadot/hw-ledger-transports authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger-transports authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
// (packageInfo imports will be kept as-is, user-editable)
import { detectPackage } from '@polkadot/util';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others);
detectPackage(packageInfo, null, []);
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/hw-ledger-transports authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger-transports authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/hw-ledger-transports', path: 'auto', type: 'auto', version: '12.4.2' };
export const packageInfo = { name: '@polkadot/hw-ledger-transports', path: 'auto', type: 'auto', version: '13.0.2' };
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './empty.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
// CJS, so we use import * syntax
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Transport, TransportDef, TransportType } from './types.js';
+7 -7
View File
@@ -2,7 +2,7 @@
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/common/issues",
"engines": {
"node": ">=16"
"node": ">=18"
},
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/hw-ledger#readme",
"license": "Apache-2.0",
@@ -13,16 +13,16 @@
"url": "https://github.com/polkadot-js/common.git"
},
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
"./packageDetect.js",
"./packageDetect.cjs"
],
"type": "module",
"version": "12.4.2",
"version": "13.0.2",
"main": "index.js",
"dependencies": {
"@polkadot/hw-ledger-transports": "12.4.2",
"@polkadot/util": "12.4.2",
"@zondax/ledger-substrate": "^0.41.1",
"@polkadot/hw-ledger-transports": "13.0.2",
"@polkadot/util": "13.0.2",
"@zondax/ledger-substrate": "0.44.7",
"tslib": "^2.6.2"
}
}
+144
View File
@@ -0,0 +1,144 @@
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { SubstrateApp } from '@zondax/ledger-substrate';
import type { TransportDef, TransportType } from '@polkadot/hw-ledger-transports/types';
import type { AccountOptions, LedgerAddress, LedgerSignature, LedgerVersion } from './types.js';
import { newSubstrateApp } from '@zondax/ledger-substrate';
import { transports } from '@polkadot/hw-ledger-transports';
import { hexAddPrefix, u8aToBuffer, u8aWrapBytes } from '@polkadot/util';
import { LEDGER_DEFAULT_ACCOUNT, LEDGER_DEFAULT_CHANGE, LEDGER_DEFAULT_INDEX, LEDGER_SUCCESS_CODE } from './constants.js';
import { ledgerApps } from './defaults.js';
export { packageInfo } from './packageInfo.js';
type Chain = keyof typeof ledgerApps;
type WrappedResult = Awaited<ReturnType<SubstrateApp['getAddress' | 'getVersion' | 'sign']>>;
/** @internal Wraps a SubstrateApp call, checking the result for any errors which result in a rejection */
async function wrapError <T extends WrappedResult> (promise: Promise<T>): Promise<T> {
const result = await promise;
if (result.return_code !== LEDGER_SUCCESS_CODE) {
throw new Error(result.error_message);
}
return result;
}
/** @internal Wraps a sign/signRaw call and returns the associated signature */
function sign (method: 'sign' | 'signRaw', message: Uint8Array, accountOffset = 0, addressOffset = 0, { account = LEDGER_DEFAULT_ACCOUNT, addressIndex = LEDGER_DEFAULT_INDEX, change = LEDGER_DEFAULT_CHANGE }: Partial<AccountOptions> = {}): (app: SubstrateApp) => Promise<LedgerSignature> {
return async (app: SubstrateApp): Promise<LedgerSignature> => {
const { signature } = await wrapError(app[method](account + accountOffset, change, addressIndex + addressOffset, u8aToBuffer(message)));
return {
signature: hexAddPrefix(signature.toString('hex'))
};
};
}
/**
* @name Ledger
*
* @description
* Legacy wrapper for a ledger app -
* - it connects automatically on use, creating an underlying interface as required
* - Promises reject with errors (unwrapped errors from @zondax/ledger-substrate)
* @deprecated Use LedgerGeneric for up to date integration with ledger
*/
export class Ledger {
readonly #ledgerName: string;
readonly #transportDef: TransportDef;
#app: SubstrateApp | null = null;
constructor (transport: TransportType, chain: Chain) {
const ledgerName = ledgerApps[chain];
const transportDef = transports.find(({ type }) => type === transport);
if (!ledgerName) {
throw new Error(`Unsupported Ledger chain ${chain}`);
} else if (!transportDef) {
throw new Error(`Unsupported Ledger transport ${transport}`);
}
this.#ledgerName = ledgerName;
this.#transportDef = transportDef;
}
/**
* Returns the address associated with a specific account & address offset. Optionally
* asks for on-device confirmation
*/
public async getAddress (confirm = false, accountOffset = 0, addressOffset = 0, { account = LEDGER_DEFAULT_ACCOUNT, addressIndex = LEDGER_DEFAULT_INDEX, change = LEDGER_DEFAULT_CHANGE }: Partial<AccountOptions> = {}): Promise<LedgerAddress> {
return this.withApp(async (app: SubstrateApp): Promise<LedgerAddress> => {
const { address, pubKey } = await wrapError(app.getAddress(account + accountOffset, change, addressIndex + addressOffset, confirm));
return {
address,
publicKey: hexAddPrefix(pubKey)
};
});
}
/**
* Returns the version of the Ledger application on the device
*/
public async getVersion (): Promise<LedgerVersion> {
return this.withApp(async (app: SubstrateApp): Promise<LedgerVersion> => {
const { device_locked: isLocked, major, minor, patch, test_mode: isTestMode } = await wrapError(app.getVersion());
return {
isLocked,
isTestMode,
version: [major, minor, patch]
};
});
}
/**
* Signs a transaction on the Ledger device
*/
public async sign (message: Uint8Array, accountOffset?: number, addressOffset?: number, options?: Partial<AccountOptions>): Promise<LedgerSignature> {
return this.withApp(sign('sign', message, accountOffset, addressOffset, options));
}
/**
* Signs a message (non-transactional) on the Ledger device
*/
public async signRaw (message: Uint8Array, accountOffset?: number, addressOffset?: number, options?: Partial<AccountOptions>): Promise<LedgerSignature> {
return this.withApp(sign('signRaw', u8aWrapBytes(message), accountOffset, addressOffset, options));
}
/**
* @internal
*
* Returns a created SubstrateApp to perform operations against. Generally
* this is only used internally, to ensure consistent bahavior.
*/
async withApp <T> (fn: (app: SubstrateApp) => Promise<T>): Promise<T> {
try {
if (!this.#app) {
const transport = await this.#transportDef.create();
// We need this override for the actual type passing - the Deno environment
// is quite a bit stricter and it yields invalids between the two (specifically
// since we mangle the imports from .default in the types for CJS/ESM and between
// esm.sh versions this yields problematic outputs)
//
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
this.#app = newSubstrateApp(transport as any, this.#ledgerName);
}
return await fn(this.#app);
} catch (error) {
this.#app = null;
throw error;
}
}
}
+201
View File
@@ -0,0 +1,201 @@
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { TransportDef, TransportType } from '@polkadot/hw-ledger-transports/types';
import type { AccountOptionsGeneric, LedgerAddress, LedgerSignature, LedgerVersion } from './types.js';
import { PolkadotGenericApp } from '@zondax/ledger-substrate';
import { transports } from '@polkadot/hw-ledger-transports';
import { hexAddPrefix, u8aToBuffer, u8aWrapBytes } from '@polkadot/util';
import { ledgerApps } from './defaults.js';
export { packageInfo } from './packageInfo.js';
type Chain = keyof typeof ledgerApps;
type WrappedResult = Awaited<ReturnType<PolkadotGenericApp['getAddress' | 'getVersion' | 'sign' | 'signWithMetadata']>>;
// FIXME This type is a copy of the `class ResponseError`
// imported from `@zondax/ledger-js`. Happens because ledger-js includes
// circular dependencies. This is a hack to avoid versioning issues
// with Deno.
interface ResponseError {
errorMessage: string
returnCode: number
}
/** @internal Wraps a PolkadotGenericApp call, checking the result for any errors which result in a rejection */
async function wrapError <T extends WrappedResult> (promise: Promise<T>): Promise<T> {
let result: T;
try {
result = await promise;
} catch (e: unknown) {
// We check to see if the propogated error is the newer ResponseError type.
// The response code use to be part of the result, but with the latest breaking changes from 0.42.x
// the interface and it's types have completely changed.
if ((e as ResponseError).returnCode) {
throw new Error(`${(e as ResponseError).returnCode}: ${(e as ResponseError).errorMessage}`);
}
throw new Error((e as Error).message);
}
return result;
}
/** @internal Wraps a sign/signRaw call and returns the associated signature */
function sign (method: 'sign' | 'signRaw', message: Uint8Array, slip44: number, accountIndex = 0, addressOffset = 0): (app: PolkadotGenericApp) => Promise<LedgerSignature> {
const bip42Path = `m/44'/${slip44}'/${accountIndex}'/${0}'/${addressOffset}'`;
return async (app: PolkadotGenericApp): Promise<LedgerSignature> => {
const { signature } = await wrapError(app[method](bip42Path, u8aToBuffer(message)));
return {
signature: hexAddPrefix(signature.toString('hex'))
};
};
}
/** @internal Wraps a signWithMetadata call and returns the associated signature */
function signWithMetadata (message: Uint8Array, slip44: number, accountIndex = 0, addressOffset = 0, { metadata }: Partial<AccountOptionsGeneric> = {}): (app: PolkadotGenericApp) => Promise<LedgerSignature> {
const bip42Path = `m/44'/${slip44}'/${accountIndex}'/${0}'/${addressOffset}'`;
return async (app: PolkadotGenericApp): Promise<LedgerSignature> => {
if (!metadata) {
throw new Error('The metadata option must be present when using signWithMetadata');
}
const bufferMsg = Buffer.from(message);
const { signature } = await wrapError(app.signWithMetadata(bip42Path, bufferMsg, metadata));
return {
signature: hexAddPrefix(signature.toString('hex'))
};
};
}
/**
* @name Ledger
*
* @description
* A very basic wrapper for a ledger app -
* - it connects automatically on use, creating an underlying interface as required
* - Promises reject with errors (unwrapped errors from @zondax/ledger-substrate-js)
*/
export class LedgerGeneric {
readonly #transportDef: TransportDef;
readonly #slip44: number;
/**
* The chainId is represented by the chains token in all lowercase. Example: Polkadot -> dot
*/
readonly #chainId?: string;
/**
* The metaUrl is seen as a server url that the underlying `PolkadotGenericApp` will use to
* retrieve the signature given a tx blob, and a chainId. It is important to note that if you would like to avoid
* having any network calls made, use `signWithMetadata`, and avoid `sign`.
*/
readonly #metaUrl?: string;
#app: PolkadotGenericApp | null = null;
constructor (transport: TransportType, chain: Chain, slip44: number, chainId?: string, metaUrl?: string) {
const ledgerName = ledgerApps[chain];
const transportDef = transports.find(({ type }) => type === transport);
if (!ledgerName) {
throw new Error(`Unsupported Ledger chain ${chain}`);
} else if (!transportDef) {
throw new Error(`Unsupported Ledger transport ${transport}`);
}
this.#metaUrl = metaUrl;
this.#chainId = chainId;
this.#slip44 = slip44;
this.#transportDef = transportDef;
}
/**
* @description Returns the address associated with a specific account & address offset. Optionally
* asks for on-device confirmation
*/
public async getAddress (ss58Prefix: number, confirm = false, accountIndex = 0, addressOffset = 0): Promise<LedgerAddress> {
const bip42Path = `m/44'/${this.#slip44}'/${accountIndex}'/${0}'/${addressOffset}'`;
return this.withApp(async (app: PolkadotGenericApp): Promise<LedgerAddress> => {
const { address, pubKey } = await wrapError(app.getAddress(bip42Path, ss58Prefix, confirm));
return {
address,
publicKey: hexAddPrefix(pubKey)
};
});
}
/**
* @description Returns the version of the Ledger application on the device
*/
public async getVersion (): Promise<LedgerVersion> {
return this.withApp(async (app: PolkadotGenericApp): Promise<LedgerVersion> => {
const { deviceLocked: isLocked, major, minor, patch, testMode: isTestMode } = await wrapError(app.getVersion());
return {
isLocked: !!isLocked,
isTestMode: !!isTestMode,
version: [major || 0, minor || 0, patch || 0]
};
});
}
/**
* @description Signs a transaction on the Ledger device. This requires the LedgerGeneric class to be instantiated with `chainId`, and `metaUrl`
*/
public async sign (message: Uint8Array, accountIndex?: number, addressOffset?: number): Promise<LedgerSignature> {
return this.withApp(sign('sign', message, this.#slip44, accountIndex, addressOffset));
}
/**
* @description Signs a message (non-transactional) on the Ledger device
*/
public async signRaw (message: Uint8Array, accountIndex?: number, addressOffset?: number): Promise<LedgerSignature> {
return this.withApp(sign('signRaw', u8aWrapBytes(message), this.#slip44, accountIndex, addressOffset));
}
/**
* @description Signs a transaction on the ledger device provided some metadata.
*/
public async signWithMetadata (message: Uint8Array, accountIndex?: number, addressOffset?: number, options?: Partial<AccountOptionsGeneric>): Promise<LedgerSignature> {
return this.withApp(signWithMetadata(message, this.#slip44, accountIndex, addressOffset, options));
}
/**
* @internal
*
* Returns a created PolkadotGenericApp to perform operations against. Generally
* this is only used internally, to ensure consistent bahavior.
*/
async withApp <T> (fn: (app: PolkadotGenericApp) => Promise<T>): Promise<T> {
try {
if (!this.#app) {
const transport = await this.#transportDef.create();
// We need this override for the actual type passing - the Deno environment
// is quite a bit stricter and it yields invalids between the two (specifically
// since we mangle the imports from .default in the types for CJS/ESM and between
// esm.sh versions this yields problematic outputs)
//
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
this.#app = new PolkadotGenericApp(transport as any, this.#chainId, this.#metaUrl);
}
return await fn(this.#app);
} catch (error) {
this.#app = null;
throw error;
}
}
}
+6 -135
View File
@@ -1,137 +1,8 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { SubstrateApp } from '@zondax/ledger-substrate';
import type { TransportDef, TransportType } from '@polkadot/hw-ledger-transports/types';
import type { AccountOptions, LedgerAddress, LedgerSignature, LedgerVersion } from './types.js';
import { newSubstrateApp } from '@zondax/ledger-substrate';
import { transports } from '@polkadot/hw-ledger-transports';
import { hexAddPrefix, u8aToBuffer, u8aWrapBytes } from '@polkadot/util';
import { LEDGER_DEFAULT_ACCOUNT, LEDGER_DEFAULT_CHANGE, LEDGER_DEFAULT_INDEX, LEDGER_SUCCESS_CODE } from './constants.js';
import { ledgerApps } from './defaults.js';
export { packageInfo } from './packageInfo.js';
type Chain = keyof typeof ledgerApps;
type WrappedResult = Awaited<ReturnType<SubstrateApp['getAddress' | 'getVersion' | 'sign']>>;
/** @internal Wraps a SubstrateApp call, checking the result for any errors which result in a rejection */
async function wrapError <T extends WrappedResult> (promise: Promise<T>): Promise<T> {
const result = await promise;
if (result.return_code !== LEDGER_SUCCESS_CODE) {
throw new Error(result.error_message);
}
return result;
}
/** @internal Wraps a sign/signRaw call and returns the associated signature */
function sign (method: 'sign' | 'signRaw', message: Uint8Array, accountOffset = 0, addressOffset = 0, { account = LEDGER_DEFAULT_ACCOUNT, addressIndex = LEDGER_DEFAULT_INDEX, change = LEDGER_DEFAULT_CHANGE }: Partial<AccountOptions> = {}): (app: SubstrateApp) => Promise<LedgerSignature> {
return async (app: SubstrateApp): Promise<LedgerSignature> => {
const { signature } = await wrapError(app[method](account + accountOffset, change, addressIndex + addressOffset, u8aToBuffer(message)));
return {
signature: hexAddPrefix(signature.toString('hex'))
};
};
}
/**
* @name Ledger
*
* @description
* A very basic wrapper for a ledger app -
* - it connects automatically on use, creating an underlying interface as required
* - Promises reject with errors (unwrapped errors from @zondax/ledger-substrate)
*/
export class Ledger {
readonly #ledgerName: string;
readonly #transportDef: TransportDef;
#app: SubstrateApp | null = null;
constructor (transport: TransportType, chain: Chain) {
const ledgerName = ledgerApps[chain];
const transportDef = transports.find(({ type }) => type === transport);
if (!ledgerName) {
throw new Error(`Unsupported Ledger chain ${chain}`);
} else if (!transportDef) {
throw new Error(`Unsupported Ledger transport ${transport}`);
}
this.#ledgerName = ledgerName;
this.#transportDef = transportDef;
}
/**
* Returns the address associated with a specific account & address offset. Optionally
* asks for on-device confirmation
*/
public async getAddress (confirm = false, accountOffset = 0, addressOffset = 0, { account = LEDGER_DEFAULT_ACCOUNT, addressIndex = LEDGER_DEFAULT_INDEX, change = LEDGER_DEFAULT_CHANGE }: Partial<AccountOptions> = {}): Promise<LedgerAddress> {
return this.withApp(async (app: SubstrateApp): Promise<LedgerAddress> => {
const { address, pubKey } = await wrapError(app.getAddress(account + accountOffset, change, addressIndex + addressOffset, confirm));
return {
address,
publicKey: hexAddPrefix(pubKey)
};
});
}
/**
* Returns the version of the Ledger application on the device
*/
public async getVersion (): Promise<LedgerVersion> {
return this.withApp(async (app: SubstrateApp): Promise<LedgerVersion> => {
const { device_locked: isLocked, major, minor, patch, test_mode: isTestMode } = await wrapError(app.getVersion());
return {
isLocked,
isTestMode,
version: [major, minor, patch]
};
});
}
/**
* Signs a transaction on the Ledger device
*/
public async sign (message: Uint8Array, accountOffset?: number, addressOffset?: number, options?: Partial<AccountOptions>): Promise<LedgerSignature> {
return this.withApp(sign('sign', message, accountOffset, addressOffset, options));
}
/**
* Signs a message (non-transactional) on the Ledger device
*/
public async signRaw (message: Uint8Array, accountOffset?: number, addressOffset?: number, options?: Partial<AccountOptions>): Promise<LedgerSignature> {
return this.withApp(sign('signRaw', u8aWrapBytes(message), accountOffset, addressOffset, options));
}
/**
* @internal
*
* Returns a created SubstrateApp to perform operations against. Generally
* this is only used internally, to ensure consistent bahavior.
*/
async withApp <T> (fn: (app: SubstrateApp) => Promise<T>): Promise<T> {
try {
if (!this.#app) {
const transport = await this.#transportDef.create();
this.#app = newSubstrateApp(transport, this.#ledgerName);
}
return await fn(this.#app);
} catch (error) {
this.#app = null;
throw error;
}
}
}
// This is necessary to ensure users still have access to class Ledger even though its deprecated.
//
// eslint-disable-next-line deprecation/deprecation
export { Ledger } from './Ledger.js';
export { LedgerGeneric } from './LedgerGeneric.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
export const LEDGER_DEFAULT_ACCOUNT = 0x80000000;
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
+5 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
// These match up with the keys of the knownLedger object in the @polkadot/networks/defaults/ledger.ts
@@ -15,6 +15,7 @@ export const ledgerApps: Record<string, string> = {
darwinia: 'Darwinia',
'dock-mainnet': 'Dock',
edgeware: 'Edgeware',
enjin: 'Enjin',
equilibrium: 'Equilibrium',
genshiro: 'Genshiro',
hydradx: 'HydraDX',
@@ -22,15 +23,18 @@ export const ledgerApps: Record<string, string> = {
karura: 'Karura',
khala: 'Khala',
kusama: 'Kusama',
matrixchain: 'Matrixchain',
nodle: 'Nodle',
origintrail: 'OriginTrail',
parallel: 'Parallel',
peaq: 'Peaq',
pendulum: 'Pendulum',
phala: 'Phala',
picasso: 'Picasso',
polkadex: 'Polkadex',
polkadot: 'Polkadot',
polymesh: 'Polymesh',
quartz: 'Quartz',
sora: 'Sora',
stafi: 'Stafi',
statemine: 'Statemine',
-7
View File
@@ -1,7 +0,0 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as transportInfo } from '@polkadot/hw-ledger-transports/packageInfo';
import { packageInfo as utilInfo } from '@polkadot/util/packageInfo';
export default [transportInfo, utilInfo];
-11
View File
@@ -1,11 +0,0 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
import { detectPackage } from '@polkadot/util';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others);
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage.js';
import './packageDetect.js';
export * from './bundle.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index.js';
+13
View File
@@ -0,0 +1,13 @@
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
// (packageInfo imports will be kept as-is, user-editable)
import { packageInfo as transportInfo } from '@polkadot/hw-ledger-transports/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo as utilInfo } from '@polkadot/util/packageInfo';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, [transportInfo, utilInfo]);
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/hw-ledger', path: 'auto', type: 'auto', version: '12.4.2' };
export const packageInfo = { name: '@polkadot/hw-ledger', path: 'auto', type: 'auto', version: '13.0.2' };
+9 -1
View File
@@ -1,8 +1,11 @@
// Copyright 2017-2023 @polkadot/hw-ledger authors & contributors
// Copyright 2017-2024 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
/**
* Legacy Type that works with the `Ledger` class.
*/
export interface AccountOptions {
/** The index of the account */
account: number;
@@ -12,6 +15,11 @@ export interface AccountOptions {
change: number;
}
export interface AccountOptionsGeneric extends AccountOptions {
/** Option for PolkadotGenericApp.signWithMetadata */
metadata: Buffer;
}
export interface LedgerAddress {
/** The ss58 encoded address */
address: string;
+8 -8
View File
@@ -3,7 +3,7 @@
"bugs": "https://github.com/polkadot-js/common/issues",
"description": "Keyring management",
"engines": {
"node": ">=16"
"node": ">=18"
},
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/keyring#readme",
"license": "Apache-2.0",
@@ -14,19 +14,19 @@
"url": "https://github.com/polkadot-js/common.git"
},
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
"./packageDetect.js",
"./packageDetect.cjs"
],
"type": "module",
"version": "12.4.2",
"version": "13.0.2",
"main": "index.js",
"dependencies": {
"@polkadot/util": "12.4.2",
"@polkadot/util-crypto": "12.4.2",
"@polkadot/util": "13.0.2",
"@polkadot/util-crypto": "13.0.2",
"tslib": "^2.6.2"
},
"peerDependencies": {
"@polkadot/util": "12.4.2",
"@polkadot/util-crypto": "12.4.2"
"@polkadot/util": "13.0.2",
"@polkadot/util-crypto": "13.0.2"
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
// all external
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
// default substrate dev phrase
-7
View File
@@ -1,7 +0,0 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as utilInfo } from '@polkadot/util/packageInfo';
import { packageInfo as cryptoInfo } from '@polkadot/util-crypto/packageInfo';
export default [utilInfo, cryptoInfo];
-11
View File
@@ -1,11 +0,0 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
import { detectPackage } from '@polkadot/util';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others);
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
+2 -2
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage.js';
import './packageDetect.js';
import { Keyring } from './bundle.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { EncryptedJsonEncoding, Keypair, KeypairType } from '@polkadot/util-crypto/types';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index.js';
+13
View File
@@ -0,0 +1,13 @@
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
// (packageInfo imports will be kept as-is, user-editable)
import { detectPackage } from '@polkadot/util';
import { packageInfo as utilInfo } from '@polkadot/util/packageInfo';
import { packageInfo as cryptoInfo } from '@polkadot/util-crypto/packageInfo';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, [cryptoInfo, utilInfo]);
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/keyring', path: 'auto', type: 'auto', version: '12.4.2' };
export const packageInfo = { name: '@polkadot/keyring', path: 'auto', type: 'auto', version: '13.0.2' };
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
+24 -19
View File
@@ -1,47 +1,52 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { EncryptedJsonEncoding } from '@polkadot/util-crypto/types';
import type { PairInfo } from './types.js';
import { u8aEq } from '@polkadot/util';
import { jsonDecryptData } from '@polkadot/util-crypto';
import { PKCS8_DIVIDER, PKCS8_HEADER, PUB_LENGTH, SEC_LENGTH, SEED_LENGTH } from './defaults.js';
import { PAIR_DIV, PAIR_HDR, PUB_LENGTH, SEC_LENGTH, SEED_LENGTH } from './defaults.js';
const SEED_OFFSET = PKCS8_HEADER.length;
const SEED_OFFSET = PAIR_HDR.length;
type DecodeResult = PairInfo & {
secretKey: Uint8Array;
};
export function decodePair (passphrase?: string, encrypted?: Uint8Array | null, _encType?: EncryptedJsonEncoding | EncryptedJsonEncoding[]): DecodeResult {
/**
* Decode a pair, taking into account the generation-specific formats and headers
*
* For divisor/headers, don't rely on the magic being static. These will
* change between generations, aka with the long-awaited 4th generation
* of the format. The external decode interface is the only way to use and decode these.
**/
export function decodePair (passphrase?: string, encrypted?: Uint8Array | null, _encType?: EncryptedJsonEncoding | EncryptedJsonEncoding[]): { publicKey: Uint8Array; secretKey: Uint8Array } {
const encType = Array.isArray(_encType) || _encType === undefined
? _encType
: [_encType];
const decrypted = jsonDecryptData(encrypted, passphrase, encType);
const header = decrypted.subarray(0, PKCS8_HEADER.length);
const header = decrypted.subarray(0, PAIR_HDR.length);
if (!u8aEq(header, PKCS8_HEADER)) {
throw new Error('Invalid Pkcs8 header found in body');
// check the start header (generations 1-3)
if (!u8aEq(header, PAIR_HDR)) {
throw new Error('Invalid encoding header found in body');
}
// setup for generation 3 format
let secretKey = decrypted.subarray(SEED_OFFSET, SEED_OFFSET + SEC_LENGTH);
let divOffset = SEED_OFFSET + SEC_LENGTH;
let divider = decrypted.subarray(divOffset, divOffset + PKCS8_DIVIDER.length);
let divider = decrypted.subarray(divOffset, divOffset + PAIR_DIV.length);
// old-style, we have the seed here
if (!u8aEq(divider, PKCS8_DIVIDER)) {
// old-style (generation 1 & 2), we have the seed here
if (!u8aEq(divider, PAIR_DIV)) {
divOffset = SEED_OFFSET + SEED_LENGTH;
secretKey = decrypted.subarray(SEED_OFFSET, divOffset);
divider = decrypted.subarray(divOffset, divOffset + PKCS8_DIVIDER.length);
divider = decrypted.subarray(divOffset, divOffset + PAIR_DIV.length);
if (!u8aEq(divider, PKCS8_DIVIDER)) {
throw new Error('Invalid Pkcs8 divider found in body');
// check the divisior at this point (already checked for generation 3)
if (!u8aEq(divider, PAIR_DIV)) {
throw new Error('Invalid encoding divider found in body');
}
}
const pubOffset = divOffset + PKCS8_DIVIDER.length;
const pubOffset = divOffset + PAIR_DIV.length;
const publicKey = decrypted.subarray(pubOffset, pubOffset + PUB_LENGTH);
return {
+14 -3
View File
@@ -1,9 +1,20 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
export const PKCS8_DIVIDER = new Uint8Array([161, 35, 3, 33, 0]);
export const PKCS8_HEADER = new Uint8Array([48, 83, 2, 1, 1, 48, 5, 6, 3, 43, 101, 112, 4, 34, 4, 32]);
/** public/secret section divider (generation 1-3, will change in 4, don't rely on value) */
export const PAIR_DIV = new Uint8Array([161, 35, 3, 33, 0]);
/** public/secret start block (generation 1-3, will change in 4, don't rely on value) */
export const PAIR_HDR = new Uint8Array([48, 83, 2, 1, 1, 48, 5, 6, 3, 43, 101, 112, 4, 34, 4, 32]);
/** length of a public key */
export const PUB_LENGTH = 32;
/** length of a salt */
export const SALT_LENGTH = 32;
/** length of a secret key */
export const SEC_LENGTH = 64;
/** length of a user-input seed */
export const SEED_LENGTH = 32;
+5 -5
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
@@ -6,10 +6,10 @@
import { NONCE_LENGTH, SCRYPT_LENGTH } from '@polkadot/util-crypto/json/constants';
import { createTestPairs } from '../testingPairs.js';
import { PKCS8_DIVIDER, PKCS8_HEADER, PUB_LENGTH, SEC_LENGTH } from './defaults.js';
import { PAIR_DIV, PAIR_HDR, PUB_LENGTH, SEC_LENGTH } from './defaults.js';
const PKCS8_LENGTH = PKCS8_DIVIDER.length + PKCS8_HEADER.length + PUB_LENGTH + SEC_LENGTH;
const ENCODED_LENGTH = 16 + PKCS8_LENGTH + NONCE_LENGTH + SCRYPT_LENGTH;
const DECODED_LENGTH = PAIR_DIV.length + PAIR_HDR.length + PUB_LENGTH + SEC_LENGTH;
const ENCODED_LENGTH = 16 + DECODED_LENGTH + NONCE_LENGTH + SCRYPT_LENGTH;
const keyring = createTestPairs({ type: 'ed25519' }, false);
@@ -17,7 +17,7 @@ describe('encode', (): void => {
it('returns PKCS8 when no passphrase supplied', (): void => {
expect(
keyring.alice.encodePkcs8()
).toHaveLength(PKCS8_LENGTH);
).toHaveLength(DECODED_LENGTH);
});
it('returns encoded PKCS8 when passphrase supplied', (): void => {
+7 -8
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { PairInfo } from './types.js';
@@ -6,24 +6,23 @@ import type { PairInfo } from './types.js';
import { u8aConcat } from '@polkadot/util';
import { naclEncrypt, scryptEncode, scryptToU8a } from '@polkadot/util-crypto';
import { PKCS8_DIVIDER, PKCS8_HEADER } from './defaults.js';
import { PAIR_DIV, PAIR_HDR } from './defaults.js';
/**
* Encode a pair with the latest generation format (generation 3)
**/
export function encodePair ({ publicKey, secretKey }: PairInfo, passphrase?: string): Uint8Array {
if (!secretKey) {
throw new Error('Expected a valid secretKey to be passed to encode');
}
const encoded = u8aConcat(
PKCS8_HEADER,
secretKey,
PKCS8_DIVIDER,
publicKey
);
const encoded = u8aConcat(PAIR_HDR, secretKey, PAIR_DIV, publicKey);
if (!passphrase) {
return encoded;
}
// this is only for generation 3 (previous generations are only handled in decoding)
const { params, password, salt } = scryptEncode(passphrase);
const { encrypted, nonce } = naclEncrypt(encoded, password.subarray(0, 32));
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { EncryptedJsonEncoding, Keypair, KeypairType } from '@polkadot/util-crypto/types';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KeyringPair, KeyringPair$Json, KeyringPair$Meta } from '../types.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KeypairType } from '@polkadot/util-crypto/types';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
export interface PairInfo {
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KeyringPair, KeyringPairs } from './types.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KeypairType } from '@polkadot/util-crypto/types';
+4 -10
View File
@@ -1,17 +1,13 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
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)
*/
/** The ss58Format to use for address encoding (defaults to 42) */
ss58Format?: Prefix;
/**
* @description The type of keyring to create (defaults to ed25519)
*/
/** The type of keyring to create (defaults to ed25519) */
type?: KeypairType;
}
@@ -76,9 +72,7 @@ export interface KeyringPair$Json extends EncryptedJson {
}
export interface SignOptions {
/**
* @description Create a MultiSignature-compatible output with an indicator type
**/
/** Create a MultiSignature-compatible output with an indicator type */
withType?: boolean;
}
+5 -5
View File
@@ -3,7 +3,7 @@
"bugs": "https://github.com/polkadot-js/common/issues",
"description": "A list of all available Substrate networks and their applicable prefixes",
"engines": {
"node": ">=16"
"node": ">=18"
},
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/networks#readme",
"license": "Apache-2.0",
@@ -15,14 +15,14 @@
},
"sideEffects": false,
"type": "module",
"version": "12.4.2",
"version": "13.0.2",
"main": "index.js",
"dependencies": {
"@polkadot/util": "12.4.2",
"@substrate/ss58-registry": "^1.43.0",
"@polkadot/util": "13.0.2",
"@substrate/ss58-registry": "^1.46.0",
"tslib": "^2.6.2"
},
"devDependencies": {
"@polkadot/hw-ledger": "12.4.2"
"@polkadot/hw-ledger": "13.0.2"
}
}
+16 -5
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/networks authors & contributors
// Copyright 2017-2024 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
@@ -6,22 +6,33 @@
import { ledgerApps } from '@polkadot/hw-ledger/defaults';
import { isHex } from '@polkadot/util';
import { knownGenesis, knownLedger } from './defaults/index.js';
import { knownGenesis, knownLedger, knownTestnet } from './defaults/index.js';
describe('defaults', (): void => {
const genesisKeys = Object.keys(knownGenesis);
const ledgerKeys = Object.keys(knownLedger);
describe('genesis', (): void => {
it('has hex values for all genesis chains', (): void => {
expect(
Object.keys(knownGenesis).filter((network) =>
genesisKeys.filter((network) =>
!knownGenesis[network].length ||
knownGenesis[network].some((g) => !isHex(g, 256))
)
).toEqual([]);
});
it('has no entries for testnets', (): void => {
expect(
genesisKeys.filter((network) =>
knownTestnet[network]
)
).toEqual([]);
});
it('has genesis for all Ledger chains', (): void => {
expect(
Object.keys(knownLedger).filter((network) =>
ledgerKeys.filter((network) =>
!knownGenesis[network]
)
).toEqual([]);
@@ -31,7 +42,7 @@ describe('defaults', (): void => {
describe('Ledger', (): void => {
it('has entries for each of the apps (hwledger -> networks)', (): void => {
expect(
Object.keys(knownLedger).filter((network) =>
ledgerKeys.filter((network) =>
!ledgerApps[network]
)
).toEqual([]);
+21 -5
View File
@@ -1,12 +1,16 @@
// Copyright 2017-2023 @polkadot/networks authors & contributors
// Copyright 2017-2024 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KnownGenesis } from '../types.js';
// 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
// last. This make lookups for the current a simple genesisHash[0]
// (See Kusama as an example)
// 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 goes first,
// oldest goes last. This make lookups for the current a simple genesisHash[0]
// where the latest ios always the first entry (See Kusama as an example)
//
// IMPORTANT: Apart from the test relays, this list is limited to live parachains
// and live production networks. It does not and should not contain any testnets,
// either stand-alone or connected to test relays such as Westend/Rococo
export const knownGenesis: KnownGenesis = {
acala: [
'0xfc41b9bd8ef8fe53d58c7ea67c794c7ec9a73daf05e6d54b14ff6342c99ba64c'
@@ -52,6 +56,9 @@ export const knownGenesis: KnownGenesis = {
edgeware: [
'0x742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b'
],
enjin: [
'0xd8761d3c88f26dc12875c00d3165f7d67243d56fc85b4cf19937601a7916e5a9'
],
equilibrium: [
'0x6f1a800de3daff7f5e037ddf66ab22ce03ab91874debeddb1086f5f7dbd48925'
],
@@ -82,6 +89,9 @@ export const knownGenesis: KnownGenesis = {
'0xe3777fa922cafbff200cadeaea1a76bd7898ad5b89f7848999058b50e715f636', // Kusama CC2
'0x3fd7b9eb6a00376e5be61f01abb429ffb0b104be05eaff4d458da48fcd425baf' // Kusama CC1
],
matrixchain: [
'0x3af4ff48ec76d2efc8476730f423ac07e25ad48f5f4c9dc39c778b164d808615'
],
nodle: [
'0x97da7ede98d7bad4e36b4d734b6055425a3be036da2a332ea5a7037656427a21'
],
@@ -94,6 +104,9 @@ export const knownGenesis: KnownGenesis = {
parallel: [
'0xe61a41c53f5dcd0beb09df93b34402aada44cb05117b71059cce40a2723a4e97'
],
peaq: [
'0xd2a5d385932d1f650dae03ef8e2748983779ee342c614f80854d32b8cd8fa48c'
],
pendulum: [
'0x5d3c298622d5634ed019bf61ea4b71655030015bde9beb0d6a24743714462c86'
],
@@ -113,6 +126,9 @@ export const knownGenesis: KnownGenesis = {
polymesh: [
'0x6fbd74e5e1d0a61d52ccfe9d4adaed16dd3a7caa37c6bc4d0c2fa12e8b2f4063'
],
quartz: [
'0xcd4d732201ebe5d6b014edda071c4203e16867305332301dc8d092044b28e554'
],
rococo: [
'0x6408de7737c59c238890533af25896a2c20608d8b380bb01029acb392781063e',
'0xaaf2cd1b74b5f726895921259421b534124726263982522174147046b8827897',
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/networks authors & contributors
// Copyright 2017-2024 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KnownIcon } from '../types.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/networks authors & contributors
// Copyright 2017-2024 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { knownGenesis } from './genesis.js';
+6 -2
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/networks authors & contributors
// Copyright 2017-2024 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KnownLedger } from '../types.js';
@@ -19,6 +19,7 @@ export const knownLedger: KnownLedger = {
darwinia: 0x00000162,
'dock-mainnet': 0x00000252,
edgeware: 0x0000020b,
enjin: 0x00000483,
equilibrium: 0x05f5e0fd,
genshiro: 0x05f5e0fc,
hydradx: 0x00000162,
@@ -26,21 +27,24 @@ export const knownLedger: KnownLedger = {
karura: 0x000002ae,
khala: 0x000001b2,
kusama: 0x000001b2,
matrixchain: 0x00000483,
nodle: 0x000003eb,
origintrail: 0x00000162,
parallel: 0x00000162,
peaq: 0x00000d0a,
pendulum: 0x00000162,
phala: 0x00000162,
picasso: 0x000001b2,
polkadex: 0x0000031f,
polkadot: 0x00000162,
polymesh: 0x00000253,
quartz: 0x00000277,
sora: 0x00000269,
stafi: 0x0000038b,
statemine: 0x000001b2, // common-good on Kusama, shares derivation
statemint: 0x00000162, // common-good on Polkadot, shares derivation
ternoa: 0x00003e3,
unique: 0x00000162,
unique: 0x00000295,
vtb: 0x000002b6,
xxnetwork: 0x000007a3,
zeitgeist: 0x00000162
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/networks authors & contributors
// Copyright 2017-2024 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KnownTestnet } from '../types.js';
-4
View File
@@ -1,4 +0,0 @@
// Copyright 2017-2023 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
export default [];
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/networks authors & contributors
// Copyright 2017-2024 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
+2 -2
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/networks authors & contributors
// Copyright 2017-2024 @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';
// import './packageDetect.js';
export * from './interfaces.js';
export { packageInfo } from './packageInfo.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/networks authors & contributors
// Copyright 2017-2024 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KnownSubstrate, Network, SubstrateNetwork } from './types.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/networks authors & contributors
// Copyright 2017-2024 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index.js';
@@ -1,11 +1,11 @@
// Copyright 2017-2023 @polkadot/networks authors & contributors
// Copyright 2017-2024 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
// (packageInfo imports will be kept as-is, user-editable)
import { detectPackage } from '@polkadot/util';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others);
detectPackage(packageInfo, null, []);
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/networks authors & contributors
// Copyright 2017-2024 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/networks', path: 'auto', type: 'auto', version: '12.4.2' };
export const packageInfo = { name: '@polkadot/networks', path: 'auto', type: 'auto', version: '13.0.2' };
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/networks authors & contributors
// Copyright 2017-2024 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
+8 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/keyring authors & contributors
// Copyright 2017-2024 @polkadot/keyring authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { RegistryEntry } from '@substrate/ss58-registry';
@@ -17,15 +17,22 @@ export type KnownSubstrate = RegistryEntry;
export type KnownTestnet = Record<string, true>;
export interface SubstrateNetwork extends KnownSubstrate {
/** The genesisHash for the chain */
genesisHash: HexString[];
/** Does the chain has support for Ledger devices */
hasLedgerSupport: boolean;
/** The IdentityIcon to use for the chain */
icon: Icon;
/** Flag set when we don't include this chain */
isIgnored: boolean;
/** Flag to indicate a testnet */
isTestnet: boolean;
/** The Ledger-specific/required slip44 for the chain */
slip44?: number | null;
}
export interface Network extends SubstrateNetwork {
/** The network assigned to this chain */
network: string;
}
+49 -32
View File
@@ -508,12 +508,16 @@
},
{
"prefix": 41,
"network": "poli",
"displayName": "Polimec Chain",
"symbols": [],
"decimals": [],
"network": "polimec",
"displayName": "Polimec Protocol",
"symbols": [
"PLMC"
],
"decimals": [
10
],
"standardAccount": "*25519",
"website": "https://polimec.io/"
"website": "https://www.polimec.org/"
},
{
"prefix": 42,
@@ -711,6 +715,19 @@
"standardAccount": "*25519",
"website": "https://pendulumchain.org/"
},
{
"prefix": 58,
"network": "eternal-civilization",
"displayName": "Eternal Civilization",
"symbols": [
"ECC"
],
"decimals": [
12
],
"standardAccount": "*25519",
"website": "http://www.ysknfr.cn/"
},
{
"prefix": 63,
"network": "hydradx",
@@ -724,19 +741,6 @@
"standardAccount": "*25519",
"website": "https://hydradx.io"
},
{
"prefix": 64,
"network": "ewx",
"displayName": "Energy Web X",
"symbols": [
"EWT"
],
"decimals": [
18
],
"standardAccount": "*25519",
"website": "https://www.energyweb.org"
},
{
"prefix": 65,
"network": "aventus",
@@ -1125,7 +1129,7 @@
12
],
"standardAccount": "*25519",
"website": "https://vara-network.io/"
"website": "https://vara.network/"
},
{
"prefix": 172,
@@ -1218,6 +1222,19 @@
"standardAccount": "*25519",
"website": "https://metaquity.xyz/"
},
{
"prefix": 777,
"network": "curio",
"displayName": "Curio",
"symbols": [
"CGT"
],
"decimals": [
18
],
"standardAccount": "*25519",
"website": "https://parachain.capitaldex.exchange/"
},
{
"prefix": 789,
"network": "geek",
@@ -1517,19 +1534,6 @@
"standardAccount": "secp256k1",
"website": "https://www.peerplays.com/"
},
{
"prefix": 4006,
"network": "tangle",
"displayName": "Tangle Network",
"symbols": [
"TNT"
],
"decimals": [
18
],
"standardAccount": "*25519",
"website": "https://www.webb.tools/"
},
{
"prefix": 4450,
"network": "g1",
@@ -1556,6 +1560,19 @@
"standardAccount": "*25519",
"website": "https://humanode.io"
},
{
"prefix": 5845,
"network": "tangle",
"displayName": "Tangle Network",
"symbols": [
"TNT"
],
"decimals": [
18
],
"standardAccount": "*25519",
"website": "https://www.tangle.tools/"
},
{
"prefix": 6094,
"network": "subspace",
+14 -14
View File
@@ -3,7 +3,7 @@
"bugs": "https://github.com/polkadot-js/common/issues",
"description": "A collection of useful crypto utilities for @polkadot",
"engines": {
"node": ">=16"
"node": ">=18"
},
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/util-crypto#readme",
"license": "Apache-2.0",
@@ -16,29 +16,29 @@
"sideEffects": [
"./bundleInit.js",
"./bundleInit.cjs",
"./detectPackage.js",
"./detectPackage.cjs"
"./packageDetect.js",
"./packageDetect.cjs"
],
"type": "module",
"version": "12.4.2",
"version": "13.0.2",
"browser": {
"crypto": false,
"stream": false
},
"main": "index.js",
"dependencies": {
"@noble/curves": "1.1.0",
"@noble/hashes": "1.3.1",
"@polkadot/networks": "12.4.2",
"@polkadot/util": "12.4.2",
"@polkadot/wasm-crypto": "^7.2.2",
"@polkadot/wasm-util": "^7.2.2",
"@polkadot/x-bigint": "12.4.2",
"@polkadot/x-randomvalues": "12.4.2",
"@scure/base": "1.1.1",
"@noble/curves": "^1.3.0",
"@noble/hashes": "^1.3.3",
"@polkadot/networks": "13.0.2",
"@polkadot/util": "13.0.2",
"@polkadot/wasm-crypto": "^7.3.2",
"@polkadot/wasm-util": "^7.3.2",
"@polkadot/x-bigint": "13.0.2",
"@polkadot/x-randomvalues": "13.0.2",
"@scure/base": "^1.1.5",
"tslib": "^2.6.2"
},
"peerDependencies": {
"@polkadot/util": "12.4.2"
"@polkadot/util": "13.0.2"
}
}
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
// Copyright 2017-2024 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
// Copyright 2017-2024 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { decodeAddress } from './decode.js';
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
// Copyright 2017-2024 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
// Copyright 2017-2024 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Prefix } from './types.js';
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
// Copyright 2017-2024 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
// Copyright 2017-2024 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { sshash } from './sshash.js';
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
// Copyright 2017-2024 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
// Copyright 2017-2024 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Prefix } from './types.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
// Copyright 2017-2024 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { availableNetworks } from '../networks.js';
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
// Copyright 2017-2024 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
// Copyright 2017-2024 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DeriveJunction } from '../key/DeriveJunction.js';
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
// Copyright 2017-2024 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
// Copyright 2017-2024 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Prefix } from './types.js';
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
// Copyright 2017-2024 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />

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