Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extended key property to SLIP10Node #196

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 2 additions & 26 deletions src/BIP44Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ import {
MIN_BIP_44_DEPTH,
} from './constants';
import type { SupportedCurve } from './curves';
import {
decodeExtendedKey,
encodeExtendedKey,
PRIVATE_KEY_VERSION,
PUBLIC_KEY_VERSION,
} from './extended-keys';
import { decodeExtendedKey, PRIVATE_KEY_VERSION } from './extended-keys';
import { SLIP10Node, validateBIP32Depth } from './SLIP10Node';
import { isHardened } from './utils';

Expand Down Expand Up @@ -279,26 +274,7 @@ export class BIP44Node implements BIP44NodeInterface {
}

public get extendedKey(): string {
const data = {
depth: this.depth,
parentFingerprint: this.parentFingerprint,
index: this.index,
chainCode: this.chainCodeBytes,
};

if (this.privateKeyBytes) {
return encodeExtendedKey({
...data,
version: PRIVATE_KEY_VERSION,
privateKey: this.privateKeyBytes,
});
}

return encodeExtendedKey({
...data,
version: PUBLIC_KEY_VERSION,
publicKey: this.publicKeyBytes,
});
return this.#node.extendedKey;
}

public get curve(): SupportedCurve {
Expand Down
Loading
Loading