@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.mjs CHANGED
@@ -487,11 +487,15 @@ function isBip32Path(path) {
487
487
  function splitAccountPath(path) {
488
488
  const normalized = normalizePath(path);
489
489
  const segments = normalized.slice(2).split("/");
490
- if (segments.length <= 3) {
490
+ let accountLength = 0;
491
+ segments.forEach((segment, index) => {
492
+ if (segment.endsWith("'")) accountLength = index + 1;
493
+ });
494
+ if (segments.length <= 3 || accountLength === 0 || accountLength === segments.length) {
491
495
  return { accountPath: normalized, relativeDerivePath: "" };
492
496
  }
493
- const accountSegments = segments.slice(0, segments.length - 2);
494
- const relativeSegments = segments.slice(segments.length - 2);
497
+ const accountSegments = segments.slice(0, accountLength);
498
+ const relativeSegments = segments.slice(accountLength);
495
499
  return {
496
500
  accountPath: `m/${accountSegments.join("/")}`,
497
501
  relativeDerivePath: relativeSegments.join("/")