Skip to content

Commit 9b80dff

Browse files
Rename launchpadledger (#1056)
* Rename LaunchpadLedger to LedgerConnector * Added changelog entry * Update CHANGELOG.md Co-authored-by: Simon Warta <[email protected]> * Rename property ledger to connector Co-authored-by: Simon Warta <[email protected]>
1 parent 48aeb1d commit 9b80dff

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ and this project adheres to
3636
you if multiple different protobuf type URLs map to the same Amino type
3737
identifier which should not be the case anyways.
3838
- @cosmjs/stargate: Added support for slashing queries ([#927])
39+
- @cosmjs/ledger-amino: Renamed `LaunchpadLedger` to `LedgerConnector` ([#955])
3940

4041
[#927]: https://github.com/cosmos/cosmjs/issues/927
42+
[#955]: https://github.com/cosmos/cosmjs/issues/955
4143
[#989]: https://github.com/cosmos/cosmjs/issues/989
4244
[#994]: https://github.com/cosmos/cosmjs/issues/994
4345
[#1011]: https://github.com/cosmos/cosmjs/issues/1011

packages/ledger-amino/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { AddressAndPubkey, LaunchpadLedger } from "./launchpadledger";
1+
export { AddressAndPubkey, LedgerConnector } from "./ledgerconnector";
22
export { LedgerSigner } from "./ledgersigner";

packages/ledger-amino/src/launchpadledger.ts renamed to packages/ledger-amino/src/ledgerconnector.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const cosmosBech32Prefix = "cosmos";
2828
const cosmosLedgerAppName = "Cosmos";
2929
const requiredCosmosAppVersion = "1.5.3";
3030

31-
export interface LaunchpadLedgerOptions {
31+
export interface LedgerConnectorOptions {
3232
readonly hdPaths?: readonly HdPath[];
3333
readonly prefix?: string;
3434
readonly testModeAllowed?: boolean;
@@ -57,15 +57,15 @@ export interface AddressAndPubkey {
5757
readonly pubkey: Secp256k1Pubkey;
5858
}
5959

60-
export class LaunchpadLedger {
60+
export class LedgerConnector {
6161
private readonly testModeAllowed: boolean;
6262
private readonly hdPaths: readonly HdPath[];
6363
private readonly prefix: string;
6464
private readonly ledgerAppName: string;
6565
private readonly minLedgerAppVersion: string;
6666
private readonly app: CosmosApp;
6767

68-
public constructor(transport: Transport, options: LaunchpadLedgerOptions = {}) {
68+
public constructor(transport: Transport, options: LedgerConnectorOptions = {}) {
6969
const defaultOptions = {
7070
hdPaths: [cosmosHdPath],
7171
prefix: cosmosBech32Prefix,

packages/ledger-amino/src/ledgersigner.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ import {
1010
import { HdPath } from "@cosmjs/crypto";
1111
import Transport from "@ledgerhq/hw-transport";
1212

13-
import { AddressAndPubkey, LaunchpadLedger, LaunchpadLedgerOptions } from "./launchpadledger";
13+
import { AddressAndPubkey, LedgerConnector, LedgerConnectorOptions } from "./ledgerconnector";
1414

1515
export class LedgerSigner implements OfflineAminoSigner {
16-
private readonly ledger: LaunchpadLedger;
16+
private readonly connector: LedgerConnector;
1717
private readonly hdPaths: readonly HdPath[];
1818
private accounts?: readonly AccountData[];
1919

20-
public constructor(transport: Transport, options: LaunchpadLedgerOptions = {}) {
20+
public constructor(transport: Transport, options: LedgerConnectorOptions = {}) {
2121
this.hdPaths = options.hdPaths || [makeCosmoshubPath(0)];
22-
this.ledger = new LaunchpadLedger(transport, options);
22+
this.connector = new LedgerConnector(transport, options);
2323
}
2424

2525
public async getAccounts(): Promise<readonly AccountData[]> {
2626
if (!this.accounts) {
27-
const pubkeys = await this.ledger.getPubkeys();
27+
const pubkeys = await this.connector.getPubkeys();
2828
this.accounts = await Promise.all(
2929
pubkeys.map(async (pubkey) => ({
3030
algo: "secp256k1" as const,
31-
address: await this.ledger.getCosmosAddress(pubkey),
31+
address: await this.connector.getCosmosAddress(pubkey),
3232
pubkey: pubkey,
3333
})),
3434
);
@@ -46,7 +46,7 @@ export class LedgerSigner implements OfflineAminoSigner {
4646
* @param path The HD path to show the address for. If unset, this is the first account.
4747
*/
4848
public async showAddress(path?: HdPath): Promise<AddressAndPubkey> {
49-
return this.ledger.showAddress(path);
49+
return this.connector.showAddress(path);
5050
}
5151

5252
public async signAmino(signerAddress: string, signDoc: StdSignDoc): Promise<AminoSignResponse> {
@@ -60,7 +60,7 @@ export class LedgerSigner implements OfflineAminoSigner {
6060
const message = serializeSignDoc(signDoc);
6161
const accountForAddress = accounts[accountIndex];
6262
const hdPath = this.hdPaths[accountIndex];
63-
const signature = await this.ledger.sign(message, hdPath);
63+
const signature = await this.connector.sign(message, hdPath);
6464
return {
6565
signed: signDoc,
6666
signature: encodeSecp256k1Signature(accountForAddress.pubkey, signature),

0 commit comments

Comments
 (0)