From 00a2d856e9253f55c04a9ed24e7006342b0f8e49 Mon Sep 17 00:00:00 2001 From: Hedi EDELBLOUTE Date: Mon, 18 Sep 2023 15:04:47 +0200 Subject: [PATCH] remove useless arg + nano app version --- .../src/families/cosmos/api/Cosmos.test.ts | 11 ++++++----- .../src/families/cosmos/api/Cosmos.ts | 3 +-- .../src/families/cosmos/js-prepareTransaction.ts | 5 +---- .../src/families/cosmos/js-signOperation.ts | 1 - libs/ledger-live-common/src/families/cosmos/specs.ts | 1 - 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/libs/ledger-live-common/src/families/cosmos/api/Cosmos.test.ts b/libs/ledger-live-common/src/families/cosmos/api/Cosmos.test.ts index 86212348bdb0..dd19414cc72d 100644 --- a/libs/ledger-live-common/src/families/cosmos/api/Cosmos.test.ts +++ b/libs/ledger-live-common/src/families/cosmos/api/Cosmos.test.ts @@ -1,6 +1,7 @@ import network from "@ledgerhq/live-network/network"; import { AxiosResponse } from "axios"; import BigNumber from "bignumber.js"; +import cryptoFactory from "../chain/chain"; import { CosmosAPI } from "./Cosmos"; jest.mock("@ledgerhq/live-network/network"); const mockedNetwork = jest.mocked(network); @@ -33,7 +34,7 @@ describe("CosmosApi", () => { }, } as AxiosResponse); - const account = await cosmosApi.getAccount("addr", "default"); + const account = await cosmosApi.getAccount("addr"); expect(account.accountNumber).toEqual(2); expect(account.sequence).toEqual(42); expect(account.pubKey).toEqual("k2"); @@ -47,7 +48,7 @@ describe("CosmosApi", () => { }, } as AxiosResponse); - const account = await cosmosApi.getAccount("addr", "default"); + const account = await cosmosApi.getAccount("addr"); expect(account.accountNumber).toEqual(1); expect(account.sequence).toEqual(0); expect(account.pubKey).toEqual("k"); @@ -58,7 +59,7 @@ describe("CosmosApi", () => { mockedNetwork.mockImplementation(() => { throw new Error(); }); - const account = await cosmosApi.getAccount("addr", "default"); + const account = await cosmosApi.getAccount("addr"); expect(account.sequence).toEqual(0); }); @@ -66,8 +67,8 @@ describe("CosmosApi", () => { mockedNetwork.mockImplementation(() => { throw new Error(); }); - const account = await cosmosApi.getAccount("addr", "default"); - expect(account.pubKeyType).toEqual("default"); + const account = await cosmosApi.getAccount("addr"); + expect(account.pubKeyType).toEqual(cryptoFactory("cosmos").defaultPubKeyType); }); }); diff --git a/libs/ledger-live-common/src/families/cosmos/api/Cosmos.ts b/libs/ledger-live-common/src/families/cosmos/api/Cosmos.ts index 6448d54fa6b7..1da493cf87f4 100644 --- a/libs/ledger-live-common/src/families/cosmos/api/Cosmos.ts +++ b/libs/ledger-live-common/src/families/cosmos/api/Cosmos.ts @@ -50,7 +50,7 @@ export class CosmosAPI { unbondings, withdrawAddress, ] = await Promise.all([ - this.getAccount(address, this.chainInstance.defaultPubKeyType), + this.getAccount(address), this.getAllBalances(address, currency), this.getHeight(), this.getTransactions(address, 100), @@ -77,7 +77,6 @@ export class CosmosAPI { getAccount = async ( address: string, - defaultPubKeyType: string, ): Promise<{ accountNumber: number; sequence: number; pubKeyType: string; pubKey: string }> => { const accountData = { accountNumber: 0, diff --git a/libs/ledger-live-common/src/families/cosmos/js-prepareTransaction.ts b/libs/ledger-live-common/src/families/cosmos/js-prepareTransaction.ts index ffcc6fd25b2e..f58d20da43ea 100644 --- a/libs/ledger-live-common/src/families/cosmos/js-prepareTransaction.ts +++ b/libs/ledger-live-common/src/families/cosmos/js-prepareTransaction.ts @@ -55,10 +55,7 @@ export const getEstimatedFees = async ( const cosmosAPI = new CosmosAPI(account.currency.id); const { protoMsgs } = txToMessages(account, transaction); - const { sequence, pubKeyType, pubKey } = await cosmosAPI.getAccount( - account.freshAddress, - chainInstance.defaultPubKeyType, - ); + const { sequence, pubKeyType, pubKey } = await cosmosAPI.getAccount(account.freshAddress); const signature = new Uint8Array(Buffer.from(account.seedIdentifier, "hex")); const txBytes = buildTransaction({ diff --git a/libs/ledger-live-common/src/families/cosmos/js-signOperation.ts b/libs/ledger-live-common/src/families/cosmos/js-signOperation.ts index 377c6ef81fd6..8593879d37ea 100644 --- a/libs/ledger-live-common/src/families/cosmos/js-signOperation.ts +++ b/libs/ledger-live-common/src/families/cosmos/js-signOperation.ts @@ -24,7 +24,6 @@ const signOperation: SignOperationFnSignature = ({ account, deviceI const { accountNumber, sequence, pubKeyType } = await cosmosAPI.getAccount( account.freshAddress, - chainInstance.defaultPubKeyType, ); o.next({ type: "device-signature-requested" }); const { aminoMsgs, protoMsgs } = txToMessages(account, transaction); diff --git a/libs/ledger-live-common/src/families/cosmos/specs.ts b/libs/ledger-live-common/src/families/cosmos/specs.ts index b162a03411eb..d92e16747289 100644 --- a/libs/ledger-live-common/src/families/cosmos/specs.ts +++ b/libs/ledger-live-common/src/families/cosmos/specs.ts @@ -442,7 +442,6 @@ const generateGenericCosmosTest = ( appQuery: { model: DeviceModelId.nanoS, appName: "Cosmos", - appVersion: "2.34.11", }, genericDeviceAction: acceptTransaction, testTimeout: 2 * 60 * 1000,