diff --git a/test/python/apps/aptos.py b/test/python/apps/aptos.py new file mode 100644 index 00000000..caed9e4e --- /dev/null +++ b/test/python/apps/aptos.py @@ -0,0 +1,8 @@ +from ragger.utils import create_currency_config +from ragger.bip import pack_derivation_path + +APTOS_CONF = create_currency_config("APT", "Aptos") +APTOS_DERIVATION_PATH = "m/44'/637'/0'" +APTOS_PACKED_DERIVATION_PATH = pack_derivation_path(APTOS_DERIVATION_PATH) + +MAX_APDU_LEN: int = 255 \ No newline at end of file diff --git a/test/python/apps/cal.py b/test/python/apps/cal.py index 2a21252d..76af6a78 100644 --- a/test/python/apps/cal.py +++ b/test/python/apps/cal.py @@ -22,6 +22,7 @@ from .tron import TRX_PACKED_DERIVATION_PATH, TRX_CONF from .tron import TRX_USDT_CONF, TRX_USDC_CONF, TRX_TUSD_CONF, TRX_USDD_CONF from .cardano import ADA_BYRON_PACKED_DERIVATION_PATH, ADA_SHELLEY_PACKED_DERIVATION_PATH, ADA_CONF +from .aptos import APTOS_PACKED_DERIVATION_PATH, APTOS_CONF from .near import NEAR_PACKED_DERIVATION_PATH, NEAR_CONF @dataclass @@ -59,6 +60,7 @@ def get_conf_for_ticker(self, overload_signer: Optional[SigningAuthority]=None) ADA_BYRON_CURRENCY_CONFIGURATION = CurrencyConfiguration(ticker="ADA", conf=ADA_CONF, packed_derivation_path=ADA_BYRON_PACKED_DERIVATION_PATH) ADA_SHELLEY_CURRENCY_CONFIGURATION = CurrencyConfiguration(ticker="ADA", conf=ADA_CONF, packed_derivation_path=ADA_SHELLEY_PACKED_DERIVATION_PATH) NEAR_CURRENCY_CONFIGURATION = CurrencyConfiguration(ticker="NEAR", conf=NEAR_CONF, packed_derivation_path=NEAR_PACKED_DERIVATION_PATH) +APTOS_CURRENCY_CONFIGURATION = CurrencyConfiguration(ticker="APT", conf=APTOS_CONF, packed_derivation_path=APTOS_PACKED_DERIVATION_PATH) # Helper that can be called from outside if we want to generate errors easily diff --git a/test/python/conftest.py b/test/python/conftest.py index 3151b45e..4201c8c4 100644 --- a/test/python/conftest.py +++ b/test/python/conftest.py @@ -12,6 +12,7 @@ # Please refer to ragger/conftest/configuration.py for their descriptions and accepted values configuration.OPTIONAL.SIDELOADED_APPS = { + "aptos": "Aptos", "bitcoin": "Bitcoin", "bitcoin_legacy": "Bitcoin Legacy", "ethereum": "Ethereum", diff --git a/test/python/snapshots/flex/test_aptos_fund_valid_1/review/00000.png b/test/python/snapshots/flex/test_aptos_fund_valid_1/review/00000.png new file mode 100644 index 00000000..21ea8a8f Binary files /dev/null and b/test/python/snapshots/flex/test_aptos_fund_valid_1/review/00000.png differ diff --git a/test/python/snapshots/flex/test_aptos_fund_valid_1/review/00001.png b/test/python/snapshots/flex/test_aptos_fund_valid_1/review/00001.png new file mode 100644 index 00000000..0b39f2c4 Binary files /dev/null and b/test/python/snapshots/flex/test_aptos_fund_valid_1/review/00001.png differ diff --git a/test/python/snapshots/flex/test_aptos_fund_valid_1/review/00002.png b/test/python/snapshots/flex/test_aptos_fund_valid_1/review/00002.png new file mode 100644 index 00000000..0453810c Binary files /dev/null and b/test/python/snapshots/flex/test_aptos_fund_valid_1/review/00002.png differ diff --git a/test/python/snapshots/flex/test_aptos_swap_valid_1/review/00000.png b/test/python/snapshots/flex/test_aptos_swap_valid_1/review/00000.png new file mode 100644 index 00000000..3499af4b Binary files /dev/null and b/test/python/snapshots/flex/test_aptos_swap_valid_1/review/00000.png differ diff --git a/test/python/snapshots/flex/test_aptos_swap_valid_1/review/00001.png b/test/python/snapshots/flex/test_aptos_swap_valid_1/review/00001.png new file mode 100644 index 00000000..0bbccb49 Binary files /dev/null and b/test/python/snapshots/flex/test_aptos_swap_valid_1/review/00001.png differ diff --git a/test/python/snapshots/flex/test_aptos_swap_valid_1/review/00002.png b/test/python/snapshots/flex/test_aptos_swap_valid_1/review/00002.png new file mode 100644 index 00000000..7d06993b Binary files /dev/null and b/test/python/snapshots/flex/test_aptos_swap_valid_1/review/00002.png differ diff --git a/test/python/test_aptos.py b/test/python/test_aptos.py new file mode 100644 index 00000000..2296f558 --- /dev/null +++ b/test/python/test_aptos.py @@ -0,0 +1,37 @@ +import pytest +import os + +from .apps.exchange_test_runner import ExchangeTestRunner, ALL_TESTS_EXCEPT_MEMO_THORSWAP_AND_FEES +from .apps import cal as cal + +# ExchangeTestRunner implementation for Ton +class AptosTests(ExchangeTestRunner): + currency_configuration = cal.APTOS_CURRENCY_CONFIGURATION + valid_destination_1 = "TNbtZSpknaQvC7jPCLU4znJMgm8fhuGTTY" + valid_destination_memo_1 = "" + valid_destination_2 = "TBoTZcARzWVgnNuB9SyE3S5g1RwsXoQL16" + valid_destination_memo_2 = "" + valid_refund = "0x8F13F355F3AF444BD356ADEAAAF01235A7817D6A4417F5C9FA3D74A68F7B7AFD" + valid_refund_memo = "" + valid_send_amount_1 = 1000000 + valid_send_amount_2 = 446739662 + valid_fees_1 = 0 + valid_fees_2 = 1 + fake_refund = "abcdabcd" + fake_refund_memo = "1" + fake_payout = "abcdabcd" + fake_payout_memo = "1" + def perform_final_tx(self, destination, send_amount, fees, memo): + assert False + + +# Use a class to reuse the same Speculos instance +class TestsAptos: + + @pytest.mark.parametrize('test_to_run', ALL_TESTS_EXCEPT_MEMO_THORSWAP_AND_FEES) + def test_aptos(self, backend, exchange_navigation_helper, test_to_run): + AptosTests(backend, exchange_navigation_helper).run_test(test_to_run) + + +def test_eval(): + assert False \ No newline at end of file