mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-13 19:18:56 +00:00
tests/device/nem: importance transfer test
This commit is contained in:
parent
5ce254c535
commit
6935c0ee7d
@ -114,6 +114,13 @@ def create_supply_change(transaction):
|
||||
return msg
|
||||
|
||||
|
||||
def create_importance_transfer(transaction):
|
||||
msg = proto.NEMImportanceTransfer()
|
||||
msg.mode = transaction["importanceTransfer"]["mode"]
|
||||
msg.public_key = binascii.unhexlify(transaction["importanceTransfer"]["publicKey"])
|
||||
return msg
|
||||
|
||||
|
||||
def create_sign_tx(transaction):
|
||||
msg = proto.NEMSignTx()
|
||||
msg.transaction = create_transaction_common(transaction)
|
||||
@ -135,6 +142,8 @@ def create_sign_tx(transaction):
|
||||
msg.mosaic_creation = create_mosaic_creation(transaction)
|
||||
elif transaction["type"] == TYPE_MOSAIC_SUPPLY_CHANGE:
|
||||
msg.supply_change = create_supply_change(transaction)
|
||||
elif transaction["type"] == TYPE_IMPORTANCE_TRANSFER:
|
||||
msg.importance_transfer = create_importance_transfer(transaction)
|
||||
else:
|
||||
raise ValueError("Unknown transaction type")
|
||||
|
||||
|
@ -347,3 +347,24 @@ class TestMsgNEMSigntx(TrezorTest):
|
||||
|
||||
assert hexlify(tx.data) == b'01100000010000987f0e730420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208480841e0000000000ff5f740401000000280000000100000020000000c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844'
|
||||
assert hexlify(tx.signature) == b'ed074a4b877e575786785e6e499e428edea28498a06bdaed6557ccdfbfe69087acd6f4b63e9faa6a849e49d405374c12762df2f27d55e4b35c1901850f83650f'
|
||||
|
||||
def test_nem_signtx_importance_transfer(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
|
||||
with self.client:
|
||||
tx = self.client.nem_sign_tx(self.client.expand_path("m/44'/1'/0'/0'/0'"), {
|
||||
"timeStamp": 12349215,
|
||||
"fee": 9900,
|
||||
"type": nem.TYPE_IMPORTANCE_TRANSFER,
|
||||
"deadline": 99,
|
||||
"message": {
|
||||
},
|
||||
"importanceTransfer": {
|
||||
"mode": 1,
|
||||
"publicKey": "c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844",
|
||||
},
|
||||
"version": (0x98 << 24),
|
||||
})
|
||||
|
||||
assert hexlify(tx.data) == b'01080000010000981f6fbc0020000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b4062084ac26000000000000630000000100000020000000c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844'
|
||||
assert hexlify(tx.signature) == b'b6d9434ec5df80e65e6e45d7f0f3c579b4adfe8567c42d981b06e8ac368b1aad2b24eebecd5efd41f4497051fca8ea8a5e77636a79afc46ee1a8e0fe9e3ba90b'
|
||||
|
Loading…
Reference in New Issue
Block a user