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

fix: ledger wallet #530

Merged
merged 1 commit into from
Jan 14, 2025
Merged

fix: ledger wallet #530

merged 1 commit into from
Jan 14, 2025

Conversation

fmorency
Copy link
Contributor

@fmorency fmorency commented Jan 10, 2025

  • Fixes the missing getOfflineSigner implementation
  • Fixes StdSignDoc serialization to JSON. The object MUST be serialized in lexicographical key order 1
  • Replace the encoding of pubkey in getAccount from a TextEncoder to using the fromHex function
  • Bump @ledgerhq/* dependencies
  • Prettify

Fixes #497

- Fixes the missing `getOfflineSigner` implementation
- Fixes `StdSignDoc` serialization to JSON. The object MUST be
  serialized in lexicographical key order
- Replace the encoding of `pubkey` in `getAccount` from a `TextEncoder`
  to using the `fromHex` function.
@@ -1,7 +1,7 @@
import { ChainRecord, ChainWalletBase, Wallet } from '@cosmos-kit/core';

export class LedgerChianWallet extends ChainWalletBase {
export class LedgerChainWallet extends ChainWalletBase {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix typo and prettify

@@ -39,16 +47,44 @@ export class LedgerClient implements WalletClient {
username: username ?? path,
address,
algo: 'secp256k1' as Algo,
pubkey: new TextEncoder().encode(publicKey),
pubkey: fromHex(publicKey),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We want the publicKey as an hex byte array, not a UTF-8 byte array

@fmorency
Copy link
Contributor Author

Only accountIndex=0 seems supported. I'm not sure if other indices were ever supported.

import TransportWebUSB from '@ledgerhq/hw-transport-webusb';
import TransportWebHID from '@ledgerhq/hw-transport-webhid'
import { chains } from 'chain-registry';
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should re-think this

@pyramation pyramation merged commit 618e36f into hyperweb-io:main Jan 14, 2025
1 check passed
@pyramation
Copy link
Collaborator

Thanks so much @fmorency :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ChainProvider ledger: TypeError: this.client.getOfflineSigner is not a function
2 participants