mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
ripple: ripple prefix dropped in functions
This commit is contained in:
parent
c0f29bf4fd
commit
61e63c6a02
@ -1062,7 +1062,7 @@ def stellar_sign_transaction(connect, b64envelope, address, network_passphrase):
|
||||
def ripple_get_address(connect, address, show_display):
|
||||
client = connect()
|
||||
address_n = tools.parse_path(address)
|
||||
return ripple.ripple_get_address(client, address_n, show_display)
|
||||
return ripple.get_address(client, address_n, show_display)
|
||||
|
||||
|
||||
@cli.command(help='Sign Ripple transaction')
|
||||
@ -1074,7 +1074,7 @@ def ripple_sign_tx(connect, address, file):
|
||||
address_n = tools.parse_path(address)
|
||||
msg = ripple.create_sign_tx_msg(json.load(file))
|
||||
|
||||
result = ripple.ripple_sign_tx(client, address_n, msg)
|
||||
result = ripple.sign_tx(client, address_n, msg)
|
||||
click.echo("Signature:")
|
||||
click.echo(binascii.hexlify(result.signature))
|
||||
click.echo()
|
||||
|
@ -25,14 +25,14 @@ from .client import expect
|
||||
|
||||
@field('address')
|
||||
@expect(messages.RippleAddress)
|
||||
def ripple_get_address(client, address_n, show_display=False):
|
||||
def get_address(client, address_n, show_display=False):
|
||||
return client.call(
|
||||
messages.RippleGetAddress(
|
||||
address_n=address_n, show_display=show_display))
|
||||
|
||||
|
||||
@expect(messages.RippleSignedTx)
|
||||
def ripple_sign_tx(client, address_n, msg: messages.RippleSignTx):
|
||||
def sign_tx(client, address_n, msg: messages.RippleSignTx):
|
||||
msg.address_n = address_n
|
||||
return client.call(msg)
|
||||
|
||||
|
@ -20,7 +20,7 @@ from .common import TrezorTest
|
||||
from .conftest import TREZOR_VERSION
|
||||
from binascii import hexlify
|
||||
from trezorlib.client import CallException
|
||||
from trezorlib.ripple import ripple_get_address
|
||||
from trezorlib.ripple import get_address
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
|
||||
@ -33,11 +33,11 @@ class TestMsgRippleGetAddress(TrezorTest):
|
||||
# data from https://iancoleman.io/bip39/#english
|
||||
self.setup_mnemonic_allallall()
|
||||
|
||||
address = ripple_get_address(self.client, parse_path("m/44'/144'/0'/0/0"))
|
||||
address = get_address(self.client, parse_path("m/44'/144'/0'/0/0"))
|
||||
assert address == 'rNaqKtKrMSwpwZSzRckPf7S96DkimjkF4H'
|
||||
address = ripple_get_address(self.client, parse_path("m/44'/144'/0'/0/1"))
|
||||
address = get_address(self.client, parse_path("m/44'/144'/0'/0/1"))
|
||||
assert address == 'rBKz5MC2iXdoS3XgnNSYmF69K1Yo4NS3Ws'
|
||||
address = ripple_get_address(self.client, parse_path("m/44'/144'/1'/0/0"))
|
||||
address = get_address(self.client, parse_path("m/44'/144'/1'/0/0"))
|
||||
assert address == 'rJX2KwzaLJDyFhhtXKi3htaLfaUH2tptEX'
|
||||
|
||||
def test_ripple_get_address_other(self):
|
||||
@ -48,7 +48,7 @@ class TestMsgRippleGetAddress(TrezorTest):
|
||||
passphrase_protection=False,
|
||||
label='test',
|
||||
language='english')
|
||||
address = ripple_get_address(self.client, parse_path("m/44'/144'/0'/0/0"))
|
||||
address = get_address(self.client, parse_path("m/44'/144'/0'/0/0"))
|
||||
assert address == 'r4ocGE47gm4G4LkA9mriVHQqzpMLBTgnTY'
|
||||
address = ripple_get_address(self.client, parse_path("m/44'/144'/0'/0/1"))
|
||||
address = get_address(self.client, parse_path("m/44'/144'/0'/0/1"))
|
||||
assert address == 'rUt9ULSrUvfCmke8HTFU1szbmFpWzVbBXW'
|
||||
|
@ -41,7 +41,7 @@ class TestMsgRippleSignTx(TrezorTest):
|
||||
"Fee": 100000,
|
||||
"Sequence": 25,
|
||||
})
|
||||
resp = ripple.ripple_sign_tx(self.client, parse_path("m/44'/144'/0'/0/0"), msg)
|
||||
resp = ripple.sign_tx(self.client, parse_path("m/44'/144'/0'/0/0"), msg)
|
||||
assert resp.signature == unhexlify('3045022100e243ef623675eeeb95965c35c3e06d63a9fc68bb37e17dc87af9c0af83ec057e02206ca8aa5eaab8396397aef6d38d25710441faf7c79d292ee1d627df15ad9346c0')
|
||||
assert resp.serialized_tx == unhexlify('12000022800000002400000019614000000005f5e1006840000000000186a0732102131facd1eab748d6cddc492f54b04e8c35658894f4add2232ebc5afe7521dbe474473045022100e243ef623675eeeb95965c35c3e06d63a9fc68bb37e17dc87af9c0af83ec057e02206ca8aa5eaab8396397aef6d38d25710441faf7c79d292ee1d627df15ad9346c081148fb40e1ffa5d557ce9851a535af94965e0dd098883147148ebebf7304ccdf1676fefcf9734cf1e780826')
|
||||
|
||||
@ -52,7 +52,7 @@ class TestMsgRippleSignTx(TrezorTest):
|
||||
"Fee": 10,
|
||||
"Sequence": 1,
|
||||
})
|
||||
resp = ripple.ripple_sign_tx(self.client, parse_path("m/44'/144'/0'/0/2"), msg)
|
||||
resp = ripple.sign_tx(self.client, parse_path("m/44'/144'/0'/0/2"), msg)
|
||||
assert resp.signature == unhexlify('3044022069900e6e578997fad5189981b74b16badc7ba8b9f1052694033fa2779113ddc002206c8006ada310edf099fb22c0c12073550c8fc73247b236a974c5f1144831dd5f')
|
||||
assert resp.serialized_tx == unhexlify('1200002280000000240000000161400000000000000168400000000000000a732103dbed1e77cb91a005e2ec71afbccce5444c9be58276665a3859040f692de8fed274463044022069900e6e578997fad5189981b74b16badc7ba8b9f1052694033fa2779113ddc002206c8006ada310edf099fb22c0c12073550c8fc73247b236a974c5f1144831dd5f8114bdf86f3ae715ba346b7772ea0e133f48828b766483148fb40e1ffa5d557ce9851a535af94965e0dd0988')
|
||||
|
||||
@ -65,7 +65,7 @@ class TestMsgRippleSignTx(TrezorTest):
|
||||
"Sequence": 100,
|
||||
"LastLedgerSequence": 333111,
|
||||
})
|
||||
resp = ripple.ripple_sign_tx(self.client, parse_path("m/44'/144'/0'/0/2"), msg)
|
||||
resp = ripple.sign_tx(self.client, parse_path("m/44'/144'/0'/0/2"), msg)
|
||||
assert resp.signature == unhexlify('30440220025a9cc2809527799e6ea5eb029488dc46c6632a8ca1ed7d3ca2d9211e80403a02202cfe8604e6c6d1d3c64246626cc1a1a9bd8a2163b969e561c6adda5dca8fc2a5')
|
||||
assert resp.serialized_tx == unhexlify('12000022800000002400000064201b00051537614000000005f5e109684000000000000064732103dbed1e77cb91a005e2ec71afbccce5444c9be58276665a3859040f692de8fed2744630440220025a9cc2809527799e6ea5eb029488dc46c6632a8ca1ed7d3ca2d9211e80403a02202cfe8604e6c6d1d3c64246626cc1a1a9bd8a2163b969e561c6adda5dca8fc2a58114bdf86f3ae715ba346b7772ea0e133f48828b766483148fb40e1ffa5d557ce9851a535af94965e0dd0988')
|
||||
|
||||
@ -79,6 +79,6 @@ class TestMsgRippleSignTx(TrezorTest):
|
||||
"Sequence": 1,
|
||||
})
|
||||
with pytest.raises(CallException) as exc:
|
||||
ripple.ripple_sign_tx(self.client, parse_path("m/44'/144'/0'/0/2"), msg)
|
||||
ripple.sign_tx(self.client, parse_path("m/44'/144'/0'/0/2"), msg)
|
||||
assert exc.value.args[0] == messages.FailureType.ProcessError
|
||||
assert exc.value.args[1].endswith('Fee must be in the range of 10 to 10,000 drops')
|
||||
|
Loading…
Reference in New Issue
Block a user