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 support for latest ledger app #1925

Merged
merged 17 commits into from
Jul 12, 2024
Merged

Add support for latest ledger app #1925

merged 17 commits into from
Jul 12, 2024

Conversation

TarikGul
Copy link
Member

@TarikGul TarikGul commented Jul 4, 2024

Summary

This PR focuses on giving @polkadot/hw-ledger the most recent support for the new ledger app - PolkadotGenericApp. This required a lot of large changes from the original Ledger class that was exposed. To avoid any breaking changes for legacy users we have created a new class called LedgerGeneric which focuses on the new changes and implements the PolkadotGenericApp. The interface has additions and major changes to the args that were accepted previously. Below I will lay out the new changes and how they work.

BREAKING CHANGE This PR deprecates class Ledger.

Whats New?

class LedgerGeneric

Initializing
new LedgerGeneric(transport: TransportType, chain: Chain, slip44: number, chainId?: string, metaUrl?: string): Promise<LedgerAddress>:

  • chainId and metaUrl work together when you want to leverage a txMetadataSvrUrl within Zondax/ledger-substrate-js. This is specific for using sign and signRaw.

  • When you want to use your own metadata you can use signWithMetadata.

getAddress

public async getAddress (ss58Prefix: number, confirm = false, accountIndex = 0, addressOffset = 0): Promise<LedgerVersion>:

sign

public async sign (message: Uint8Array, accountIndex?: number, addressOffset?: number): Promise<LedgerSignature>:

signRaw

public async signRaw (message: Uint8Array, accountIndex?: number, addressOffset?: number): Promise<LedgerSignature>:

signWithMetadata

public async signWithMetadata (message: Uint8Array, accountIndex?: number, addressOffset?: number, options?: Partial<AccountOptionsGeneric>): Promise<LedgerSignature>

Copy link
Member

@bee344 bee344 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job

@TarikGul TarikGul merged commit 4d629fd into master Jul 12, 2024
4 checks passed
@TarikGul TarikGul deleted the tg-ledger branch July 12, 2024 15:53
@polkadot-js-bot
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Jul 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants