mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
launchpad-ledger: Remove disconnect method
This commit is contained in:
parent
974ed65c92
commit
a8c325ba62
@ -36,8 +36,7 @@ export class LaunchpadLedger {
|
||||
private readonly testModeAllowed: boolean;
|
||||
private readonly hdPaths: readonly HdPath[];
|
||||
private readonly prefix: string;
|
||||
private readonly transport: LedgerTransport;
|
||||
private app: CosmosApp | null;
|
||||
private readonly app: CosmosApp | null;
|
||||
|
||||
public constructor(transport: LedgerTransport, options: LaunchpadLedgerOptions = {}) {
|
||||
const defaultOptions = {
|
||||
@ -52,7 +51,6 @@ export class LaunchpadLedger {
|
||||
this.testModeAllowed = testModeAllowed;
|
||||
this.hdPaths = hdPaths;
|
||||
this.prefix = prefix;
|
||||
this.transport = transport;
|
||||
this.app = new CosmosApp(transport);
|
||||
}
|
||||
|
||||
@ -103,13 +101,6 @@ export class LaunchpadLedger {
|
||||
return Secp256k1Signature.fromDer((response as SignResponse).signature).toFixedLength();
|
||||
}
|
||||
|
||||
public async disconnect(): Promise<void> {
|
||||
if (this.app) {
|
||||
await this.transport.close();
|
||||
this.app = null;
|
||||
}
|
||||
}
|
||||
|
||||
private verifyAppMode(testMode: boolean): void {
|
||||
if (testMode && !this.testModeAllowed) {
|
||||
throw new Error(`DANGER: The Cosmos Ledger app is in test mode and should not be used on mainnet!`);
|
||||
|
@ -74,8 +74,6 @@ describe("LedgerSigner", () => {
|
||||
pubkey: fromBase64("A2ZnLEcbpyjS30H5UF1vezq29aBcT9oo5EARATIW9Cpj"),
|
||||
},
|
||||
]);
|
||||
|
||||
await signer.disconnect();
|
||||
});
|
||||
});
|
||||
|
||||
@ -123,8 +121,6 @@ describe("LedgerSigner", () => {
|
||||
fistAccount.pubkey,
|
||||
);
|
||||
expect(valid).toEqual(true);
|
||||
|
||||
await signer.disconnect();
|
||||
},
|
||||
interactiveTimeout,
|
||||
);
|
||||
@ -144,8 +140,6 @@ describe("LedgerSigner", () => {
|
||||
const client = new SigningCosmosClient(wasmd.endpoint, fistAccount.address, signer);
|
||||
const result = await client.sendTokens(defaultRecipient, coins(1234567, "ucosm"));
|
||||
assert(isBroadcastTxSuccess(result));
|
||||
|
||||
await signer.disconnect();
|
||||
},
|
||||
interactiveTimeout,
|
||||
);
|
||||
|
@ -53,8 +53,4 @@ export class LedgerSigner implements OfflineSigner {
|
||||
signature: encodeSecp256k1Signature(accountForAddress.pubkey, signature),
|
||||
};
|
||||
}
|
||||
|
||||
public async disconnect(): Promise<void> {
|
||||
return this.ledger.disconnect();
|
||||
}
|
||||
}
|
||||
|
@ -14,15 +14,13 @@ export declare class LaunchpadLedger {
|
||||
private readonly testModeAllowed;
|
||||
private readonly hdPaths;
|
||||
private readonly prefix;
|
||||
private readonly transport;
|
||||
private app;
|
||||
private readonly app;
|
||||
constructor(transport: LedgerTransport, options?: LaunchpadLedgerOptions);
|
||||
getCosmosAppVersion(): Promise<string>;
|
||||
getPubkey(hdPath?: HdPath): Promise<Uint8Array>;
|
||||
getPubkeys(): Promise<readonly Uint8Array[]>;
|
||||
getCosmosAddress(pubkey?: Uint8Array): Promise<string>;
|
||||
sign(message: Uint8Array, hdPath?: HdPath): Promise<Uint8Array>;
|
||||
disconnect(): Promise<void>;
|
||||
private verifyAppMode;
|
||||
private getOpenAppName;
|
||||
private verifyAppVersion;
|
||||
|
@ -10,5 +10,4 @@ export declare class LedgerSigner implements OfflineSigner {
|
||||
constructor(transport: LedgerTransport, options?: LaunchpadLedgerOptions);
|
||||
getAccounts(): Promise<readonly AccountData[]>;
|
||||
sign(signerAddress: string, signDoc: StdSignDoc): Promise<SignResponse>;
|
||||
disconnect(): Promise<void>;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user