Skip to content

Commit

Permalink
💚 refacto currency for speculos tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VicAlbr committed Aug 19, 2024
1 parent acc5226 commit a0a9fff
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 121 deletions.
126 changes: 126 additions & 0 deletions apps/ledger-live-desktop/tests/enum/AppInfos.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import { DeviceLabels } from "./DeviceLabels";

export class AppInfos {
constructor(
public readonly name: string,
public readonly sendPattern: DeviceLabels[],
public readonly receivePattern: DeviceLabels[],
) {}
static readonly BITCOIN = new AppInfos(
"Bitcoin",
[
DeviceLabels.AMOUT,
DeviceLabels.ADDRESS,
DeviceLabels.CONTINUE,
DeviceLabels.REJECT,
DeviceLabels.SIGN,
],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);
static readonly BITCOIN_TESTNET = new AppInfos(
"Bitcoin Test",
[
DeviceLabels.AMOUT,
DeviceLabels.ADDRESS,
DeviceLabels.CONTINUE,
DeviceLabels.REJECT,
DeviceLabels.SIGN,
],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);
static readonly DOGECOIN = new AppInfos(
"Dogecoin",
[DeviceLabels.AMOUT, DeviceLabels.ADDRESS, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);
static readonly ETHEREUM = new AppInfos(
"Ethereum",
[DeviceLabels.AMOUT, DeviceLabels.TO, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);
static readonly ETHEREUM_HOLESKY = new AppInfos(
"Ethereum Holesky",
[DeviceLabels.AMOUT, DeviceLabels.TO, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);
static readonly ETHEREUM_SEPOLIA = new AppInfos(
"Ethereum Sepolia",
[DeviceLabels.AMOUT, DeviceLabels.TO, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);
static readonly ETHEREUM_CLASSIC = new AppInfos(
"Ethereum Classic",
[DeviceLabels.AMOUT, DeviceLabels.TO, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);
static readonly SOLANA = new AppInfos(
"Solana",
[DeviceLabels.TRANSFER, DeviceLabels.RECIPIENT, DeviceLabels.APPROVE, DeviceLabels.REJECT],
[DeviceLabels.PUBKEY, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);
static readonly POLKADOT = new AppInfos(
"Polkadot",
[DeviceLabels.DEST, DeviceLabels.AMOUT, DeviceLabels.CAPS_APPROVE, DeviceLabels.CAPS_REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.CAPS_APPROVE, DeviceLabels.CAPS_REJECT],
);
static readonly TRON = new AppInfos(
"Tron",
[DeviceLabels.AMOUT, DeviceLabels.TO, DeviceLabels.SIGN, DeviceLabels.CANCEL],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.CANCEL],
);
static readonly RIPPLE = new AppInfos(
"Ripple",
[DeviceLabels.AMOUT, DeviceLabels.DESTINATION, DeviceLabels.SIGN, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);
static readonly CARDANO = new AppInfos(
"Cardano",
[DeviceLabels.SEND, DeviceLabels.SEND_TO_ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.CONFIRM, DeviceLabels.REJECT],
);
static readonly STELLAR = new AppInfos(
"Stellar",
[DeviceLabels.SEND, DeviceLabels.DESTINATION, DeviceLabels.FINALIZE, DeviceLabels.CANCEL],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);
static readonly BITCOIN_CASH = new AppInfos(
"Bitcoin Cash",
[DeviceLabels.AMOUT, DeviceLabels.ADDRESS, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);
static readonly ALGORAND = new AppInfos(
"Algorand",
[
DeviceLabels.AMOUT,
DeviceLabels.RECEIVER,
DeviceLabels.CAPS_APPROVE,
DeviceLabels.CAPS_REJECT,
],
[DeviceLabels.ADDRESS, DeviceLabels.CAPS_APPROVE, DeviceLabels.CAPS_REJECT],
);
static readonly COSMOS = new AppInfos(
"Cosmos",
[DeviceLabels.AMOUT, DeviceLabels.TO, DeviceLabels.CAPS_APPROVE, DeviceLabels.CAPS_REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.CAPS_APPROVE, DeviceLabels.CAPS_REJECT],
);
static readonly TEZOS = new AppInfos(
"Tezos",
[DeviceLabels.AMOUT, DeviceLabels.DESTINATION, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);
static readonly POLYGON = new AppInfos(
"Polygon",
[DeviceLabels.AMOUT, DeviceLabels.ADDRESS, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);
static readonly BINANCE_SMART_CHAIN = new AppInfos(
"Binance Smart Chain",
[DeviceLabels.AMOUT, DeviceLabels.ADDRESS, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);
static readonly TON = new AppInfos(
"TON",
[DeviceLabels.AMOUT, DeviceLabels.TO, DeviceLabels.APPROVE, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);
}
Loading

0 comments on commit a0a9fff

Please sign in to comment.