-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8224 from LedgerHQ/support/qaa-306
[QAA-306] ♻️ Refacto speculos interations
- Loading branch information
Showing
10 changed files
with
225 additions
and
346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,192 +1,53 @@ | ||
import { DeviceLabels } from "./DeviceLabels"; | ||
|
||
export class AppInfos { | ||
constructor( | ||
public readonly name: string, | ||
public readonly sendPattern?: DeviceLabels[], | ||
public readonly receivePattern?: DeviceLabels[], | ||
public readonly delegatePattern?: DeviceLabels[], | ||
) {} | ||
|
||
static readonly BITCOIN = new AppInfos( | ||
"Bitcoin", | ||
[ | ||
DeviceLabels.AMOUNT, | ||
DeviceLabels.ADDRESS, | ||
DeviceLabels.CONTINUE, | ||
DeviceLabels.REJECT, | ||
DeviceLabels.SIGN, | ||
], | ||
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
); | ||
|
||
static readonly BITCOIN_TESTNET = new AppInfos( | ||
"Bitcoin Test", | ||
[ | ||
DeviceLabels.AMOUNT, | ||
DeviceLabels.ADDRESS, | ||
DeviceLabels.CONTINUE, | ||
DeviceLabels.REJECT, | ||
DeviceLabels.SIGN, | ||
], | ||
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
); | ||
|
||
static readonly DOGECOIN = new AppInfos( | ||
"Dogecoin", | ||
[DeviceLabels.AMOUNT, DeviceLabels.ADDRESS, DeviceLabels.ACCEPT, DeviceLabels.REJECT], | ||
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
); | ||
|
||
static readonly ETHEREUM = new AppInfos( | ||
"Ethereum", | ||
[DeviceLabels.AMOUNT, DeviceLabels.TO, DeviceLabels.ACCEPT, DeviceLabels.REJECT], | ||
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
); | ||
|
||
static readonly ETHEREUM_HOLESKY = new AppInfos( | ||
"Ethereum Holesky", | ||
[DeviceLabels.AMOUNT, DeviceLabels.TO, DeviceLabels.ACCEPT, DeviceLabels.REJECT], | ||
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
); | ||
|
||
static readonly ETHEREUM_SEPOLIA = new AppInfos( | ||
"Ethereum Sepolia", | ||
[DeviceLabels.AMOUNT, DeviceLabels.TO, DeviceLabels.ACCEPT, DeviceLabels.REJECT], | ||
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
); | ||
|
||
static readonly ETHEREUM_CLASSIC = new AppInfos( | ||
"Ethereum Classic", | ||
[DeviceLabels.AMOUNT, 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], | ||
[DeviceLabels.DELEGATE_FROM, DeviceLabels.DEPOSIT, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
); | ||
|
||
static readonly POLKADOT = new AppInfos( | ||
"Polkadot", | ||
[DeviceLabels.DEST, DeviceLabels.AMOUNT, DeviceLabels.CAPS_APPROVE, DeviceLabels.CAPS_REJECT], | ||
[DeviceLabels.ADDRESS, DeviceLabels.CAPS_APPROVE, DeviceLabels.CAPS_REJECT], | ||
); | ||
|
||
static readonly TRON = new AppInfos( | ||
"Tron", | ||
[DeviceLabels.AMOUNT, DeviceLabels.TO, DeviceLabels.SIGN, DeviceLabels.CANCEL], | ||
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.CANCEL], | ||
); | ||
|
||
static readonly RIPPLE = new AppInfos( | ||
"Ripple", | ||
[DeviceLabels.AMOUNT, 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.AMOUNT, DeviceLabels.ADDRESS, DeviceLabels.ACCEPT, DeviceLabels.REJECT], | ||
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
); | ||
|
||
static readonly ALGORAND = new AppInfos( | ||
"Algorand", | ||
[ | ||
DeviceLabels.AMOUNT, | ||
DeviceLabels.RECEIVER, | ||
DeviceLabels.CAPS_APPROVE, | ||
DeviceLabels.CAPS_REJECT, | ||
], | ||
[DeviceLabels.ADDRESS, DeviceLabels.CAPS_APPROVE, DeviceLabels.CAPS_REJECT], | ||
); | ||
|
||
static readonly COSMOS = new AppInfos( | ||
"Cosmos", | ||
[DeviceLabels.AMOUNT, DeviceLabels.TO, DeviceLabels.CAPS_APPROVE, DeviceLabels.CAPS_REJECT], | ||
[DeviceLabels.ADDRESS, DeviceLabels.CAPS_APPROVE, DeviceLabels.CAPS_REJECT], | ||
[ | ||
DeviceLabels.PLEASE_REVIEW, | ||
DeviceLabels.AMOUNT, | ||
DeviceLabels.CAPS_APPROVE, | ||
DeviceLabels.CAPS_REJECT, | ||
], | ||
); | ||
|
||
static readonly TEZOS = new AppInfos( | ||
"Tezos", | ||
[DeviceLabels.AMOUNT, DeviceLabels.DESTINATION, DeviceLabels.ACCEPT, DeviceLabels.REJECT], | ||
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
); | ||
|
||
static readonly POLYGON = new AppInfos( | ||
"Polygon", | ||
[DeviceLabels.AMOUNT, DeviceLabels.ADDRESS, DeviceLabels.ACCEPT, DeviceLabels.REJECT], | ||
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
); | ||
|
||
static readonly BINANCE_SMART_CHAIN = new AppInfos( | ||
"Binance Smart Chain", | ||
[DeviceLabels.AMOUNT, DeviceLabels.ADDRESS, DeviceLabels.ACCEPT, DeviceLabels.REJECT], | ||
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
); | ||
|
||
static readonly TON = new AppInfos( | ||
"Ton", | ||
[DeviceLabels.AMOUNT, DeviceLabels.TO, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
); | ||
|
||
static readonly NEAR = new AppInfos( | ||
"Near", | ||
[DeviceLabels.AMOUNT, DeviceLabels.DESTINATION, DeviceLabels.ACCEPT, DeviceLabels.REJECT], | ||
[DeviceLabels.WALLET_ID, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
[ | ||
DeviceLabels.VIEW_HEADER, | ||
DeviceLabels.RECEIVER, | ||
DeviceLabels.CONTINUE_TO_ACTION, | ||
DeviceLabels.VIEW_ACTION, | ||
DeviceLabels.METHOD_NAME, | ||
DeviceLabels.DEPOSIT, | ||
DeviceLabels.REJECT, | ||
DeviceLabels.SIGN, | ||
], | ||
); | ||
|
||
static readonly MULTIVERSE_X = new AppInfos( | ||
"Multiverse X", | ||
[DeviceLabels.AMOUNT, DeviceLabels.DESTINATION, DeviceLabels.ACCEPT, DeviceLabels.REJECT], | ||
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
); | ||
|
||
static readonly OSMOSIS = new AppInfos( | ||
"Osmosis", | ||
[DeviceLabels.AMOUNT, DeviceLabels.DESTINATION, DeviceLabels.ACCEPT, DeviceLabels.REJECT], | ||
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT], | ||
); | ||
constructor(public readonly name: string) {} | ||
|
||
static readonly BITCOIN = new AppInfos("Bitcoin"); | ||
|
||
static readonly BITCOIN_TESTNET = new AppInfos("Bitcoin Test"); | ||
|
||
static readonly DOGECOIN = new AppInfos("Dogecoin"); | ||
|
||
static readonly ETHEREUM = new AppInfos("Ethereum"); | ||
|
||
static readonly ETHEREUM_HOLESKY = new AppInfos("Ethereum Holesky"); | ||
|
||
static readonly ETHEREUM_SEPOLIA = new AppInfos("Ethereum Sepolia"); | ||
|
||
static readonly ETHEREUM_CLASSIC = new AppInfos("Ethereum Classic"); | ||
|
||
static readonly SOLANA = new AppInfos("Solana"); | ||
|
||
static readonly POLKADOT = new AppInfos("Polkadot"); | ||
|
||
static readonly TRON = new AppInfos("Tron"); | ||
|
||
static readonly RIPPLE = new AppInfos("Ripple"); | ||
|
||
static readonly CARDANO = new AppInfos("Cardano"); | ||
|
||
static readonly STELLAR = new AppInfos("Stellar"); | ||
|
||
static readonly BITCOIN_CASH = new AppInfos("Bitcoin Cash"); | ||
|
||
static readonly ALGORAND = new AppInfos("Algorand"); | ||
|
||
static readonly COSMOS = new AppInfos("Cosmos"); | ||
|
||
static readonly TEZOS = new AppInfos("Tezos"); | ||
|
||
static readonly POLYGON = new AppInfos("Polygon"); | ||
|
||
static readonly BINANCE_SMART_CHAIN = new AppInfos("Binance Smart Chain"); | ||
|
||
static readonly TON = new AppInfos("Ton"); | ||
|
||
static readonly NEAR = new AppInfos("Near"); | ||
|
||
static readonly MULTIVERSE_X = new AppInfos("Multiverse X"); | ||
|
||
static readonly OSMOSIS = new AppInfos("Osmosis"); | ||
|
||
static readonly LS = new AppInfos("LedgerSync"); | ||
|
||
static readonly EXCHANGE = new AppInfos("Exchange", [ | ||
DeviceLabels.SEND, | ||
DeviceLabels.GET, | ||
DeviceLabels.FEES, | ||
DeviceLabels.ACCEPT, | ||
DeviceLabels.REJECT, | ||
]); | ||
static readonly EXCHANGE = new AppInfos("Exchange"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.