Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests/aptos coin #248

Draft
wants to merge 12 commits into
base: develop
Choose a base branch
from
8 changes: 8 additions & 0 deletions test/python/apps/aptos.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions test/python/apps/cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/python/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions test/python/test_aptos.py
Original file line number Diff line number Diff line change
@@ -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
Loading