Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5c2f8f529 | ||
|
|
f7ce22b158 | ||
|
|
0028d212e4 | ||
|
|
719c48f8f2 | ||
|
|
b137f8ec8b | ||
|
|
e93b7a3626 | ||
|
|
7bf2d220dd | ||
|
|
7efa20c066 | ||
|
|
f2afcfc1a7 | ||
|
|
45e2a560a9 | ||
|
|
5b5cdae9ff | ||
|
|
5147f64a64 | ||
|
|
0116a3f1f7 | ||
|
|
01839b5f63 | ||
|
|
18d02f49fd | ||
|
|
12e2a44935 | ||
|
|
9c47980c68 | ||
|
|
14f7a5c0bb | ||
|
|
f512f4aa27 | ||
|
|
4b9d4fa935 | ||
|
|
35288e81e1 | ||
|
|
f95fa2e60d | ||
|
|
0c62a8a676 | ||
|
|
346989211c | ||
|
|
ba2453457d | ||
|
|
9c4d409e66 | ||
|
|
5f9e345dd4 | ||
|
|
bf141cd874 | ||
|
|
08bf4b7eb2 | ||
|
|
42daac5327 | ||
|
|
694fb8b241 | ||
|
|
b0b69c27dc | ||
|
|
b57bcdc38f | ||
|
|
4fd4178ce9 | ||
|
|
39403fcfe7 | ||
|
|
955605b2b0 | ||
|
|
d291a76798 | ||
|
|
aa12647ef6 | ||
|
|
ceff8cc9ff |
@@ -9,7 +9,7 @@ jobs:
|
|||||||
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && (!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository)"
|
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
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: jacogr/action-approve@9d6ce78d26f23ad29d009d034822cf773f2cb50e
|
- uses: jacogr/action-approve@795afd1dd096a2071d7ec98740661af4e853b7da
|
||||||
with:
|
with:
|
||||||
authors: jacogr
|
authors: jacogr
|
||||||
labels: -auto
|
labels: -auto
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ jobs:
|
|||||||
merge:
|
merge:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: jacogr/action-merge@3b4b49af8a8644bf5cbb5409ee236abe04eeb1b0
|
- uses: jacogr/action-merge@d2d64b4545acd93b0a9575177d3d215ae3f92029
|
||||||
with:
|
with:
|
||||||
checks: build,lint,test
|
checks: build,lint,test
|
||||||
labels: -auto
|
labels: -auto
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ jobs:
|
|||||||
YARN_ENABLE_SCRIPTS: false
|
YARN_ENABLE_SCRIPTS: false
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e
|
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
|
||||||
- uses: denoland/setup-deno@004814556e37c54a2f6e31384c9e18e983317366
|
- uses: denoland/setup-deno@004814556e37c54a2f6e31384c9e18e983317366
|
||||||
with:
|
with:
|
||||||
deno-version: vx.x.x
|
deno-version: vx.x.x
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ jobs:
|
|||||||
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT_BOT }}
|
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT_BOT }}
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e
|
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: ${{ secrets.GH_PAT_BOT }}
|
token: ${{ secrets.GH_PAT_BOT }}
|
||||||
|
|||||||
@@ -1,5 +1,50 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## 10.3.1 Jan 28, 2023
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Ledger support for Ternoa (Thanks to https://github.com/mohsinriaz17)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Expand `arrayChunk` tests
|
||||||
|
- Adjust output for Ledger sanity checks
|
||||||
|
- Expand exported `bigint` constants to match with those in `BN`
|
||||||
|
- Adjust internal character maps to operate on `Uint8Array` instad of `Array<number>`
|
||||||
|
- Upgrade dependencies to latest stable versions
|
||||||
|
|
||||||
|
|
||||||
|
## 10.2.6 Jan 13, 2023
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Drop stray `console.error` log (it really _is_ Friday 13th)
|
||||||
|
|
||||||
|
|
||||||
|
## 10.2.5 Jan 13, 2023
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Bugfix for `formatBalance` (forceUnit) with `BN` inputs where output is less than 0
|
||||||
|
|
||||||
|
|
||||||
|
## 10.2.4 Jan 13, 2023
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Add the `withAll` (default false) flag to `formatBalance` to format to max decimals
|
||||||
|
- Add the `withZero` (default true) flags to `formatBalance` to retain trailing zeros
|
||||||
|
|
||||||
|
|
||||||
|
## 10.2.3 Jan 7, 2023
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Adjust `isBuffer` check on `xglobal` (no auto-polyfill detection on eg. parcel)
|
||||||
|
- Upgrade dependencies to latest stable versions
|
||||||
|
|
||||||
|
|
||||||
## 10.2.2 Jan 6, 2023
|
## 10.2.2 Jan 6, 2023
|
||||||
|
|
||||||
Contributed:
|
Contributed:
|
||||||
|
|||||||
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
1502 Jaco 10.2.2 (#1700)
|
1521 Jaco 10.3.1 (#1719)
|
||||||
10 Carlo Sala feat(networks): support ledger for ajuna (#1682)
|
10 Carlo Sala feat(networks): support ledger for ajuna (#1682)
|
||||||
9 Antoine Estienne Add eth uri keyring test (#1291)
|
9 Antoine Estienne Add eth uri keyring test (#1291)
|
||||||
6 Amaury Martiny Add tests from Rust (#283)
|
6 Amaury Martiny Add tests from Rust (#283)
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
1 Lezek123 logger - wildcard include/exclude with DEBUG env (#932)
|
1 Lezek123 logger - wildcard include/exclude with DEBUG env (#932)
|
||||||
1 Mario Neises remove redudant export (#257)
|
1 Mario Neises remove redudant export (#257)
|
||||||
1 Miguel Hervas Add CFG Ledger Support (#1057)
|
1 Miguel Hervas Add CFG Ledger Support (#1057)
|
||||||
|
1 Mohsan Riaz Add Ternoa for ledger hardware support (#1711)
|
||||||
1 nahuseyoum Reserving 65 for Aventus based on the new extended range (#871)
|
1 nahuseyoum Reserving 65 for Aventus based on the new extended range (#871)
|
||||||
1 Nantian add acala ledger config (#1485)
|
1 Nantian add acala ledger config (#1485)
|
||||||
1 qwer951123 Add acala genesis (#1161)
|
1 qwer951123 Add acala genesis (#1161)
|
||||||
|
|||||||
+5
-5
@@ -11,10 +11,10 @@
|
|||||||
},
|
},
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "10.2.2",
|
"version": "10.3.1",
|
||||||
"versions": {
|
"versions": {
|
||||||
"git": "10.2.2",
|
"git": "10.3.1",
|
||||||
"npm": "10.2.2"
|
"npm": "10.3.1"
|
||||||
},
|
},
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
@@ -34,8 +34,8 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.20.12",
|
"@babel/core": "^7.20.12",
|
||||||
"@polkadot/dev": "^0.67.177",
|
"@polkadot/dev": "^0.68.2",
|
||||||
"@types/jest": "^29.2.5"
|
"@types/jest": "^29.4.0"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"typescript": "^4.9.4"
|
"typescript": "^4.9.4"
|
||||||
|
|||||||
@@ -1,201 +0,0 @@
|
|||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
@@ -16,18 +16,18 @@
|
|||||||
},
|
},
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "10.2.2",
|
"version": "10.3.1",
|
||||||
"browser": "browser.js",
|
"browser": "browser.js",
|
||||||
"main": "node.js",
|
"main": "node.js",
|
||||||
"react-native": "react-native.js",
|
"react-native": "react-native.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.7",
|
"@babel/runtime": "^7.20.13",
|
||||||
"@ledgerhq/hw-transport": "^6.27.9",
|
"@ledgerhq/hw-transport": "^6.27.10",
|
||||||
"@ledgerhq/hw-transport-webhid": "^6.27.9",
|
"@ledgerhq/hw-transport-webhid": "^6.27.10",
|
||||||
"@ledgerhq/hw-transport-webusb": "^6.27.9",
|
"@ledgerhq/hw-transport-webusb": "^6.27.10",
|
||||||
"@polkadot/util": "10.2.2"
|
"@polkadot/util": "10.3.1"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@ledgerhq/hw-transport-node-hid-singleton": "^6.28.6"
|
"@ledgerhq/hw-transport-node-hid-singleton": "^6.28.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/hw-ledger-transports', path: 'auto', type: 'auto', version: '10.2.2' };
|
export const packageInfo = { name: '@polkadot/hw-ledger-transports', path: 'auto', type: 'auto', version: '10.3.1' };
|
||||||
|
|||||||
@@ -1,201 +0,0 @@
|
|||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
@@ -19,13 +19,13 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "10.2.2",
|
"version": "10.3.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.7",
|
"@babel/runtime": "^7.20.13",
|
||||||
"@ledgerhq/hw-transport": "^6.27.9",
|
"@ledgerhq/hw-transport": "^6.27.10",
|
||||||
"@polkadot/hw-ledger-transports": "10.2.2",
|
"@polkadot/hw-ledger-transports": "10.3.1",
|
||||||
"@polkadot/util": "10.2.2",
|
"@polkadot/util": "10.3.1",
|
||||||
"@zondax/ledger-substrate": "^0.40.3"
|
"@zondax/ledger-substrate": "^0.40.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { supportedApps } from '@zondax/ledger-substrate';
|
|||||||
import { ledgerApps } from './defaults';
|
import { ledgerApps } from './defaults';
|
||||||
|
|
||||||
describe('ledgerApps', (): void => {
|
describe('ledgerApps', (): void => {
|
||||||
it.each(Object.keys(ledgerApps))('%s is known', (k): void => {
|
it.each(Object.keys(ledgerApps))('%s is available in @zondax/ledger-substrate', (k): void => {
|
||||||
expect(
|
expect(
|
||||||
supportedApps.find(({ name }) =>
|
supportedApps.find(({ name }) =>
|
||||||
name === ledgerApps[k]
|
name === ledgerApps[k]
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export const ledgerApps: Record<string, string> = {
|
|||||||
stafi: 'Stafi',
|
stafi: 'Stafi',
|
||||||
statemine: 'Statemine',
|
statemine: 'Statemine',
|
||||||
statemint: 'Statemint',
|
statemint: 'Statemint',
|
||||||
|
ternoa: 'Ternoa',
|
||||||
unique: 'Unique',
|
unique: 'Unique',
|
||||||
vtb: 'VTB',
|
vtb: 'VTB',
|
||||||
xxnetwork: 'XXNetwork'
|
xxnetwork: 'XXNetwork'
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/hw-ledger', path: 'auto', type: 'auto', version: '10.2.2' };
|
export const packageInfo = { name: '@polkadot/hw-ledger', path: 'auto', type: 'auto', version: '10.3.1' };
|
||||||
|
|||||||
@@ -1,201 +0,0 @@
|
|||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
@@ -20,15 +20,15 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "10.2.2",
|
"version": "10.3.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.7",
|
"@babel/runtime": "^7.20.13",
|
||||||
"@polkadot/util": "10.2.2",
|
"@polkadot/util": "10.3.1",
|
||||||
"@polkadot/util-crypto": "10.2.2"
|
"@polkadot/util-crypto": "10.3.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@polkadot/util": "10.2.2",
|
"@polkadot/util": "10.3.1",
|
||||||
"@polkadot/util-crypto": "10.2.2"
|
"@polkadot/util-crypto": "10.3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/keyring', path: 'auto', type: 'auto', version: '10.2.2' };
|
export const packageInfo = { name: '@polkadot/keyring', path: 'auto', type: 'auto', version: '10.3.1' };
|
||||||
|
|||||||
@@ -1,201 +0,0 @@
|
|||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
@@ -17,14 +17,14 @@
|
|||||||
},
|
},
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "10.2.2",
|
"version": "10.3.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.7",
|
"@babel/runtime": "^7.20.13",
|
||||||
"@polkadot/util": "10.2.2",
|
"@polkadot/util": "10.3.1",
|
||||||
"@substrate/ss58-registry": "^1.36.0"
|
"@substrate/ss58-registry": "^1.38.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/hw-ledger": "10.2.2"
|
"@polkadot/hw-ledger": "10.3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,6 +129,9 @@ export const knownGenesis: KnownGenesis = {
|
|||||||
subsocial: [
|
subsocial: [
|
||||||
'0x0bd72c1c305172e1275278aaeb3f161e02eccb7a819e63f62d47bd53a28189f8'
|
'0x0bd72c1c305172e1275278aaeb3f161e02eccb7a819e63f62d47bd53a28189f8'
|
||||||
],
|
],
|
||||||
|
ternoa: [
|
||||||
|
'0x6859c81ca95ef624c9dfe4dc6e3381c33e5d6509e35e147092bfbc780f777c4e'
|
||||||
|
],
|
||||||
unique: [
|
unique: [
|
||||||
'0x84322d9cddbf35088f1e54e9a85c967a41a56a4f43445768125e61af166c7d31'
|
'0x84322d9cddbf35088f1e54e9a85c967a41a56a4f43445768125e61af166c7d31'
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ export const knownLedger: KnownLedger = {
|
|||||||
stafi: 0x0000038b,
|
stafi: 0x0000038b,
|
||||||
statemine: 0x000001b2, // common-good on Kusama, shares derivation
|
statemine: 0x000001b2, // common-good on Kusama, shares derivation
|
||||||
statemint: 0x00000162, // common-good on Polkadot, shares derivation
|
statemint: 0x00000162, // common-good on Polkadot, shares derivation
|
||||||
|
ternoa: 0x00003e3,
|
||||||
unique: 0x00000162,
|
unique: 0x00000162,
|
||||||
vtb: 0x000002b6,
|
vtb: 0x000002b6,
|
||||||
xxnetwork: 0x000007a3
|
xxnetwork: 0x000007a3
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/networks', path: 'auto', type: 'auto', version: '10.2.2' };
|
export const packageInfo = { name: '@polkadot/networks', path: 'auto', type: 'auto', version: '10.3.1' };
|
||||||
|
|||||||
@@ -1181,6 +1181,19 @@
|
|||||||
"standardAccount": "*25519",
|
"standardAccount": "*25519",
|
||||||
"website": "https://geek.gl"
|
"website": "https://geek.gl"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"prefix": 995,
|
||||||
|
"network": "ternoa",
|
||||||
|
"displayName": "Ternoa",
|
||||||
|
"symbols": [
|
||||||
|
"CAPS"
|
||||||
|
],
|
||||||
|
"decimals": [
|
||||||
|
18
|
||||||
|
],
|
||||||
|
"standardAccount": "*25519",
|
||||||
|
"website": "https://www.ternoa.network"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"prefix": 1110,
|
"prefix": 1110,
|
||||||
"network": "efinity",
|
"network": "efinity",
|
||||||
@@ -1363,19 +1376,6 @@
|
|||||||
"standardAccount": "*25519",
|
"standardAccount": "*25519",
|
||||||
"website": "https://chainflip.io/"
|
"website": "https://chainflip.io/"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"prefix": 2114,
|
|
||||||
"network": "Turing",
|
|
||||||
"displayName": "Turing Network",
|
|
||||||
"symbols": [
|
|
||||||
"TUR"
|
|
||||||
],
|
|
||||||
"decimals": [
|
|
||||||
10
|
|
||||||
],
|
|
||||||
"standardAccount": "*25519",
|
|
||||||
"website": "https://oak.tech/turing/home/"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"prefix": 2207,
|
"prefix": 2207,
|
||||||
"network": "SNOW",
|
"network": "SNOW",
|
||||||
@@ -1639,5 +1639,18 @@
|
|||||||
],
|
],
|
||||||
"standardAccount": "*25519",
|
"standardAccount": "*25519",
|
||||||
"website": "https://nftmart.io"
|
"website": "https://nftmart.io"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix": 13116,
|
||||||
|
"network": "bittensor",
|
||||||
|
"displayName": "Bittensor",
|
||||||
|
"symbols": [
|
||||||
|
"TAO"
|
||||||
|
],
|
||||||
|
"decimals": [
|
||||||
|
9
|
||||||
|
],
|
||||||
|
"standardAccount": "*25519",
|
||||||
|
"website": "https://bittensor.com"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -1,201 +0,0 @@
|
|||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
@@ -22,21 +22,21 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "10.2.2",
|
"version": "10.3.1",
|
||||||
"browser": {
|
"browser": {
|
||||||
"crypto": false,
|
"crypto": false,
|
||||||
"stream": false
|
"stream": false
|
||||||
},
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.7",
|
"@babel/runtime": "^7.20.13",
|
||||||
"@noble/hashes": "1.1.5",
|
"@noble/hashes": "1.1.5",
|
||||||
"@noble/secp256k1": "1.7.0",
|
"@noble/secp256k1": "1.7.1",
|
||||||
"@polkadot/networks": "10.2.2",
|
"@polkadot/networks": "10.3.1",
|
||||||
"@polkadot/util": "10.2.2",
|
"@polkadot/util": "10.3.1",
|
||||||
"@polkadot/wasm-crypto": "^6.4.1",
|
"@polkadot/wasm-crypto": "^6.4.1",
|
||||||
"@polkadot/x-bigint": "10.2.2",
|
"@polkadot/x-bigint": "10.3.1",
|
||||||
"@polkadot/x-randomvalues": "10.2.2",
|
"@polkadot/x-randomvalues": "10.3.1",
|
||||||
"@scure/base": "1.1.1",
|
"@scure/base": "1.1.1",
|
||||||
"ed2curve": "^0.3.0",
|
"ed2curve": "^0.3.0",
|
||||||
"tweetnacl": "^1.0.3"
|
"tweetnacl": "^1.0.3"
|
||||||
@@ -45,6 +45,6 @@
|
|||||||
"@types/ed2curve": "^0.2.2"
|
"@types/ed2curve": "^0.2.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@polkadot/util": "10.2.2"
|
"@polkadot/util": "10.3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { hexToU8a } from '@polkadot/util';
|
import { hexToU8a } from '@polkadot/util';
|
||||||
import { waitReady } from '@polkadot/wasm-crypto';
|
import { waitReady } from '@polkadot/wasm-crypto';
|
||||||
|
|
||||||
import { performanceWasm } from '../test/performance';
|
import { perfWasm } from '../test';
|
||||||
import { blake2AsU8a } from '.';
|
import { blake2AsU8a } from '.';
|
||||||
|
|
||||||
describe('blake2AsU8a', (): void => {
|
describe('blake2AsU8a', (): void => {
|
||||||
@@ -61,7 +61,7 @@ describe('blake2AsU8a', (): void => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe.each([256, 512] as (256 | 512)[])('bitLength=$p', (bitLength): void => {
|
describe.each([256, 512] as (256 | 512)[])('bitLength=$p', (bitLength): void => {
|
||||||
performanceWasm(`blake2AsU8a, bitLength=${bitLength}`, 64000, (input, onlyJs) =>
|
perfWasm(`blake2AsU8a, bitLength=${bitLength}`, 64000, (input, onlyJs) =>
|
||||||
blake2AsU8a(input, bitLength, null, onlyJs)
|
blake2AsU8a(input, bitLength, null, onlyJs)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { stringToU8a } from '@polkadot/util';
|
import { stringToU8a } from '@polkadot/util';
|
||||||
import { waitReady } from '@polkadot/wasm-crypto';
|
import { waitReady } from '@polkadot/wasm-crypto';
|
||||||
|
|
||||||
import { performanceWasm } from '../test/performance';
|
import { perfWasm } from '../test';
|
||||||
import { ed25519PairFromSeed, ed25519Sign } from '.';
|
import { ed25519PairFromSeed, ed25519Sign } from '.';
|
||||||
|
|
||||||
const PAIR = ed25519PairFromSeed(
|
const PAIR = ed25519PairFromSeed(
|
||||||
@@ -30,7 +30,7 @@ describe('ed25519Sign', (): void => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
performanceWasm('ed25519Sign', 250, (input, onlyJs) =>
|
perfWasm('ed25519Sign', 250, (input, onlyJs) =>
|
||||||
ed25519Sign(input, PAIR, onlyJs)
|
ed25519Sign(input, PAIR, onlyJs)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { hexToU8a, stringToU8a } from '@polkadot/util';
|
import { hexToU8a, stringToU8a } from '@polkadot/util';
|
||||||
import { waitReady } from '@polkadot/wasm-crypto';
|
import { waitReady } from '@polkadot/wasm-crypto';
|
||||||
|
|
||||||
import { performanceWasm } from '../test/performance';
|
import { perfWasm } from '../test';
|
||||||
import { hmacShaAsU8a } from '.';
|
import { hmacShaAsU8a } from '.';
|
||||||
|
|
||||||
describe('hmacShaAsU8a', (): void => {
|
describe('hmacShaAsU8a', (): void => {
|
||||||
@@ -32,7 +32,7 @@ describe('hmacShaAsU8a', (): void => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
performanceWasm(`hmacShaAsU8a, bitLength=${bitLength}`, 16000, (input, onlyJs) =>
|
perfWasm(`hmacShaAsU8a, bitLength=${bitLength}`, 16000, (input, onlyJs) =>
|
||||||
hmacShaAsU8a(input, input, bitLength, onlyJs)
|
hmacShaAsU8a(input, input, bitLength, onlyJs)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { hexToU8a, stringToU8a } from '@polkadot/util';
|
import { hexToU8a, stringToU8a } from '@polkadot/util';
|
||||||
import { waitReady } from '@polkadot/wasm-crypto';
|
import { waitReady } from '@polkadot/wasm-crypto';
|
||||||
|
|
||||||
import { performanceWasm } from '../test/performance';
|
import { perfWasm } from '../test';
|
||||||
import { keccakAsU8a } from '.';
|
import { keccakAsU8a } from '.';
|
||||||
|
|
||||||
describe('keccakAsU8a', (): void => {
|
describe('keccakAsU8a', (): void => {
|
||||||
@@ -43,7 +43,7 @@ describe('keccakAsU8a', (): void => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
performanceWasm(`keccakAsU8a, bitLength=${bitLength}`, 128000, (input, onlyJs) =>
|
perfWasm(`keccakAsU8a, bitLength=${bitLength}`, 128000, (input, onlyJs) =>
|
||||||
keccakAsU8a(input, bitLength, onlyJs)
|
keccakAsU8a(input, bitLength, onlyJs)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/util-crypto', path: 'auto', type: 'auto', version: '10.2.2' };
|
export const packageInfo = { name: '@polkadot/util-crypto', path: 'auto', type: 'auto', version: '10.3.1' };
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { u8aEq, u8aToHex } from '@polkadot/util';
|
|||||||
import { waitReady } from '@polkadot/wasm-crypto';
|
import { waitReady } from '@polkadot/wasm-crypto';
|
||||||
|
|
||||||
import { randomAsU8a } from '../random/asU8a';
|
import { randomAsU8a } from '../random/asU8a';
|
||||||
import { performanceWasm } from '../test/performance';
|
import { perfWasm } from '../test';
|
||||||
import { pbkdf2Encode } from '.';
|
import { pbkdf2Encode } from '.';
|
||||||
|
|
||||||
const KNOWN_SALT = new Uint8Array([
|
const KNOWN_SALT = new Uint8Array([
|
||||||
@@ -42,7 +42,7 @@ describe('pbkdf2Encode', (): void => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
performanceWasm('pbkdf2Encode', 8, (input, onlyJs) =>
|
perfWasm('pbkdf2Encode', 8, (input, onlyJs) =>
|
||||||
pbkdf2Encode(input, input, undefined, onlyJs)
|
pbkdf2Encode(input, input, undefined, onlyJs)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import { waitReady } from '@polkadot/wasm-crypto';
|
import { waitReady } from '@polkadot/wasm-crypto';
|
||||||
|
|
||||||
import { performanceWasm } from '../test/performance';
|
import { perfWasm } from '../test';
|
||||||
import { DEFAULT_PARAMS } from './defaults';
|
import { DEFAULT_PARAMS } from './defaults';
|
||||||
import { scryptEncode } from '.';
|
import { scryptEncode } from '.';
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ describe('scryptEncode', (): void => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
performanceWasm('scryptEncode', 4, (input, onlyJs) =>
|
perfWasm('scryptEncode', 4, (input, onlyJs) =>
|
||||||
scryptEncode(input, input, undefined, onlyJs)
|
scryptEncode(input, input, undefined, onlyJs)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { hexToU8a } from '@polkadot/util';
|
import { hexToU8a } from '@polkadot/util';
|
||||||
import { waitReady } from '@polkadot/wasm-crypto';
|
import { waitReady } from '@polkadot/wasm-crypto';
|
||||||
|
|
||||||
import { performanceWasm } from '../test/performance';
|
import { perfWasm } from '../test';
|
||||||
import { secp256k1Compress } from '.';
|
import { secp256k1Compress } from '.';
|
||||||
|
|
||||||
describe('secp256k1Compress', (): void => {
|
describe('secp256k1Compress', (): void => {
|
||||||
@@ -36,7 +36,7 @@ describe('secp256k1Compress', (): void => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
performanceWasm('secp256k1Compress', 100000, (input, onlyJs) => secp256k1Compress(input, onlyJs),
|
perfWasm('secp256k1Compress', 100000, (input, onlyJs) => secp256k1Compress(input, onlyJs),
|
||||||
[[
|
[[
|
||||||
hexToU8a('0x04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af')
|
hexToU8a('0x04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af')
|
||||||
]]
|
]]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { hexToU8a } from '@polkadot/util';
|
import { hexToU8a } from '@polkadot/util';
|
||||||
import { waitReady } from '@polkadot/wasm-crypto';
|
import { waitReady } from '@polkadot/wasm-crypto';
|
||||||
|
|
||||||
import { performanceWasm } from '../test/performance';
|
import { perfWasm } from '../test';
|
||||||
import { secp256k1Expand } from '.';
|
import { secp256k1Expand } from '.';
|
||||||
|
|
||||||
describe('secp256k1Expand', (): void => {
|
describe('secp256k1Expand', (): void => {
|
||||||
@@ -36,7 +36,7 @@ describe('secp256k1Expand', (): void => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
performanceWasm('secp256k1Expand', 2000, (input, onlyJs) => secp256k1Expand(input, onlyJs),
|
perfWasm('secp256k1Expand', 2000, (input, onlyJs) => secp256k1Expand(input, onlyJs),
|
||||||
[[
|
[[
|
||||||
hexToU8a('0x03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077')
|
hexToU8a('0x03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077')
|
||||||
]]
|
]]
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { hexToU8a, u8aToHex } from '@polkadot/util';
|
|||||||
import { waitReady } from '@polkadot/wasm-crypto';
|
import { waitReady } from '@polkadot/wasm-crypto';
|
||||||
|
|
||||||
import { mnemonicToMiniSecret } from '../../mnemonic';
|
import { mnemonicToMiniSecret } from '../../mnemonic';
|
||||||
import { performanceWasm } from '../../test/performance';
|
import { perfWasm } from '../../test';
|
||||||
import { secp256k1PairFromSeed } from '..';
|
import { secp256k1PairFromSeed } from '..';
|
||||||
|
|
||||||
// mnemonic, secret, public, account_id
|
// mnemonic, secret, public, account_id
|
||||||
@@ -65,7 +65,7 @@ describe('secp256k1PairFromSeed', (): void => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
performanceWasm('secp256k1PairFromSeed', 500, (input, onlyJs) =>
|
perfWasm('secp256k1PairFromSeed', 500, (input, onlyJs) =>
|
||||||
secp256k1PairFromSeed(input, onlyJs)
|
secp256k1PairFromSeed(input, onlyJs)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { u8aToHex, u8aToU8a } from '@polkadot/util';
|
|||||||
import { waitReady } from '@polkadot/wasm-crypto';
|
import { waitReady } from '@polkadot/wasm-crypto';
|
||||||
|
|
||||||
import { keccakAsU8a } from '../keccak';
|
import { keccakAsU8a } from '../keccak';
|
||||||
import { performanceWasm } from '../test/performance';
|
import { perfWasm } from '../test';
|
||||||
import { secp256k1Recover } from '.';
|
import { secp256k1Recover } from '.';
|
||||||
|
|
||||||
const sig = u8aToU8a('0x7505f2880114da51b3f5d535f8687953c0ab9af4ab81e592eaebebf53b728d2b6dfd9b5bcd70fee412b1f31360e7c2774009305cb84fc50c1d0ff8034dfa5fff');
|
const sig = u8aToU8a('0x7505f2880114da51b3f5d535f8687953c0ab9af4ab81e592eaebebf53b728d2b6dfd9b5bcd70fee412b1f31360e7c2774009305cb84fc50c1d0ff8034dfa5fff');
|
||||||
@@ -25,7 +25,7 @@ describe('secp256k1Recover', (): void => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
performanceWasm('secp256k1Recover', 200, (_, onlyJs) =>
|
perfWasm('secp256k1Recover', 200, (_, onlyJs) =>
|
||||||
secp256k1Recover(msg, sig, 0, undefined, onlyJs)
|
secp256k1Recover(msg, sig, 0, undefined, onlyJs)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { hexToU8a } from '@polkadot/util';
|
import { hexToU8a } from '@polkadot/util';
|
||||||
import { waitReady } from '@polkadot/wasm-crypto';
|
import { waitReady } from '@polkadot/wasm-crypto';
|
||||||
|
|
||||||
import { performanceWasm } from '../test/performance';
|
import { perfWasm } from '../test';
|
||||||
import { secp256k1PairFromSeed, secp256k1Sign } from '.';
|
import { secp256k1PairFromSeed, secp256k1Sign } from '.';
|
||||||
|
|
||||||
const pair = secp256k1PairFromSeed(hexToU8a('0x4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae'));
|
const pair = secp256k1PairFromSeed(hexToU8a('0x4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae'));
|
||||||
@@ -29,7 +29,7 @@ describe('sign', (): void => {
|
|||||||
|
|
||||||
// since the libsecp256k1 signatures don't match (but can be verified), we
|
// since the libsecp256k1 signatures don't match (but can be verified), we
|
||||||
// do both signing and verification here (checking the extracted key)
|
// do both signing and verification here (checking the extracted key)
|
||||||
performanceWasm('secp256k1Sign', 1000, (_, onlyJs) =>
|
perfWasm('secp256k1Sign', 1000, (_, onlyJs) =>
|
||||||
secp256k1Sign(msg, pair, undefined, onlyJs)
|
secp256k1Sign(msg, pair, undefined, onlyJs)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import '../bundleInit';
|
|||||||
import { hexToU8a } from '@polkadot/util';
|
import { hexToU8a } from '@polkadot/util';
|
||||||
import { waitReady } from '@polkadot/wasm-crypto';
|
import { waitReady } from '@polkadot/wasm-crypto';
|
||||||
|
|
||||||
import { performanceWasm } from '../test/performance';
|
import { perfWasm } from '../test';
|
||||||
import { hasher } from './hasher';
|
import { hasher } from './hasher';
|
||||||
import { secp256k1PairFromSeed, secp256k1Verify } from '.';
|
import { secp256k1PairFromSeed, secp256k1Verify } from '.';
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ describe('secp256k1Verify', (): void => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
performanceWasm('secp256k1Verify', 100, (_, onlyJs) =>
|
perfWasm('secp256k1Verify', 100, (_, onlyJs) =>
|
||||||
secp256k1Verify(
|
secp256k1Verify(
|
||||||
`\x19Ethereum Signed Message:\n${message.length.toString()}${message}`,
|
`\x19Ethereum Signed Message:\n${message.length.toString()}${message}`,
|
||||||
'0x55bd020bdbbdc02de34e915effc9b18a99002f4c29f64e22e8dcbb69e722ea6c28e1bb53b9484063fbbfd205e49dcc1f620929f520c9c4c3695150f05a28f52a01',
|
'0x55bd020bdbbdc02de34e915effc9b18a99002f4c29f64e22e8dcbb69e722ea6c28e1bb53b9484063fbbfd205e49dcc1f620929f520c9c4c3695150f05a28f52a01',
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { hexToU8a } from '@polkadot/util';
|
import { hexToU8a } from '@polkadot/util';
|
||||||
import { waitReady } from '@polkadot/wasm-crypto';
|
import { waitReady } from '@polkadot/wasm-crypto';
|
||||||
|
|
||||||
import { performanceWasm } from '../test/performance';
|
import { perfWasm } from '../test';
|
||||||
import { sha256AsU8a } from '.';
|
import { sha256AsU8a } from '.';
|
||||||
|
|
||||||
const TESTS = [
|
const TESTS = [
|
||||||
@@ -43,7 +43,7 @@ describe('sha256AsU8a', (): void => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
performanceWasm('sha256AsU8a', 128000, (input, onlyJs) =>
|
perfWasm('sha256AsU8a', 128000, (input, onlyJs) =>
|
||||||
sha256AsU8a(input, onlyJs)
|
sha256AsU8a(input, onlyJs)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import { waitReady } from '@polkadot/wasm-crypto';
|
import { waitReady } from '@polkadot/wasm-crypto';
|
||||||
|
|
||||||
import { performanceWasm } from '../test/performance';
|
import { perfWasm } from '../test';
|
||||||
import { sha512AsU8a } from '.';
|
import { sha512AsU8a } from '.';
|
||||||
|
|
||||||
describe('sha512AsU8a', (): void => {
|
describe('sha512AsU8a', (): void => {
|
||||||
@@ -23,7 +23,7 @@ describe('sha512AsU8a', (): void => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
performanceWasm('sha512AsU8a', 64000, (input, onlyJs) =>
|
perfWasm('sha512AsU8a', 64000, (input, onlyJs) =>
|
||||||
sha512AsU8a(input, onlyJs)
|
sha512AsU8a(input, onlyJs)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
export { perf, perfCmp } from '@polkadot/util/test';
|
||||||
|
|
||||||
|
export { perfWasm } from './performance';
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { arrayRange } from '@polkadot/util';
|
import { arrayRange } from '@polkadot/util';
|
||||||
import { perf, perfCmp } from '@polkadot/util/test/performance';
|
import { perf, perfCmp } from '@polkadot/util/test';
|
||||||
|
|
||||||
import { randomAsU8a } from '..';
|
import { randomAsU8a } from '..';
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ type ExecFn = (input: Uint8Array, onlyJs: boolean) => unknown;
|
|||||||
|
|
||||||
const GENERATED = arrayRange(256).map(() => [randomAsU8a()]);
|
const GENERATED = arrayRange(256).map(() => [randomAsU8a()]);
|
||||||
|
|
||||||
export function performanceWasm (name: string, count: number, exec: ExecFn, inputs = GENERATED): void {
|
export function perfWasm (name: string, count: number, exec: ExecFn, inputs = GENERATED): void {
|
||||||
perfCmp(name, ['WebAssembly', 'JavaScript'], count, inputs, exec);
|
perfCmp(name, ['WebAssembly', 'JavaScript'], count, inputs, exec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { hexToU8a } from '@polkadot/util';
|
import { hexToU8a } from '@polkadot/util';
|
||||||
import { waitReady } from '@polkadot/wasm-crypto';
|
import { waitReady } from '@polkadot/wasm-crypto';
|
||||||
|
|
||||||
import { performanceWasm } from '../test/performance';
|
import { perfWasm } from '../test';
|
||||||
import { xxhashAsU8a } from '.';
|
import { xxhashAsU8a } from '.';
|
||||||
|
|
||||||
describe('xxhashAsU8a', (): void => {
|
describe('xxhashAsU8a', (): void => {
|
||||||
@@ -38,7 +38,7 @@ describe('xxhashAsU8a', (): void => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
performanceWasm('xxhashAsU8a', 8000, (input, onlyJs) =>
|
perfWasm('xxhashAsU8a', 8000, (input, onlyJs) =>
|
||||||
xxhashAsU8a(input, 128, onlyJs)
|
xxhashAsU8a(input, 128, onlyJs)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,201 +0,0 @@
|
|||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
@@ -34,18 +34,18 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "10.2.2",
|
"version": "10.3.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.7",
|
"@babel/runtime": "^7.20.13",
|
||||||
"@polkadot/x-bigint": "10.2.2",
|
"@polkadot/x-bigint": "10.3.1",
|
||||||
"@polkadot/x-global": "10.2.2",
|
"@polkadot/x-global": "10.3.1",
|
||||||
"@polkadot/x-textdecoder": "10.2.2",
|
"@polkadot/x-textdecoder": "10.3.1",
|
||||||
"@polkadot/x-textencoder": "10.2.2",
|
"@polkadot/x-textencoder": "10.3.1",
|
||||||
"@types/bn.js": "^5.1.1",
|
"@types/bn.js": "^5.1.1",
|
||||||
"bn.js": "^5.2.1"
|
"bn.js": "^5.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/x-randomvalues": "10.2.2"
|
"@polkadot/x-randomvalues": "10.3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,27 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { arrayChunk, arrayRange } from '.';
|
import { arrayChunk, arrayRange } from '.';
|
||||||
|
|
||||||
describe('arrayChunk', (): void => {
|
describe('arrayChunk', (): void => {
|
||||||
it('chunks arrays', (): void => {
|
it('chunks with exact', (): void => {
|
||||||
|
expect(
|
||||||
|
arrayChunk([1, 2, 3, 4, 5, 6, 7, 8], 8)
|
||||||
|
).toEqual([[1, 2, 3, 4, 5, 6, 7, 8]]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('chunks with unequal', (): void => {
|
||||||
expect(
|
expect(
|
||||||
arrayChunk([1, 2, 3, 4, 5, 6, 7], 3)
|
arrayChunk([1, 2, 3, 4, 5, 6, 7], 3)
|
||||||
).toEqual([[1, 2, 3], [4, 5, 6], [7]]);
|
).toEqual([[1, 2, 3], [4, 5, 6], [7]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('chunks with non-empty results', (): void => {
|
||||||
|
expect(
|
||||||
|
arrayChunk([[1, 2], [3, 4], [5, 6], [7, 8]], 2)
|
||||||
|
).toEqual([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]);
|
||||||
|
});
|
||||||
|
|
||||||
perf('arrayChunk', 200_000, [[arrayRange(500), 50]], arrayChunk);
|
perf('arrayChunk', 200_000, [[arrayRange(500), 50]], arrayChunk);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { arrayFlatten } from '.';
|
import { arrayFlatten } from '.';
|
||||||
|
|
||||||
const PERF_ONE = [[1, 2, 3, 4, 5]];
|
const PERF_ONE = [[1, 2, 3, 4, 5]];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { arrayRange, arrayShuffle } from '.';
|
import { arrayRange, arrayShuffle } from '.';
|
||||||
|
|
||||||
const ptest = arrayRange(16284);
|
const ptest = arrayRange(16284);
|
||||||
|
|||||||
@@ -7,29 +7,95 @@ import { BigInt } from '@polkadot/x-bigint';
|
|||||||
* @name _0n
|
* @name _0n
|
||||||
* @summary BigInt constant for 0.
|
* @summary BigInt constant for 0.
|
||||||
*/
|
*/
|
||||||
export const _0n = BigInt(0);
|
export const _0n = /*#__PURE__*/ BigInt(0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name _1n
|
* @name _1n
|
||||||
* @summary BigInt constant for 1.
|
* @summary BigInt constant for 1.
|
||||||
*/
|
*/
|
||||||
export const _1n = BigInt(1);
|
export const _1n = /*#__PURE__*/ BigInt(1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name _2n
|
||||||
|
* @summary BigInt constant for 2.
|
||||||
|
*/
|
||||||
|
export const _2n = /*#__PURE__*/ BigInt(2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name _3n
|
||||||
|
* @summary BigInt constant for 3.
|
||||||
|
*/
|
||||||
|
export const _3n = /*#__PURE__*/ BigInt(3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name _4n
|
||||||
|
* @summary BigInt constant for 4.
|
||||||
|
*/
|
||||||
|
export const _4n = /*#__PURE__*/ BigInt(4);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name _5n
|
||||||
|
* @summary BigInt constant for 5.
|
||||||
|
*/
|
||||||
|
export const _5n = /*#__PURE__*/ BigInt(5);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name _6n
|
||||||
|
* @summary BigInt constant for 6.
|
||||||
|
*/
|
||||||
|
export const _6n = /*#__PURE__*/ BigInt(6);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name _7n
|
||||||
|
* @summary BigInt constant for 7.
|
||||||
|
*/
|
||||||
|
export const _7n = /*#__PURE__*/ BigInt(7);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name _8n
|
||||||
|
* @summary BigInt constant for 8.
|
||||||
|
*/
|
||||||
|
export const _8n = /*#__PURE__*/ BigInt(8);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name _9n
|
||||||
|
* @summary BigInt constant for 9.
|
||||||
|
*/
|
||||||
|
export const _9n = /*#__PURE__*/ BigInt(9);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name _10n
|
||||||
|
* @summary BigInt constant for 10.
|
||||||
|
*/
|
||||||
|
export const _10n = /*#__PURE__*/ BigInt(10);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name _100n
|
||||||
|
* @summary BigInt constant for 100.
|
||||||
|
*/
|
||||||
|
export const _100n = /*#__PURE__*/ BigInt(100);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name _1000n
|
||||||
|
* @summary BigInt constant for 1000.
|
||||||
|
*/
|
||||||
|
export const _1000n = /*#__PURE__*/ BigInt(1_000);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name _1Mn
|
* @name _1Mn
|
||||||
* @summary BigInt constant for 1,000,000.
|
* @summary BigInt constant for 1,000,000 (million).
|
||||||
*/
|
*/
|
||||||
export const _1Mn = BigInt(1_000_000);
|
export const _1Mn = /*#__PURE__*/ BigInt(1_000_000);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name _1Bn
|
* @name _1Bn
|
||||||
* @summary BigInt constant for 1,000,000,000.
|
* @summary BigInt constant for 1,000,000,000 (billion).
|
||||||
*/
|
*/
|
||||||
export const _1Bn = BigInt(1_000_000_000);
|
export const _1Bn = /*#__PURE__*/ BigInt(1_000_000_000);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name _1Qn
|
* @name _1Qn
|
||||||
* @summary BigInt constant for 1,000,000,000,000,000,000.
|
* @summary BigInt constant for 1,000,000,000,000,000,000 (quitillion).
|
||||||
*/
|
*/
|
||||||
export const _1Qn = _1Bn * _1Bn;
|
export const _1Qn = _1Bn * _1Bn;
|
||||||
|
|
||||||
@@ -37,4 +103,10 @@ export const _1Qn = _1Bn * _1Bn;
|
|||||||
* @name _2pow53n
|
* @name _2pow53n
|
||||||
* @summary BigInt constant for MAX_SAFE_INTEGER
|
* @summary BigInt constant for MAX_SAFE_INTEGER
|
||||||
*/
|
*/
|
||||||
export const _2pow53n = BigInt(Number.MAX_SAFE_INTEGER);
|
export const _2pow53n = /*#__PURE__*/ BigInt(Number.MAX_SAFE_INTEGER);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name _sqrt2pow53n
|
||||||
|
* @summary BigInt constant for Math.sqrt(MAX_SAFE_INTEGER)
|
||||||
|
*/
|
||||||
|
export const _sqrt2pow53n = /*#__PURE__*/ BigInt(94906265);
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { BN } from '../bn';
|
import { BN } from '../bn';
|
||||||
import { SQRT_MAX_SAFE_INTEGER } from './sqrt';
|
import { _sqrt2pow53n, nSqrt } from '.';
|
||||||
import { nSqrt } from '.';
|
|
||||||
|
|
||||||
export const SQRT_TESTS: [string | number | BN | bigint, string | number][] = [
|
export const SQRT_TESTS: [string | number | BN | bigint, string | number][] = [
|
||||||
[0, 0],
|
[0, 0],
|
||||||
@@ -41,7 +40,7 @@ describe('nSqrt', (): void => {
|
|||||||
~~Math.sqrt(
|
~~Math.sqrt(
|
||||||
Number.MAX_SAFE_INTEGER
|
Number.MAX_SAFE_INTEGER
|
||||||
)
|
)
|
||||||
) === SQRT_MAX_SAFE_INTEGER
|
) === _sqrt2pow53n
|
||||||
).toEqual(true);
|
).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,9 @@ import type { ToBigInt, ToBn } from '../types';
|
|||||||
|
|
||||||
import { BigInt } from '@polkadot/x-bigint';
|
import { BigInt } from '@polkadot/x-bigint';
|
||||||
|
|
||||||
import { _0n, _1n, _2pow53n } from './consts';
|
import { _0n, _1n, _2pow53n, _sqrt2pow53n } from './consts';
|
||||||
import { nToBigInt } from './toBigInt';
|
import { nToBigInt } from './toBigInt';
|
||||||
|
|
||||||
/** @internal */
|
|
||||||
export const SQRT_MAX_SAFE_INTEGER = BigInt(94906265);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name nSqrt
|
* @name nSqrt
|
||||||
* @summary Calculates the integer square root of a bigint
|
* @summary Calculates the integer square root of a bigint
|
||||||
@@ -32,7 +29,7 @@ export function nSqrt <ExtToBn extends ToBn | ToBigInt> (value: ExtToBn | BN | b
|
|||||||
|
|
||||||
// Use sqrt(MAX_SAFE_INTEGER) as starting point. since we already know the
|
// Use sqrt(MAX_SAFE_INTEGER) as starting point. since we already know the
|
||||||
// output will be larger than this, we expect this to be a safe start
|
// output will be larger than this, we expect this to be a safe start
|
||||||
let x0 = SQRT_MAX_SAFE_INTEGER;
|
let x0 = _sqrt2pow53n;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const x1 = ((n / x0) + x0) >> _1n;
|
const x1 = ((n / x0) + x0) >> _1n;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { arrayRange } from '../array';
|
import { arrayRange } from '../array';
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { nToU8a } from '.';
|
import { nToU8a } from '.';
|
||||||
|
|
||||||
const ptest = arrayRange(65536).map((v) => [v]);
|
const ptest = arrayRange(65536).map((v) => [v]);
|
||||||
|
|||||||
@@ -7,91 +7,91 @@ import { BN } from './bn';
|
|||||||
* @name BN_ZERO
|
* @name BN_ZERO
|
||||||
* @summary BN constant for 0.
|
* @summary BN constant for 0.
|
||||||
*/
|
*/
|
||||||
export const BN_ZERO: BN = new BN(0);
|
export const BN_ZERO: BN = /*#__PURE__*/ new BN(0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BN_ONE
|
* @name BN_ONE
|
||||||
* @summary BN constant for 1.
|
* @summary BN constant for 1.
|
||||||
*/
|
*/
|
||||||
export const BN_ONE: BN = new BN(1);
|
export const BN_ONE: BN = /*#__PURE__*/ new BN(1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BN_TWO
|
* @name BN_TWO
|
||||||
* @summary BN constant for 2.
|
* @summary BN constant for 2.
|
||||||
*/
|
*/
|
||||||
export const BN_TWO: BN = new BN(2);
|
export const BN_TWO: BN = /*#__PURE__*/ new BN(2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BN_THREE
|
* @name BN_THREE
|
||||||
* @summary BN constant for 3.
|
* @summary BN constant for 3.
|
||||||
*/
|
*/
|
||||||
export const BN_THREE: BN = new BN(3);
|
export const BN_THREE: BN = /*#__PURE__*/ new BN(3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BN_FOUR
|
* @name BN_FOUR
|
||||||
* @summary BN constant for 4.
|
* @summary BN constant for 4.
|
||||||
*/
|
*/
|
||||||
export const BN_FOUR: BN = new BN(4);
|
export const BN_FOUR: BN = /*#__PURE__*/ new BN(4);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BN_FIVE
|
* @name BN_FIVE
|
||||||
* @summary BN constant for 5.
|
* @summary BN constant for 5.
|
||||||
*/
|
*/
|
||||||
export const BN_FIVE: BN = new BN(5);
|
export const BN_FIVE: BN = /*#__PURE__*/ new BN(5);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BN_SIX
|
* @name BN_SIX
|
||||||
* @summary BN constant for 6.
|
* @summary BN constant for 6.
|
||||||
*/
|
*/
|
||||||
export const BN_SIX: BN = new BN(6);
|
export const BN_SIX: BN = /*#__PURE__*/ new BN(6);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BN_SEVEN
|
* @name BN_SEVEN
|
||||||
* @summary BN constant for 7.
|
* @summary BN constant for 7.
|
||||||
*/
|
*/
|
||||||
export const BN_SEVEN: BN = new BN(7);
|
export const BN_SEVEN: BN = /*#__PURE__*/ new BN(7);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BN_EIGHT
|
* @name BN_EIGHT
|
||||||
* @summary BN constant for 8.
|
* @summary BN constant for 8.
|
||||||
*/
|
*/
|
||||||
export const BN_EIGHT: BN = new BN(8);
|
export const BN_EIGHT: BN = /*#__PURE__*/ new BN(8);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BN_NINE
|
* @name BN_NINE
|
||||||
* @summary BN constant for 9.
|
* @summary BN constant for 9.
|
||||||
*/
|
*/
|
||||||
export const BN_NINE: BN = new BN(9);
|
export const BN_NINE: BN = /*#__PURE__*/ new BN(9);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BN_TEN
|
* @name BN_TEN
|
||||||
* @summary BN constant for 10.
|
* @summary BN constant for 10.
|
||||||
*/
|
*/
|
||||||
export const BN_TEN: BN = new BN(10);
|
export const BN_TEN: BN = /*#__PURE__*/ new BN(10);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BN_HUNDRED
|
* @name BN_HUNDRED
|
||||||
* @summary BN constant for 100.
|
* @summary BN constant for 100.
|
||||||
*/
|
*/
|
||||||
export const BN_HUNDRED: BN = new BN(100);
|
export const BN_HUNDRED: BN = /*#__PURE__*/ new BN(100);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BN_THOUSAND
|
* @name BN_THOUSAND
|
||||||
* @summary BN constant for 1,000.
|
* @summary BN constant for 1,000.
|
||||||
*/
|
*/
|
||||||
export const BN_THOUSAND: BN = new BN(1_000);
|
export const BN_THOUSAND: BN = /*#__PURE__*/ new BN(1_000);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BN_MILLION
|
* @name BN_MILLION
|
||||||
* @summary BN constant for 1,000,000.
|
* @summary BN constant for 1,000,000.
|
||||||
*/
|
*/
|
||||||
export const BN_MILLION: BN = new BN(1_000_000);
|
export const BN_MILLION: BN = /*#__PURE__*/ new BN(1_000_000);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BN_BILLION
|
* @name BN_BILLION
|
||||||
* @summary BN constant for 1,000,000,000.
|
* @summary BN constant for 1,000,000,000.
|
||||||
*/
|
*/
|
||||||
export const BN_BILLION: BN = new BN(1_000_000_000);
|
export const BN_BILLION: BN = /*#__PURE__*/ new BN(1_000_000_000);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BN_QUINTILL
|
* @name BN_QUINTILL
|
||||||
@@ -103,4 +103,10 @@ export const BN_QUINTILL: BN = BN_BILLION.mul(BN_BILLION);
|
|||||||
* @name BN_MAX_INTEGER
|
* @name BN_MAX_INTEGER
|
||||||
* @summary BN constant for MAX_SAFE_INTEGER
|
* @summary BN constant for MAX_SAFE_INTEGER
|
||||||
*/
|
*/
|
||||||
export const BN_MAX_INTEGER: BN = new BN(Number.MAX_SAFE_INTEGER);
|
export const BN_MAX_INTEGER: BN = /*#__PURE__*/ new BN(Number.MAX_SAFE_INTEGER);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name BN_SQRT_MAX_INTEGER
|
||||||
|
* @summary BN constant for Math.sqrt(MAX_SAFE_INTEGER)
|
||||||
|
*/
|
||||||
|
export const BN_SQRT_MAX_INTEGER: BN = /*#__PURE__*/ new BN(94906265);
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { SQRT_TESTS } from '../bi/sqrt.spec';
|
import { SQRT_TESTS } from '../bi/sqrt.spec';
|
||||||
import { SQRT_MAX_SAFE_INTEGER } from './sqrt';
|
import { BN, BN_SQRT_MAX_INTEGER, bnSqrt } from '.';
|
||||||
import { BN, bnSqrt } from '.';
|
|
||||||
|
|
||||||
describe('bnSqrt', (): void => {
|
describe('bnSqrt', (): void => {
|
||||||
it('fails on < 0 roots', (): void => {
|
it('fails on < 0 roots', (): void => {
|
||||||
@@ -14,7 +13,7 @@ describe('bnSqrt', (): void => {
|
|||||||
|
|
||||||
it('has the correct constant for sqrt(Number.MAX_SAFE_INTEGER)', (): void => {
|
it('has the correct constant for sqrt(Number.MAX_SAFE_INTEGER)', (): void => {
|
||||||
expect(
|
expect(
|
||||||
SQRT_MAX_SAFE_INTEGER.eq(
|
BN_SQRT_MAX_INTEGER.eq(
|
||||||
new BN(
|
new BN(
|
||||||
~~Math.sqrt(
|
~~Math.sqrt(
|
||||||
Number.MAX_SAFE_INTEGER
|
Number.MAX_SAFE_INTEGER
|
||||||
|
|||||||
@@ -4,12 +4,9 @@
|
|||||||
import type { ToBn } from '../types';
|
import type { ToBn } from '../types';
|
||||||
|
|
||||||
import { BN } from './bn';
|
import { BN } from './bn';
|
||||||
import { BN_MAX_INTEGER, BN_ONE } from './consts';
|
import { BN_MAX_INTEGER, BN_ONE, BN_SQRT_MAX_INTEGER } from './consts';
|
||||||
import { bnToBn } from './toBn';
|
import { bnToBn } from './toBn';
|
||||||
|
|
||||||
/** @internal */
|
|
||||||
export const SQRT_MAX_SAFE_INTEGER = new BN(94906265);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name bnSqrt
|
* @name bnSqrt
|
||||||
* @summary Calculates the integer square root of a BN
|
* @summary Calculates the integer square root of a BN
|
||||||
@@ -39,7 +36,7 @@ export function bnSqrt <ExtToBn extends ToBn> (value: ExtToBn | BN | bigint | st
|
|||||||
|
|
||||||
// Use sqrt(MAX_SAFE_INTEGER) as starting point. since we already know the
|
// Use sqrt(MAX_SAFE_INTEGER) as starting point. since we already know the
|
||||||
// output will be larger than this, we expect this to be a safe start
|
// output will be larger than this, we expect this to be a safe start
|
||||||
let x0 = SQRT_MAX_SAFE_INTEGER.clone();
|
let x0 = BN_SQRT_MAX_INTEGER.clone();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const x1 = n.div(x0).iadd(x0).ishrn(1);
|
const x1 = n.div(x0).iadd(x0).ishrn(1);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { arrayRange } from '../array';
|
import { arrayRange } from '../array';
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { BN, bnToU8a } from '.';
|
import { BN, bnToU8a } from '.';
|
||||||
|
|
||||||
const ptest = arrayRange(65536).map((v) => [v]);
|
const ptest = arrayRange(65536).map((v) => [v]);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import { BN } from '../bn/bn';
|
import { BN } from '../bn/bn';
|
||||||
import { hexToU8a } from '../hex/toU8a';
|
import { hexToU8a } from '../hex/toU8a';
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { compactFromU8a, compactFromU8aLim } from '.';
|
import { compactFromU8a, compactFromU8aLim } from '.';
|
||||||
|
|
||||||
describe('compactFromU8a', (): void => {
|
describe('compactFromU8a', (): void => {
|
||||||
|
|||||||
@@ -13,6 +13,13 @@ describe('formatBalance', (): void => {
|
|||||||
expect(formatBalance('0')).toEqual('0');
|
expect(formatBalance('0')).toEqual('0');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// this is after an issue/test from actual values with forceUnit
|
||||||
|
it('formats 1000 (BN) (decimals = 12, withAll, withZero = false)', (): void => {
|
||||||
|
expect(
|
||||||
|
formatBalance(new BN(1000), { decimals: 12, forceUnit: '-', withAll: true, withSi: false, withZero: true })
|
||||||
|
).toEqual('0.000000001000');
|
||||||
|
});
|
||||||
|
|
||||||
it('formats 123,456,789,000 (decimals=15)', (): void => {
|
it('formats 123,456,789,000 (decimals=15)', (): void => {
|
||||||
expect(
|
expect(
|
||||||
formatBalance(TESTVAL, { decimals: 15, withSi: true })
|
formatBalance(TESTVAL, { decimals: 15, withSi: true })
|
||||||
@@ -37,6 +44,24 @@ describe('formatBalance', (): void => {
|
|||||||
).toEqual('123.4567 µUnit');
|
).toEqual('123.4567 µUnit');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('formats 123,456,789,000 (decimals=10, withAll=true)', (): void => {
|
||||||
|
expect(
|
||||||
|
formatBalance(TESTVAL, { decimals: 10, forceUnit: '-', withAll: true, withSi: true })
|
||||||
|
).toEqual('12.3456789000 Unit');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('formats 123,456,789,000 (decimals=10, withAll=true, withZero=false)', (): void => {
|
||||||
|
expect(
|
||||||
|
formatBalance(TESTVAL, { decimals: 10, forceUnit: '-', withAll: true, withSi: true, withZero: false })
|
||||||
|
).toEqual('12.3456789 Unit');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('formats 123,000,000,000 (decimals=9, withAll=true, withZero=false)', (): void => {
|
||||||
|
expect(
|
||||||
|
formatBalance('123000000000', { decimals: 9, forceUnit: '-', withAll: true, withSi: true, withZero: false })
|
||||||
|
).toEqual('123 Unit');
|
||||||
|
});
|
||||||
|
|
||||||
it('formats 123,456,789,000 (decimals=15, Compact)', (): void => {
|
it('formats 123,456,789,000 (decimals=15, Compact)', (): void => {
|
||||||
const compact = {
|
const compact = {
|
||||||
something: 'else',
|
something: 'else',
|
||||||
|
|||||||
@@ -29,7 +29,11 @@ interface Options {
|
|||||||
*/
|
*/
|
||||||
forceUnit?: string;
|
forceUnit?: string;
|
||||||
/**
|
/**
|
||||||
* @description Format with SI, i.e. m/M/etc.
|
* @description Returns value using all available decimals
|
||||||
|
*/
|
||||||
|
withAll?: boolean;
|
||||||
|
/**
|
||||||
|
* @description Format with SI, i.e. m/M/etc. (default = true)
|
||||||
*/
|
*/
|
||||||
withSi?: boolean;
|
withSi?: boolean;
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +44,10 @@ interface Options {
|
|||||||
* @description Add the unit (useful in Balance formats)
|
* @description Add the unit (useful in Balance formats)
|
||||||
*/
|
*/
|
||||||
withUnit?: boolean | string;
|
withUnit?: boolean | string;
|
||||||
|
/**
|
||||||
|
* @description Returns all trailing zeros, otherwise removes (default = true)
|
||||||
|
*/
|
||||||
|
withZero?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BalanceFormatter {
|
interface BalanceFormatter {
|
||||||
@@ -57,35 +65,10 @@ const DEFAULT_UNIT = SI[SI_MID].text;
|
|||||||
let defaultDecimals = DEFAULT_DECIMALS;
|
let defaultDecimals = DEFAULT_DECIMALS;
|
||||||
let defaultUnit = DEFAULT_UNIT;
|
let defaultUnit = DEFAULT_UNIT;
|
||||||
|
|
||||||
function getUnits (si: SiDef, withSi: boolean, withSiFull: boolean, withUnit: boolean | string): string {
|
|
||||||
const unit = isBoolean(withUnit)
|
|
||||||
? SI[SI_MID].text
|
|
||||||
: withUnit;
|
|
||||||
|
|
||||||
return withSi || withSiFull
|
|
||||||
? si.value === '-'
|
|
||||||
? withUnit
|
|
||||||
? ` ${unit}`
|
|
||||||
: ''
|
|
||||||
: ` ${withSiFull ? `${si.text}${withUnit ? ' ' : ''}` : si.value}${withUnit ? unit : ''}`
|
|
||||||
: '';
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPrePost (text: string, decimals: number, forceUnit?: string): [SiDef, string, string] {
|
|
||||||
// NOTE We start at midpoint (8) minus 1 - this means that values display as
|
|
||||||
// 123.456 instead of 0.123k (so always 6 relevant). Additionally we use ceil
|
|
||||||
// so there are at most 3 decimal before the decimal separator
|
|
||||||
const si = calcSi(text, decimals, forceUnit);
|
|
||||||
const mid = text.length - (decimals + si.power);
|
|
||||||
const prefix = text.substring(0, mid);
|
|
||||||
const padding = mid < 0 ? 0 - mid : 0;
|
|
||||||
const postfix = `${`${new Array(padding + 1).join('0')}${text}`.substring(mid < 0 ? 0 : mid)}0000`.substring(0, 4);
|
|
||||||
|
|
||||||
return [si, prefix || '0', postfix];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Formats a string/number with <prefix>.<postfix><type> notation
|
// Formats a string/number with <prefix>.<postfix><type> notation
|
||||||
function _formatBalance <ExtToBn extends ToBn> (input?: number | string | BN | bigint | ExtToBn, { decimals = defaultDecimals, forceUnit, withSi = true, withSiFull = false, withUnit = true }: Options = {}): string {
|
function _formatBalance <ExtToBn extends ToBn> (input?: number | string | BN | bigint | ExtToBn, { decimals = defaultDecimals, forceUnit, withAll = false, withSi = true, withSiFull = false, withUnit = true, withZero = true }: Options = {}): string {
|
||||||
|
// we only work with string inputs here - convert anything
|
||||||
|
// into the string-only value
|
||||||
let text = bnToBn(input).toString();
|
let text = bnToBn(input).toString();
|
||||||
|
|
||||||
if (text.length === 0 || text === '0') {
|
if (text.length === 0 || text === '0') {
|
||||||
@@ -101,22 +84,59 @@ function _formatBalance <ExtToBn extends ToBn> (input?: number | string | BN | b
|
|||||||
text = text.substring(1);
|
text = text.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const [si, prefix, postfix] = getPrePost(text, decimals, forceUnit);
|
// We start at midpoint (8) minus 1 - this means that values display as
|
||||||
const units = getUnits(si, withSi, withSiFull, withUnit);
|
// 123.4567 instead of 0.1234 k (so we always have the most relevant).
|
||||||
|
const si = calcSi(text, decimals, forceUnit);
|
||||||
|
const mid = text.length - (decimals + si.power);
|
||||||
|
const pre = mid <= 0 ? '0' : text.substring(0, mid);
|
||||||
|
|
||||||
return `${sign}${formatDecimal(prefix)}.${postfix}${units}`;
|
// get the post from the midpoint onward and then first add max decimals
|
||||||
|
// before trimming to the correct (calculated) amount of decimals again
|
||||||
|
let post = text
|
||||||
|
.padStart(mid < 0 ? decimals : 1, '0')
|
||||||
|
.substring(mid < 0 ? 0 : mid)
|
||||||
|
.padEnd(withAll ? Math.max(decimals, 4) : 4, '0')
|
||||||
|
.substring(0, withAll ? Math.max(4, decimals + si.power) : 4);
|
||||||
|
|
||||||
|
// remove all trailing 0's (if required via flag)
|
||||||
|
if (!withZero) {
|
||||||
|
let end = post.length - 1;
|
||||||
|
|
||||||
|
// This looks inefficient, however it is better to do the checks and
|
||||||
|
// only make one final slice than it is to do it in multiples
|
||||||
|
do {
|
||||||
|
if (post[end] === '0') {
|
||||||
|
end--;
|
||||||
|
}
|
||||||
|
} while (post[end] === '0');
|
||||||
|
|
||||||
|
post = post.substring(0, end + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// the display unit
|
||||||
|
const unit = isBoolean(withUnit)
|
||||||
|
? SI[SI_MID].text
|
||||||
|
: withUnit;
|
||||||
|
|
||||||
|
// format the units for display based on the flags
|
||||||
|
const units = withSi || withSiFull
|
||||||
|
? si.value === '-'
|
||||||
|
? withUnit
|
||||||
|
? ` ${unit}`
|
||||||
|
: ''
|
||||||
|
: ` ${withSiFull ? `${si.text}${withUnit ? ' ' : ''}` : si.value}${withUnit ? unit : ''}`
|
||||||
|
: '';
|
||||||
|
|
||||||
|
return `${sign}${formatDecimal(pre)}${post && `.${post}`}${units}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const formatBalance = _formatBalance as BalanceFormatter;
|
export const formatBalance = _formatBalance as BalanceFormatter;
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
||||||
formatBalance.calcSi = (text: string, decimals: number = defaultDecimals): SiDef =>
|
formatBalance.calcSi = (text: string, decimals: number = defaultDecimals): SiDef =>
|
||||||
calcSi(text, decimals);
|
calcSi(text, decimals);
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
||||||
formatBalance.findSi = findSi;
|
formatBalance.findSi = findSi;
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
||||||
formatBalance.getDefaults = (): Defaults => {
|
formatBalance.getDefaults = (): Defaults => {
|
||||||
return {
|
return {
|
||||||
decimals: defaultDecimals,
|
decimals: defaultDecimals,
|
||||||
@@ -125,7 +145,6 @@ formatBalance.getDefaults = (): Defaults => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// get allowable options to display in a dropdown
|
// get allowable options to display in a dropdown
|
||||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
||||||
formatBalance.getOptions = (decimals: number = defaultDecimals): SiDef[] => {
|
formatBalance.getOptions = (decimals: number = defaultDecimals): SiDef[] => {
|
||||||
return SI.filter(({ power }): boolean =>
|
return SI.filter(({ power }): boolean =>
|
||||||
power < 0
|
power < 0
|
||||||
@@ -135,7 +154,6 @@ formatBalance.getOptions = (decimals: number = defaultDecimals): SiDef[] => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Sets the default decimals to use for formatting (ui-wide)
|
// Sets the default decimals to use for formatting (ui-wide)
|
||||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
||||||
formatBalance.setDefaults = ({ decimals, unit }: SetDefaults): void => {
|
formatBalance.setDefaults = ({ decimals, unit }: SetDefaults): void => {
|
||||||
defaultDecimals = decimals === undefined
|
defaultDecimals = decimals === undefined
|
||||||
? defaultDecimals
|
? defaultDecimals
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ declare const __dirname: unknown;
|
|||||||
declare const module: unknown;
|
declare const module: unknown;
|
||||||
declare const require: unknown;
|
declare const require: unknown;
|
||||||
|
|
||||||
|
// We define a scappy low-level interface to mock Buffer
|
||||||
|
// (this removes the need for the node typings)
|
||||||
|
type BufferClass = ((value: unknown) => unknown) & {
|
||||||
|
isBuffer: (value: unknown) => boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/** true if the environment has proper BigInt support */
|
/** true if the environment has proper BigInt support */
|
||||||
export const hasBigInt = typeof BigInt === 'function' && typeof BigInt.asIntN === 'function';
|
export const hasBigInt = typeof BigInt === 'function' && typeof BigInt.asIntN === 'function';
|
||||||
|
|
||||||
@@ -30,7 +36,7 @@ export const hasWasm = typeof WebAssembly !== 'undefined';
|
|||||||
// that some bundlers such as parcel would add (this is a check, not a use)
|
// that some bundlers such as parcel would add (this is a check, not a use)
|
||||||
|
|
||||||
/** true if the environment has support for Buffer (typically Node.js) */
|
/** true if the environment has support for Buffer (typically Node.js) */
|
||||||
export const hasBuffer = typeof xglobal.Buffer !== 'undefined';
|
export const hasBuffer = typeof xglobal.Buffer === 'function' && typeof (xglobal.Buffer as BufferClass).isBuffer === 'function';
|
||||||
|
|
||||||
/** true if the environment has process available (typically Node.js) */
|
/** true if the environment has process available (typically Node.js) */
|
||||||
export const hasProcess = typeof xglobal.process === 'object';
|
export const hasProcess = typeof xglobal.process === 'object';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perfCmp } from '../test/performance';
|
import { perfCmp } from '../test';
|
||||||
import { hexToU8a as hexToU8aBuffer } from './toU8aBuffer';
|
import { hexToU8a as hexToU8aBuffer } from './toU8aBuffer';
|
||||||
import { hexToU8a } from '.';
|
import { hexToU8a } from '.';
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ describe('hexToU8a', (): void => {
|
|||||||
).toThrow(/hex value to convert/);
|
).toThrow(/hex value to convert/);
|
||||||
});
|
});
|
||||||
|
|
||||||
perfCmp('hexToU8a', ['hexToU8aBuffer', 'hexToU8a'], 25, [[ptest]], (s: string, isSecond) =>
|
perfCmp('hexToU8a', ['hexToU8aBuffer', 'hexToU8a'], 40, [[ptest]], (s: string, isSecond) =>
|
||||||
isSecond
|
isSecond
|
||||||
? hexToU8a(s)
|
? hexToU8a(s)
|
||||||
: hexToU8aBuffer(s)
|
: hexToU8aBuffer(s)
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
import type { HexString } from '../types';
|
import type { HexString } from '../types';
|
||||||
|
|
||||||
const CHR = '0123456789abcdef';
|
const CHR = '0123456789abcdef';
|
||||||
const U8 = new Array<number>(256);
|
const U8 = new Uint8Array(256);
|
||||||
const U16 = new Array<number>(256 * 256);
|
const U16 = new Uint8Array(256 * 256);
|
||||||
|
|
||||||
for (let i = 0; i < CHR.length; i++) {
|
for (let i = 0; i < CHR.length; i++) {
|
||||||
U8[CHR[i].charCodeAt(0) | 0] = i | 0;
|
U8[CHR[i].charCodeAt(0) | 0] = i | 0;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { stringToU8a } from '../string';
|
import { stringToU8a } from '../string';
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { isAscii } from '.';
|
import { isAscii } from '.';
|
||||||
|
|
||||||
describe('isAscii', (): void => {
|
describe('isAscii', (): void => {
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import { xglobal } from '@polkadot/x-global';
|
||||||
|
|
||||||
import { hasBuffer } from '../has';
|
import { hasBuffer } from '../has';
|
||||||
import { isFunction } from './function';
|
import { isFunction } from './function';
|
||||||
|
|
||||||
|
// We define these interfaces to not have the Buffer type
|
||||||
|
// (doing this removes the need for node types being available)
|
||||||
|
interface BufTyp { isBuffer: (value: unknown) => boolean }
|
||||||
|
interface BufObj { readDoubleLE: (...args: unknown[]) => unknown }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name isBuffer
|
* @name isBuffer
|
||||||
* @summary Tests for a `Buffer` object instance.
|
* @summary Tests for a `Buffer` object instance.
|
||||||
@@ -20,5 +27,5 @@ import { isFunction } from './function';
|
|||||||
*/
|
*/
|
||||||
export function isBuffer (value: unknown): value is Buffer {
|
export function isBuffer (value: unknown): value is Buffer {
|
||||||
// we do check a function first, since it is slightly faster than isBuffer itself
|
// we do check a function first, since it is slightly faster than isBuffer itself
|
||||||
return hasBuffer && isFunction(value && (value as Buffer).readDoubleLE) && Buffer.isBuffer(value);
|
return hasBuffer && isFunction(value && (value as BufObj).readDoubleLE) && (xglobal.Buffer as BufTyp).isBuffer(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perfCmp } from '../test/performance';
|
import { perfCmp } from '../test';
|
||||||
import { isCodec } from '.';
|
import { isCodec } from '.';
|
||||||
|
|
||||||
const ptest = {
|
const ptest = {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { isHex } from '.';
|
import { isHex } from '.';
|
||||||
|
|
||||||
describe('isHex', (): void => {
|
describe('isHex', (): void => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { isU8a } from '.';
|
import { isU8a } from '.';
|
||||||
|
|
||||||
describe('isU8a', (): void => {
|
describe('isU8a', (): void => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { isUndefined } from '.';
|
import { isUndefined } from '.';
|
||||||
|
|
||||||
describe('isUndefined', (): void => {
|
describe('isUndefined', (): void => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { objectProperties, objectProperty } from '.';
|
import { objectProperties, objectProperty } from '.';
|
||||||
|
|
||||||
describe('objectProperty/objectProperties', (): void => {
|
describe('objectProperty/objectProperties', (): void => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { objectSpread } from '.';
|
import { objectSpread } from '.';
|
||||||
|
|
||||||
describe('objectSpread', (): void => {
|
describe('objectSpread', (): void => {
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/util', path: 'auto', type: 'auto', version: '10.2.2' };
|
export const packageInfo = { name: '@polkadot/util', path: 'auto', type: 'auto', version: '10.3.1' };
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { getRandomValues } from '@polkadot/x-randomvalues';
|
import { getRandomValues } from '@polkadot/x-randomvalues';
|
||||||
|
|
||||||
import { arrayRange } from '../array';
|
import { arrayRange } from '../array';
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { stringCamelCase, stringUpperFirst } from '.';
|
import { stringCamelCase, stringUpperFirst } from '.';
|
||||||
|
|
||||||
const SEPS = [' ', '_', '-', '.', ','];
|
const SEPS = [' ', '_', '-', '.', ','];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { stringLowerFirst } from '.';
|
import { stringLowerFirst } from '.';
|
||||||
|
|
||||||
describe('stringLowerFirst', (): void => {
|
describe('stringLowerFirst', (): void => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { stringUpperFirst } from '.';
|
import { stringUpperFirst } from '.';
|
||||||
|
|
||||||
describe('stringUpperFirst', (): void => {
|
describe('stringUpperFirst', (): void => {
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
export { perf, perfCmp } from './performance';
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { u8aCmp } from '.';
|
import { u8aCmp } from '.';
|
||||||
|
|
||||||
const ltest = new Uint8Array(32768);
|
const ltest = new Uint8Array(32768);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { getRandomValues } from '@polkadot/x-randomvalues';
|
import { getRandomValues } from '@polkadot/x-randomvalues';
|
||||||
|
|
||||||
import { arrayRange } from '../array';
|
import { arrayRange } from '../array';
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { u8aConcat, u8aConcatStrict } from '.';
|
import { u8aConcat, u8aConcatStrict } from '.';
|
||||||
|
|
||||||
const ptest = arrayRange(10).map(() => getRandomValues(new Uint8Array(32)));
|
const ptest = arrayRange(10).map(() => getRandomValues(new Uint8Array(32)));
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { u8aEmpty } from '.';
|
import { u8aEmpty } from '.';
|
||||||
|
|
||||||
describe('u8aEmpty', (): void => {
|
describe('u8aEmpty', (): void => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { u8aEq } from '.';
|
import { u8aEq } from '.';
|
||||||
|
|
||||||
const ltest = new Uint8Array(32768);
|
const ltest = new Uint8Array(32768);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { u8aToBigInt } from '.';
|
import { u8aToBigInt } from '.';
|
||||||
|
|
||||||
describe('u8aToBigInt', (): void => {
|
describe('u8aToBigInt', (): void => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { u8aToBn } from '.';
|
import { u8aToBn } from '.';
|
||||||
|
|
||||||
describe('u8aToBn', (): void => {
|
describe('u8aToBn', (): void => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perfCmp } from '../test/performance';
|
import { perfCmp } from '../test';
|
||||||
import { u8aToHex as u8aToHexBuffer } from './toHexBuffer';
|
import { u8aToHex as u8aToHexBuffer } from './toHexBuffer';
|
||||||
import { u8aToHex } from '.';
|
import { u8aToHex } from '.';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { u8aToNumber } from '.';
|
import { u8aToNumber } from '.';
|
||||||
|
|
||||||
describe('u8aToNumber', (): void => {
|
describe('u8aToNumber', (): void => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { perf } from '../test/performance';
|
import { perf } from '../test';
|
||||||
import { u8aToU8a } from '.';
|
import { u8aToU8a } from '.';
|
||||||
|
|
||||||
describe('u8aToU8a', (): void => {
|
describe('u8aToU8a', (): void => {
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
"./shim.cjs"
|
"./shim.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "10.2.2",
|
"version": "10.3.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.7",
|
"@babel/runtime": "^7.20.13",
|
||||||
"@polkadot/x-global": "10.2.2"
|
"@polkadot/x-global": "10.3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/x-bigint', path: 'auto', type: 'auto', version: '10.2.2' };
|
export const packageInfo = { name: '@polkadot/x-bigint', path: 'auto', type: 'auto', version: '10.3.1' };
|
||||||
|
|||||||
@@ -17,11 +17,11 @@
|
|||||||
},
|
},
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "10.2.2",
|
"version": "10.3.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.7",
|
"@babel/runtime": "^7.20.13",
|
||||||
"@polkadot/util": "10.2.2",
|
"@polkadot/util": "10.3.1",
|
||||||
"buffer-es6": "^4.9.3"
|
"buffer-es6": "^4.9.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/x-bundle', path: 'auto', type: 'auto', version: '10.2.2' };
|
export const packageInfo = { name: '@polkadot/x-bundle', path: 'auto', type: 'auto', version: '10.3.1' };
|
||||||
|
|||||||
@@ -17,13 +17,13 @@
|
|||||||
},
|
},
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "10.2.2",
|
"version": "10.3.1",
|
||||||
"browser": "browser.js",
|
"browser": "browser.js",
|
||||||
"main": "node.js",
|
"main": "node.js",
|
||||||
"react-native": "react-native.js",
|
"react-native": "react-native.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.7",
|
"@babel/runtime": "^7.20.13",
|
||||||
"@polkadot/x-global": "10.2.2",
|
"@polkadot/x-global": "10.3.1",
|
||||||
"@types/node-fetch": "^2.6.2",
|
"@types/node-fetch": "^2.6.2",
|
||||||
"node-fetch": "^3.3.0"
|
"node-fetch": "^3.3.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/x-fetch', path: 'auto', type: 'auto', version: '10.2.2' };
|
export const packageInfo = { name: '@polkadot/x-fetch', path: 'auto', type: 'auto', version: '10.3.1' };
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
},
|
},
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "10.2.2",
|
"version": "10.3.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.7"
|
"@babel/runtime": "^7.20.13"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/x-global', path: 'auto', type: 'auto', version: '10.2.2' };
|
export const packageInfo = { name: '@polkadot/x-global', path: 'auto', type: 'auto', version: '10.3.1' };
|
||||||
|
|||||||
@@ -17,16 +17,17 @@
|
|||||||
},
|
},
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "10.2.2",
|
"version": "10.3.1",
|
||||||
"browser": "browser.js",
|
"browser": "browser.js",
|
||||||
"main": "node.js",
|
"main": "node.js",
|
||||||
"react-native": "react-native.js",
|
"react-native": "react-native.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.7",
|
"@babel/runtime": "^7.20.13",
|
||||||
"@polkadot/x-global": "10.2.2"
|
"@polkadot/x-global": "10.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react-native": "^0.70.8"
|
"@polkadot/util": "10.3.1",
|
||||||
|
"@types/react-native": "^0.71.0"
|
||||||
},
|
},
|
||||||
"denoDependencies": {
|
"denoDependencies": {
|
||||||
"crypto": "std@0.161.0/node/crypto.ts"
|
"crypto": "std@0.161.0/node/crypto.ts"
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
|
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import { perf } from '@polkadot/util/test';
|
||||||
|
|
||||||
import { base64Decode } from './base64';
|
import { base64Decode } from './base64';
|
||||||
|
|
||||||
|
const HELLO_DUAL = 'aGVsbG8gd29ybGQg0J/RgNC40LLQtdGC0YHRgtCy0YPRjiDQvNC4IOS9oOWlvQ==';
|
||||||
|
|
||||||
const TESTS = [
|
const TESTS = [
|
||||||
{
|
{
|
||||||
// hello world Приветствую ми 你好
|
// hello world Приветствую ми 你好
|
||||||
base64: 'aGVsbG8gd29ybGQg0J/RgNC40LLQtdGC0YHRgtCy0YPRjiDQvNC4IOS9oOWlvQ==',
|
base64: HELLO_DUAL,
|
||||||
expect: new Uint8Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 32, 208, 159, 209, 128, 208, 184, 208, 178, 208, 181, 209, 130, 209, 129, 209, 130, 208, 178, 209, 131, 209, 142, 32, 208, 188, 208, 184, 32, 228, 189, 160, 229, 165, 189])
|
expect: new Uint8Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 32, 208, 159, 209, 128, 208, 184, 208, 178, 208, 181, 209, 130, 209, 129, 209, 130, 208, 178, 209, 131, 209, 142, 32, 208, 188, 208, 184, 32, 228, 189, 160, 229, 165, 189])
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -40,3 +44,5 @@ describe('base64Decode', (): void => {
|
|||||||
).toEqual(test.expect);
|
).toEqual(test.expect);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
perf('base64Decode (hello, dual)', 100_000, [[HELLO_DUAL]], base64Decode);
|
||||||
|
|||||||
@@ -9,6 +9,14 @@
|
|||||||
// We provide an own (tiny) decoder to not have Buffer deps
|
// We provide an own (tiny) decoder to not have Buffer deps
|
||||||
|
|
||||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||||
|
const map = new Uint8Array(256);
|
||||||
|
|
||||||
|
// We use charCodeAt for access here and in the decoder loop - this is faster
|
||||||
|
// on lookups (array + numbers) and also faster than accessing the specific
|
||||||
|
// character via data[i] (around a 50% improvement on perf tests)
|
||||||
|
for (let i = 0; i < chars.length; i++) {
|
||||||
|
map[chars.charCodeAt(i)] = i;
|
||||||
|
}
|
||||||
|
|
||||||
export function base64Decode (data: string): Uint8Array {
|
export function base64Decode (data: string): Uint8Array {
|
||||||
const bytes = [];
|
const bytes = [];
|
||||||
@@ -17,7 +25,7 @@ export function base64Decode (data: string): Uint8Array {
|
|||||||
|
|
||||||
for (let i = 0; i < data.length && data[i] !== '='; i++) {
|
for (let i = 0; i < data.length && data[i] !== '='; i++) {
|
||||||
// each character represents 6 bits
|
// each character represents 6 bits
|
||||||
byte = (byte << 6) | chars.indexOf(data[i]);
|
byte = (byte << 6) | map[data.charCodeAt(i)];
|
||||||
|
|
||||||
// each byte needs to contain 8 bits
|
// each byte needs to contain 8 bits
|
||||||
if ((bits += 6) >= 8) {
|
if ((bits += 6) >= 8) {
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/x-randomvalues', path: 'auto', type: 'auto', version: '10.2.2' };
|
export const packageInfo = { name: '@polkadot/x-randomvalues', path: 'auto', type: 'auto', version: '10.3.1' };
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
"outDir": "./build",
|
"outDir": "./build",
|
||||||
"rootDir": "./src"
|
"rootDir": "./src"
|
||||||
},
|
},
|
||||||
|
"exclude": [
|
||||||
|
"**/*.spec.ts"
|
||||||
|
],
|
||||||
"references": [
|
"references": [
|
||||||
{ "path": "../x-global/tsconfig.build.json" }
|
{ "path": "../x-global/tsconfig.build.json" }
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": "..",
|
||||||
|
"outDir": "./build",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"emitDeclarationOnly": false,
|
||||||
|
"noEmit": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"**/*.spec.ts"
|
||||||
|
],
|
||||||
|
"references": [
|
||||||
|
{ "path": "../util/tsconfig.build.json" },
|
||||||
|
{ "path": "../x-global/tsconfig.build.json" }
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -17,13 +17,13 @@
|
|||||||
},
|
},
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "10.2.2",
|
"version": "10.3.1",
|
||||||
"browser": "browser.js",
|
"browser": "browser.js",
|
||||||
"main": "node.js",
|
"main": "node.js",
|
||||||
"react-native": "react-native.js",
|
"react-native": "react-native.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.7",
|
"@babel/runtime": "^7.20.13",
|
||||||
"@polkadot/x-global": "10.2.2"
|
"@polkadot/x-global": "10.3.1"
|
||||||
},
|
},
|
||||||
"denoDependencies": {
|
"denoDependencies": {
|
||||||
"util": "std@0.161.0/node/util.ts"
|
"util": "std@0.161.0/node/util.ts"
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user