Skip to content

Commit

Permalink
remove useless arg + nano app version
Browse files Browse the repository at this point in the history
  • Loading branch information
hedi-edelbloute committed Sep 18, 2023
1 parent 218adaf commit 00a2d85
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
11 changes: 6 additions & 5 deletions libs/ledger-live-common/src/families/cosmos/api/Cosmos.test.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand Down Expand Up @@ -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");
Expand All @@ -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");
Expand All @@ -58,16 +59,16 @@ 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);
});

it("should return default pubkeytype value if network fails", async () => {
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);
});
});

Expand Down
3 changes: 1 addition & 2 deletions libs/ledger-live-common/src/families/cosmos/api/Cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const signOperation: SignOperationFnSignature<Transaction> = ({ 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);
Expand Down
1 change: 0 additions & 1 deletion libs/ledger-live-common/src/families/cosmos/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@ const generateGenericCosmosTest = (
appQuery: {
model: DeviceModelId.nanoS,
appName: "Cosmos",
appVersion: "2.34.11",
},
genericDeviceAction: acceptTransaction,
testTimeout: 2 * 60 * 1000,
Expand Down

0 comments on commit 00a2d85

Please sign in to comment.