Utilities and base libraries for use across polkadot-js for Polkadot and Substrate. Includes base libraries, crypto helpers and cross-environment helpers.
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.
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.
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.
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 originalLedger
class that was exposed. To avoid any breaking changes for legacy users we have created a new class calledLedgerGeneric
which focuses on the new changes and implements thePolkadotGenericApp
. 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
andmetaUrl
work together when you want to leverage atxMetadataSvrUrl
within Zondax/ledger-substrate-js. This is specific for usingsign
andsignRaw
.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>