-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65d5ad9
commit b3ddccb
Showing
273 changed files
with
67 additions
and
504 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
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
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.
File renamed without changes
File renamed without changes
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes
File renamed without changes
Binary file removed
BIN
-352 Bytes
test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00001.png
Diff not rendered.
Binary file removed
BIN
-310 Bytes
test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00002.png
Diff not rendered.
Binary file removed
BIN
-313 Bytes
test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00003.png
Diff not rendered.
Binary file removed
BIN
-340 Bytes
test/python/snapshots/nanos/test_solana_swap_recipient_cancel/00005.png
Diff not rendered.
Binary file removed
BIN
-352 Bytes
test/python/snapshots/nanos/test_solana_swap_recipient_ok/00001.png
Diff not rendered.
Binary file removed
BIN
-310 Bytes
test/python/snapshots/nanos/test_solana_swap_recipient_ok/00002.png
Diff not rendered.
Binary file removed
BIN
-313 Bytes
test/python/snapshots/nanos/test_solana_swap_recipient_ok/00003.png
Diff not rendered.
File renamed without changes
File renamed without changes
Binary file added
BIN
+355 Bytes
test/python/snapshots/nanos/test_solana_swap_refuse_double_sign/00002.png
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
Binary file removed
BIN
-333 Bytes
test/python/snapshots/nanos/test_solana_swap_sender_cancel/00002.png
Diff not rendered.
Binary file removed
BIN
-340 Bytes
test/python/snapshots/nanos/test_solana_swap_sender_cancel/00005.png
Diff not rendered.
Binary file removed
BIN
-333 Bytes
test/python/snapshots/nanos/test_solana_swap_sender_double_sign/00002.png
Diff not rendered.
Diff not rendered.
Binary file removed
BIN
-333 Bytes
test/python/snapshots/nanos/test_solana_swap_sender_wrong_amount/00002.png
Diff not rendered.
Binary file removed
BIN
-320 Bytes
test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00001.png
Diff not rendered.
Binary file removed
BIN
-333 Bytes
test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00002.png
Diff not rendered.
Binary file removed
BIN
-329 Bytes
test/python/snapshots/nanos/test_solana_swap_sender_wrong_destination/00003.png
Diff not rendered.
File renamed without changes
File renamed without changes
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added
BIN
+355 Bytes
test/python/snapshots/nanos/test_solana_swap_wrong_amount/00002.png
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added
BIN
+355 Bytes
test/python/snapshots/nanos/test_solana_swap_wrong_destination/00002.png
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
Diff not rendered.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes
File renamed without changes
Diff not rendered.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes
Oops, something went wrong.
File renamed without changes
File renamed without changes
Binary file removed
BIN
-398 Bytes
test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00001.png
Diff not rendered.
Binary file removed
BIN
-353 Bytes
test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00002.png
Diff not rendered.
Binary file removed
BIN
-365 Bytes
test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00003.png
Diff not rendered.
Binary file removed
BIN
-365 Bytes
test/python/snapshots/nanosp/test_solana_swap_recipient_cancel/00005.png
Diff not rendered.
Binary file removed
BIN
-398 Bytes
test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00001.png
Diff not rendered.
Binary file removed
BIN
-353 Bytes
test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00002.png
Diff not rendered.
Binary file removed
BIN
-365 Bytes
test/python/snapshots/nanosp/test_solana_swap_recipient_ok/00003.png
Diff not rendered.
File renamed without changes
File renamed without changes
Binary file added
BIN
+402 Bytes
test/python/snapshots/nanosp/test_solana_swap_refuse_double_sign/00002.png
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
Binary file removed
BIN
-379 Bytes
test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00002.png
Diff not rendered.
Binary file removed
BIN
-365 Bytes
test/python/snapshots/nanosp/test_solana_swap_sender_cancel/00005.png
Diff not rendered.
Binary file removed
BIN
-379 Bytes
test/python/snapshots/nanosp/test_solana_swap_sender_double_sign/00002.png
Diff not rendered.
Binary file removed
BIN
-379 Bytes
test/python/snapshots/nanosp/test_solana_swap_sender_ok/00002.png
Diff not rendered.
Binary file removed
BIN
-379 Bytes
test/python/snapshots/nanosp/test_solana_swap_sender_wrong_amount/00002.png
Diff not rendered.
Binary file removed
BIN
-367 Bytes
test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00001.png
Diff not rendered.
Binary file removed
BIN
-379 Bytes
test/python/snapshots/nanosp/test_solana_swap_sender_wrong_destination/00002.png
Diff not rendered.
File renamed without changes
File renamed without changes
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added
BIN
+402 Bytes
test/python/snapshots/nanosp/test_solana_swap_wrong_amount/00002.png
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added
BIN
+402 Bytes
test/python/snapshots/nanosp/test_solana_swap_wrong_destination/00002.png
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
Diff not rendered.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes
File renamed without changes
Diff not rendered.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes
File renamed without changes
Binary file removed
BIN
-396 Bytes
test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00001.png
Diff not rendered.
Binary file removed
BIN
-353 Bytes
test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00002.png
Diff not rendered.
Binary file removed
BIN
-365 Bytes
test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00003.png
Diff not rendered.
Binary file removed
BIN
-366 Bytes
test/python/snapshots/nanox/test_solana_swap_recipient_cancel/00005.png
Diff not rendered.
Binary file removed
BIN
-396 Bytes
test/python/snapshots/nanox/test_solana_swap_recipient_ok/00001.png
Diff not rendered.
Binary file removed
BIN
-353 Bytes
test/python/snapshots/nanox/test_solana_swap_recipient_ok/00002.png
Diff not rendered.
Binary file removed
BIN
-365 Bytes
test/python/snapshots/nanox/test_solana_swap_recipient_ok/00003.png
Diff not rendered.
File renamed without changes
File renamed without changes
Binary file added
BIN
+402 Bytes
test/python/snapshots/nanox/test_solana_swap_refuse_double_sign/00002.png
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
Binary file removed
BIN
-379 Bytes
test/python/snapshots/nanox/test_solana_swap_sender_cancel/00002.png
Diff not rendered.
Binary file removed
BIN
-366 Bytes
test/python/snapshots/nanox/test_solana_swap_sender_cancel/00005.png
Diff not rendered.
Binary file removed
BIN
-379 Bytes
test/python/snapshots/nanox/test_solana_swap_sender_double_sign/00002.png
Diff not rendered.
Diff not rendered.
Binary file removed
BIN
-379 Bytes
test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00002.png
Diff not rendered.
Binary file removed
BIN
-375 Bytes
test/python/snapshots/nanox/test_solana_swap_sender_wrong_amount/00003.png
Diff not rendered.
Binary file removed
BIN
-367 Bytes
test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00001.png
Diff not rendered.
Binary file removed
BIN
-379 Bytes
test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00002.png
Diff not rendered.
Binary file removed
BIN
-375 Bytes
test/python/snapshots/nanox/test_solana_swap_sender_wrong_destination/00003.png
Diff not rendered.
File renamed without changes
File renamed without changes
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added
BIN
+402 Bytes
test/python/snapshots/nanox/test_solana_swap_wrong_amount/00002.png
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added
BIN
+402 Bytes
test/python/snapshots/nanox/test_solana_swap_wrong_destination/00002.png
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import pytest | ||
|
||
from .apps.exchange_test_runner import ExchangeTestRunner, ALL_TESTS_EXCEPT_MEMO_AND_FEES | ||
from .apps.solana import SolanaClient, ErrorType | ||
from .apps.solana_utils import SOL_PACKED_DERIVATION_PATH | ||
from .apps.solana_cmd_builder import SystemInstructionTransfer, Message, verify_signature | ||
from .apps import solana_utils as SOL | ||
|
||
# A bit hacky but way less hassle than actually writing an actual address decoder | ||
SOLANA_ADDRESS_DECODER = { | ||
SOL.FOREIGN_ADDRESS: SOL.FOREIGN_PUBLIC_KEY, | ||
SOL.FOREIGN_ADDRESS_2: SOL.FOREIGN_PUBLIC_KEY_2, | ||
} | ||
|
||
# ExchangeTestRunner implementation for Stellar | ||
class SolanaTests(ExchangeTestRunner): | ||
currency_ticker = "SOL" | ||
valid_destination_1 = SOL.FOREIGN_ADDRESS | ||
valid_destination_memo_1 = "" | ||
valid_destination_2 = SOL.FOREIGN_ADDRESS_2 | ||
valid_destination_memo_2 = "" | ||
valid_refund = SOL.OWNED_ADDRESS | ||
valid_refund_memo = "" | ||
valid_send_amount_1 = SOL.AMOUNT | ||
valid_send_amount_2 = SOL.AMOUNT_2 | ||
valid_fees_1 = SOL.FEES | ||
valid_fees_2 = SOL.FEES_2 | ||
fake_refund = SOL.FOREIGN_ADDRESS | ||
fake_refund_memo = "" | ||
fake_payout = SOL.FOREIGN_ADDRESS | ||
fake_payout_memo = "" | ||
signature_refusal_error_code = ErrorType.SOLANA_SUMMARY_FINALIZE_FAILED | ||
|
||
partner_name = "Partner name" | ||
fund_user_id = "Daft Punk" | ||
fund_account_name = "Account 0" | ||
|
||
def perform_final_tx(self, destination, send_amount, fees, memo): | ||
decoded_destination = SOLANA_ADDRESS_DECODER[destination] | ||
instruction: SystemInstructionTransfer = SystemInstructionTransfer(SOL.OWNED_PUBLIC_KEY, decoded_destination, send_amount) | ||
message: bytes = Message([instruction]).serialize() | ||
sol = SolanaClient(self.backend) | ||
with sol.send_async_sign_message(SOL_PACKED_DERIVATION_PATH, message): | ||
pass | ||
signature: bytes = sol.get_async_response().data | ||
verify_signature(SOL.OWNED_PUBLIC_KEY, message, signature) | ||
|
||
|
||
# Use a class to reuse the same Speculos instance | ||
@pytest.mark.parametrize('test_to_run', ALL_TESTS_EXCEPT_MEMO_AND_FEES) | ||
def test_solana(backend, exchange_navigation_helper, test_to_run): | ||
SolanaTests(backend, exchange_navigation_helper).run_test(test_to_run) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.