@onekeyfe/hwk-keystone-adapter 1.2.8-alpha.52 → 1.2.8-alpha.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -422,8 +422,9 @@ declare class KeystoneAdapter implements IHardwareWallet {
|
|
|
422
422
|
/** Always returns an `m/`-prefixed path, regardless of the input's casing/prefix. */
|
|
423
423
|
declare function normalizePath(path: string): string;
|
|
424
424
|
/**
|
|
425
|
-
* Splits a
|
|
426
|
-
*
|
|
425
|
+
* Splits a leaf path after its last hardened segment: the account path is what Keystone exports,
|
|
426
|
+
* the unhardened rest is derived from it offline (`change/index`, or a bare `index` for Ledger
|
|
427
|
+
* Legacy `m/44'/60'/0'/<index>`). A path of 3 or fewer segments is already an account path.
|
|
427
428
|
*/
|
|
428
429
|
declare function splitAccountPath(path: string): {
|
|
429
430
|
accountPath: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -422,8 +422,9 @@ declare class KeystoneAdapter implements IHardwareWallet {
|
|
|
422
422
|
/** Always returns an `m/`-prefixed path, regardless of the input's casing/prefix. */
|
|
423
423
|
declare function normalizePath(path: string): string;
|
|
424
424
|
/**
|
|
425
|
-
* Splits a
|
|
426
|
-
*
|
|
425
|
+
* Splits a leaf path after its last hardened segment: the account path is what Keystone exports,
|
|
426
|
+
* the unhardened rest is derived from it offline (`change/index`, or a bare `index` for Ledger
|
|
427
|
+
* Legacy `m/44'/60'/0'/<index>`). A path of 3 or fewer segments is already an account path.
|
|
427
428
|
*/
|
|
428
429
|
declare function splitAccountPath(path: string): {
|
|
429
430
|
accountPath: string;
|
package/dist/index.js
CHANGED
|
@@ -479,11 +479,15 @@ function isBip32Path(path) {
|
|
|
479
479
|
function splitAccountPath(path) {
|
|
480
480
|
const normalized = normalizePath(path);
|
|
481
481
|
const segments = normalized.slice(2).split("/");
|
|
482
|
-
|
|
482
|
+
let accountLength = 0;
|
|
483
|
+
segments.forEach((segment, index) => {
|
|
484
|
+
if (segment.endsWith("'")) accountLength = index + 1;
|
|
485
|
+
});
|
|
486
|
+
if (segments.length <= 3 || accountLength === 0 || accountLength === segments.length) {
|
|
483
487
|
return { accountPath: normalized, relativeDerivePath: "" };
|
|
484
488
|
}
|
|
485
|
-
const accountSegments = segments.slice(0,
|
|
486
|
-
const relativeSegments = segments.slice(
|
|
489
|
+
const accountSegments = segments.slice(0, accountLength);
|
|
490
|
+
const relativeSegments = segments.slice(accountLength);
|
|
487
491
|
return {
|
|
488
492
|
accountPath: `m/${accountSegments.join("/")}`,
|
|
489
493
|
relativeDerivePath: relativeSegments.join("/")
|