polkadot-js / common

Utilities and base libraries for use across polkadot-js for Polkadot and Substrate. Includes base libraries, crypto helpers and cross-environment helpers.
Apache License 2.0
254 stars 147 forks source link

Add support for latest ledger app #1925

Closed TarikGul closed 4 months ago

TarikGul commented 4 months ago

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>:

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>

polkadot-js-bot commented 4 months ago

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.