diff --git a/common/protob/messages-stellar.proto b/common/protob/messages-stellar.proto index 22473f7f4..8970a3300 100644 --- a/common/protob/messages-stellar.proto +++ b/common/protob/messages-stellar.proto @@ -78,7 +78,7 @@ message StellarSignTx { * @next StellarPathPaymentStrictSendOp * @next StellarManageSellOfferOp * @next StellarManageBuyOfferOp - * @next StellarCreatePassiveOfferOp + * @next StellarCreatePassiveSellOfferOp * @next StellarSetOptionsOp * @next StellarChangeTrustOp * @next StellarAllowTrustOp @@ -177,7 +177,7 @@ message StellarManageBuyOfferOp { * @next StellarTxOpRequest * @next StellarSignedTx */ -message StellarCreatePassiveOfferOp { +message StellarCreatePassiveSellOfferOp { optional string source_account = 1; // (optional) source account address required StellarAsset selling_asset = 2; required StellarAsset buying_asset = 3; diff --git a/common/protob/messages.proto b/common/protob/messages.proto index fa6e9e363..fa2f9fd63 100644 --- a/common/protob/messages.proto +++ b/common/protob/messages.proto @@ -231,7 +231,7 @@ enum MessageType { MessageType_StellarPaymentOp = 211 [(wire_in) = true]; MessageType_StellarPathPaymentStrictReceiveOp = 212 [(wire_in) = true]; MessageType_StellarManageSellOfferOp = 213 [(wire_in) = true]; - MessageType_StellarCreatePassiveOfferOp = 214 [(wire_in) = true]; + MessageType_StellarCreatePassiveSellOfferOp = 214 [(wire_in) = true]; MessageType_StellarSetOptionsOp = 215 [(wire_in) = true]; MessageType_StellarChangeTrustOp = 216 [(wire_in) = true]; MessageType_StellarAllowTrustOp = 217 [(wire_in) = true]; diff --git a/common/tests/fixtures/stellar/sign_tx.json b/common/tests/fixtures/stellar/sign_tx.json index 587b68589..d3e6353fd 100644 --- a/common/tests/fixtures/stellar/sign_tx.json +++ b/common/tests/fixtures/stellar/sign_tx.json @@ -298,7 +298,7 @@ } }, { - "name": "StellarCreatePassiveOfferOp", + "name": "StellarCreatePassiveSellOfferOp", "parameters": { "xdr": "AAAAAgAAAAAvIrnGLwi3dPPr5t1ufbk8PsLL3gJ5Vho9nFIluMMikgAAAGQAAAAAAAAD6AAAAAEAAAAAG4J3zQAAAABd5CqEAAAAAAAAAAEAAAAAAAAABAAAAAJBQkNERUZHSElKS0wAAAAAKYSWAsIOWDZfEjwS2HocpFUNEM0hsK4OGNROPlb9ahUAAAABWAAAAAAAAAAphJYCwg5YNl8SPBLYehykVQ0QzSGwrg4Y1E4+Vv1qFQAAAAAdzxaYAAAAAwAAAAQAAAAAAAAAAA==", "address_n": "m/44'/148'/0'", @@ -313,7 +313,7 @@ }, "operations": [ { - "_message_type": "StellarCreatePassiveOfferOp", + "_message_type": "StellarCreatePassiveSellOfferOp", "selling_asset": { "type": "ALPHANUM12", "code": "ABCDEFGHIJKL", @@ -888,7 +888,7 @@ "starting_balance": 100000000 }, { - "_message_type": "StellarCreatePassiveOfferOp", + "_message_type": "StellarCreatePassiveSellOfferOp", "selling_asset": { "type": "ALPHANUM12", "code": "ABCDEFGHIJKL", diff --git a/core/.changelog.d/1838.incompatible b/core/.changelog.d/1838.incompatible index 0f2b478a6..3c6f73c6d 100644 --- a/core/.changelog.d/1838.incompatible +++ b/core/.changelog.d/1838.incompatible @@ -1 +1 @@ -Stellar: rename StellarManageOfferOp to StellarManageSellOfferOp and StellarPathPaymentOp to StellarPathPaymentStrictReceiveOp. +Stellar: rename StellarManageOfferOp to StellarManageSellOfferOp, StellarPathPaymentOp to StellarPathPaymentStrictReceiveOp and StellarCreatePassiveOfferOp to StellarCreatePassiveSellOfferOp. diff --git a/core/src/apps/stellar/README.md b/core/src/apps/stellar/README.md index 5597523c6..3ad19ad8c 100644 --- a/core/src/apps/stellar/README.md +++ b/core/src/apps/stellar/README.md @@ -23,7 +23,7 @@ Stellar transaction is composed of one or more operations. We support all [opera - Bump Sequence - Change Trust - Create Account -- Create Passive Offer +- Create Passive Sell Offer - Manage Data - Manage Buy Offer - Manage Sell Offer diff --git a/core/src/apps/stellar/consts.py b/core/src/apps/stellar/consts.py index 45cbb0ff1..0a08476d0 100644 --- a/core/src/apps/stellar/consts.py +++ b/core/src/apps/stellar/consts.py @@ -12,7 +12,7 @@ if False: StellarBumpSequenceOp, StellarChangeTrustOp, StellarCreateAccountOp, - StellarCreatePassiveOfferOp, + StellarCreatePassiveSellOfferOp, StellarManageDataOp, StellarManageBuyOfferOp, StellarManageSellOfferOp, @@ -28,7 +28,7 @@ if False: StellarBumpSequenceOp, StellarChangeTrustOp, StellarCreateAccountOp, - StellarCreatePassiveOfferOp, + StellarCreatePassiveSellOfferOp, StellarManageDataOp, StellarManageBuyOfferOp, StellarManageSellOfferOp, @@ -49,7 +49,7 @@ op_codes: dict[int, int] = { MessageType.StellarBumpSequenceOp: 11, MessageType.StellarChangeTrustOp: 6, MessageType.StellarCreateAccountOp: 0, - MessageType.StellarCreatePassiveOfferOp: 4, + MessageType.StellarCreatePassiveSellOfferOp: 4, MessageType.StellarManageDataOp: 10, MessageType.StellarManageBuyOfferOp: 12, MessageType.StellarManageSellOfferOp: 3, @@ -65,7 +65,7 @@ op_wire_types = [ MessageType.StellarBumpSequenceOp, MessageType.StellarChangeTrustOp, MessageType.StellarCreateAccountOp, - MessageType.StellarCreatePassiveOfferOp, + MessageType.StellarCreatePassiveSellOfferOp, MessageType.StellarManageDataOp, MessageType.StellarManageBuyOfferOp, MessageType.StellarManageSellOfferOp, diff --git a/core/src/apps/stellar/operations/__init__.py b/core/src/apps/stellar/operations/__init__.py index e1d93063c..bf5c6b625 100644 --- a/core/src/apps/stellar/operations/__init__.py +++ b/core/src/apps/stellar/operations/__init__.py @@ -28,9 +28,9 @@ async def process_operation( elif serialize.StellarCreateAccountOp.is_type_of(op): await layout.confirm_create_account_op(ctx, op) serialize.write_create_account_op(w, op) - elif serialize.StellarCreatePassiveOfferOp.is_type_of(op): - await layout.confirm_create_passive_offer_op(ctx, op) - serialize.write_create_passive_offer_op(w, op) + elif serialize.StellarCreatePassiveSellOfferOp.is_type_of(op): + await layout.confirm_create_passive_sell_offer_op(ctx, op) + serialize.write_create_passive_sell_offer_op(w, op) elif serialize.StellarManageDataOp.is_type_of(op): await layout.confirm_manage_data_op(ctx, op) serialize.write_manage_data_op(w, op) diff --git a/core/src/apps/stellar/operations/layout.py b/core/src/apps/stellar/operations/layout.py index 53c3ab0ce..a6f447f69 100644 --- a/core/src/apps/stellar/operations/layout.py +++ b/core/src/apps/stellar/operations/layout.py @@ -6,7 +6,7 @@ from trezor.messages import ( StellarBumpSequenceOp, StellarChangeTrustOp, StellarCreateAccountOp, - StellarCreatePassiveOfferOp, + StellarCreatePassiveSellOfferOp, StellarManageBuyOfferOp, StellarManageDataOp, StellarManageSellOfferOp, @@ -98,8 +98,8 @@ async def confirm_create_account_op(ctx: Context, op: StellarCreateAccountOp) -> ) -async def confirm_create_passive_offer_op( - ctx: Context, op: StellarCreatePassiveOfferOp +async def confirm_create_passive_sell_offer_op( + ctx: Context, op: StellarCreatePassiveSellOfferOp ) -> None: if op.amount == 0: text = "Delete Passive Offer" @@ -137,7 +137,7 @@ async def _confirm_manage_offer_op_common( async def _confirm_offer( ctx: Context, title: str, - op: StellarCreatePassiveOfferOp + op: StellarCreatePassiveSellOfferOp | StellarManageSellOfferOp | StellarManageBuyOfferOp, ) -> None: diff --git a/core/src/apps/stellar/operations/serialize.py b/core/src/apps/stellar/operations/serialize.py index 5ac50276b..d18fcb5b1 100644 --- a/core/src/apps/stellar/operations/serialize.py +++ b/core/src/apps/stellar/operations/serialize.py @@ -6,7 +6,7 @@ from trezor.messages import ( StellarBumpSequenceOp, StellarChangeTrustOp, StellarCreateAccountOp, - StellarCreatePassiveOfferOp, + StellarCreatePassiveSellOfferOp, StellarManageBuyOfferOp, StellarManageDataOp, StellarManageSellOfferOp, @@ -50,7 +50,9 @@ def write_create_account_op(w: Writer, msg: StellarCreateAccountOp) -> None: writers.write_uint64(w, msg.starting_balance) -def write_create_passive_offer_op(w: Writer, msg: StellarCreatePassiveOfferOp) -> None: +def write_create_passive_sell_offer_op( + w: Writer, msg: StellarCreatePassiveSellOfferOp +) -> None: _write_asset(w, msg.selling_asset) _write_asset(w, msg.buying_asset) writers.write_uint64(w, msg.amount) diff --git a/core/src/trezor/enums/MessageType.py b/core/src/trezor/enums/MessageType.py index 925178e36..8d9ea143e 100644 --- a/core/src/trezor/enums/MessageType.py +++ b/core/src/trezor/enums/MessageType.py @@ -123,7 +123,7 @@ if not utils.BITCOIN_ONLY: StellarPaymentOp = 211 StellarPathPaymentStrictReceiveOp = 212 StellarManageSellOfferOp = 213 - StellarCreatePassiveOfferOp = 214 + StellarCreatePassiveSellOfferOp = 214 StellarSetOptionsOp = 215 StellarChangeTrustOp = 216 StellarAllowTrustOp = 217 diff --git a/core/src/trezor/enums/__init__.py b/core/src/trezor/enums/__init__.py index ff51725a1..babfefc38 100644 --- a/core/src/trezor/enums/__init__.py +++ b/core/src/trezor/enums/__init__.py @@ -128,7 +128,7 @@ if TYPE_CHECKING: StellarPaymentOp = 211 StellarPathPaymentStrictReceiveOp = 212 StellarManageSellOfferOp = 213 - StellarCreatePassiveOfferOp = 214 + StellarCreatePassiveSellOfferOp = 214 StellarSetOptionsOp = 215 StellarChangeTrustOp = 216 StellarAllowTrustOp = 217 diff --git a/core/src/trezor/messages.py b/core/src/trezor/messages.py index e401fa96f..82c9294a5 100644 --- a/core/src/trezor/messages.py +++ b/core/src/trezor/messages.py @@ -4876,7 +4876,7 @@ if TYPE_CHECKING: def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["StellarManageBuyOfferOp"]: return isinstance(msg, cls) - class StellarCreatePassiveOfferOp(protobuf.MessageType): + class StellarCreatePassiveSellOfferOp(protobuf.MessageType): source_account: "str | None" selling_asset: "StellarAsset" buying_asset: "StellarAsset" @@ -4897,7 +4897,7 @@ if TYPE_CHECKING: pass @classmethod - def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["StellarCreatePassiveOfferOp"]: + def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["StellarCreatePassiveSellOfferOp"]: return isinstance(msg, cls) class StellarSetOptionsOp(protobuf.MessageType): diff --git a/legacy/firmware/.changelog.d/1838.incompatible b/legacy/firmware/.changelog.d/1838.incompatible index 0f2b478a6..3c6f73c6d 100644 --- a/legacy/firmware/.changelog.d/1838.incompatible +++ b/legacy/firmware/.changelog.d/1838.incompatible @@ -1 +1 @@ -Stellar: rename StellarManageOfferOp to StellarManageSellOfferOp and StellarPathPaymentOp to StellarPathPaymentStrictReceiveOp. +Stellar: rename StellarManageOfferOp to StellarManageSellOfferOp, StellarPathPaymentOp to StellarPathPaymentStrictReceiveOp and StellarCreatePassiveOfferOp to StellarCreatePassiveSellOfferOp. diff --git a/legacy/firmware/fsm.h b/legacy/firmware/fsm.h index e27dad935..bffb24ad8 100644 --- a/legacy/firmware/fsm.h +++ b/legacy/firmware/fsm.h @@ -124,7 +124,8 @@ void fsm_msgStellarPathPaymentStrictSendOp( const StellarPathPaymentStrictSendOp *msg); void fsm_msgStellarManageBuyOfferOp(const StellarManageBuyOfferOp *msg); void fsm_msgStellarManageSellOfferOp(const StellarManageSellOfferOp *msg); -void fsm_msgStellarCreatePassiveOfferOp(const StellarCreatePassiveOfferOp *msg); +void fsm_msgStellarCreatePassiveSellOfferOp( + const StellarCreatePassiveSellOfferOp *msg); void fsm_msgStellarSetOptionsOp(const StellarSetOptionsOp *msg); void fsm_msgStellarChangeTrustOp(const StellarChangeTrustOp *msg); void fsm_msgStellarAllowTrustOp(const StellarAllowTrustOp *msg); diff --git a/legacy/firmware/fsm_msg_stellar.h b/legacy/firmware/fsm_msg_stellar.h index 84a074764..5eb4e41ac 100644 --- a/legacy/firmware/fsm_msg_stellar.h +++ b/legacy/firmware/fsm_msg_stellar.h @@ -183,9 +183,9 @@ void fsm_msgStellarManageSellOfferOp(const StellarManageSellOfferOp *msg) { } } -void fsm_msgStellarCreatePassiveOfferOp( - const StellarCreatePassiveOfferOp *msg) { - if (!stellar_confirmCreatePassiveOfferOp(msg)) return; +void fsm_msgStellarCreatePassiveSellOfferOp( + const StellarCreatePassiveSellOfferOp *msg) { + if (!stellar_confirmCreatePassiveSellOfferOp(msg)) return; if (stellar_allOperationsConfirmed()) { RESP_INIT(StellarSignedTx); diff --git a/legacy/firmware/protob/messages-stellar.options b/legacy/firmware/protob/messages-stellar.options index 748f9aa3a..1e26c4827 100644 --- a/legacy/firmware/protob/messages-stellar.options +++ b/legacy/firmware/protob/messages-stellar.options @@ -29,7 +29,7 @@ StellarManageBuyOfferOp.source_account max_size:57 StellarManageSellOfferOp.source_account max_size:57 -StellarCreatePassiveOfferOp.source_account max_size:57 +StellarCreatePassiveSellOfferOp.source_account max_size:57 StellarSetOptionsOp.source_account max_size:57 StellarSetOptionsOp.inflation_destination_account max_size:57 diff --git a/legacy/firmware/stellar.c b/legacy/firmware/stellar.c index 4167c7811..886a68d62 100644 --- a/legacy/firmware/stellar.c +++ b/legacy/firmware/stellar.c @@ -659,8 +659,8 @@ bool stellar_confirmManageSellOfferOp(const StellarManageSellOfferOp *msg) { return true; } -bool stellar_confirmCreatePassiveOfferOp( - const StellarCreatePassiveOfferOp *msg) { +bool stellar_confirmCreatePassiveSellOfferOp( + const StellarCreatePassiveSellOfferOp *msg) { if (!stellar_signing) return false; if (!stellar_confirmSourceAccount(msg->has_source_account, diff --git a/legacy/firmware/stellar.h b/legacy/firmware/stellar.h index 9fecb6956..7ba4e8353 100644 --- a/legacy/firmware/stellar.h +++ b/legacy/firmware/stellar.h @@ -65,8 +65,8 @@ bool stellar_confirmPathPaymentStrictSendOp( const StellarPathPaymentStrictSendOp *msg); bool stellar_confirmManageBuyOfferOp(const StellarManageBuyOfferOp *msg); bool stellar_confirmManageSellOfferOp(const StellarManageSellOfferOp *msg); -bool stellar_confirmCreatePassiveOfferOp( - const StellarCreatePassiveOfferOp *msg); +bool stellar_confirmCreatePassiveSellOfferOp( + const StellarCreatePassiveSellOfferOp *msg); bool stellar_confirmSetOptionsOp(const StellarSetOptionsOp *msg); bool stellar_confirmChangeTrustOp(const StellarChangeTrustOp *msg); bool stellar_confirmAllowTrustOp(const StellarAllowTrustOp *msg); diff --git a/python/src/trezorlib/messages.py b/python/src/trezorlib/messages.py index 830f69bf5..484e78c40 100644 --- a/python/src/trezorlib/messages.py +++ b/python/src/trezorlib/messages.py @@ -149,7 +149,7 @@ class MessageType(IntEnum): StellarPaymentOp = 211 StellarPathPaymentStrictReceiveOp = 212 StellarManageSellOfferOp = 213 - StellarCreatePassiveOfferOp = 214 + StellarCreatePassiveSellOfferOp = 214 StellarSetOptionsOp = 215 StellarChangeTrustOp = 216 StellarAllowTrustOp = 217 @@ -6454,7 +6454,7 @@ class StellarManageBuyOfferOp(protobuf.MessageType): self.source_account = source_account -class StellarCreatePassiveOfferOp(protobuf.MessageType): +class StellarCreatePassiveSellOfferOp(protobuf.MessageType): MESSAGE_WIRE_TYPE = 214 FIELDS = { 1: protobuf.Field("source_account", "string", repeated=False, required=False), diff --git a/python/src/trezorlib/stellar.py b/python/src/trezorlib/stellar.py index 00561f51f..401c84e5c 100644 --- a/python/src/trezorlib/stellar.py +++ b/python/src/trezorlib/stellar.py @@ -153,7 +153,7 @@ def _read_operation(op: "Operation"): ) if isinstance(op, CreatePassiveSellOffer): price = _read_price(op.price) - return messages.StellarCreatePassiveOfferOp( + return messages.StellarCreatePassiveSellOfferOp( source_account=source_account, selling_asset=_read_asset(op.selling), buying_asset=_read_asset(op.buying), diff --git a/python/tests/test_stellar.py b/python/tests/test_stellar.py index 2fcbc03a8..c93c975c2 100644 --- a/python/tests/test_stellar.py +++ b/python/tests/test_stellar.py @@ -447,7 +447,7 @@ def test_create_passive_sell_offer(): tx, operations = stellar.from_envelope(envelope) assert len(operations) == 1 - assert isinstance(operations[0], messages.StellarCreatePassiveOfferOp) + assert isinstance(operations[0], messages.StellarCreatePassiveSellOfferOp) assert operations[0].source_account == operation_source assert operations[0].selling_asset.type == messages.StellarAssetType.NATIVE assert operations[0].buying_asset.type == messages.StellarAssetType.ALPHANUM4 diff --git a/tests/ui_tests/fixtures.json b/tests/ui_tests/fixtures.json index cfc76e58a..381e44262 100644 --- a/tests/ui_tests/fixtures.json +++ b/tests/ui_tests/fixtures.json @@ -844,7 +844,7 @@ "test_stellar.py::test_sign_tx[StellarChangeTrustOp-add]": "7a8d420121a13e34f6ca7ad224e01a3b189ceb8e8d104cf9ec9b329222670936", "test_stellar.py::test_sign_tx[StellarChangeTrustOp-delete]": "ec26e6883ba9405412674431e0ec07504b3f25682ce7d76ebd445b809194198a", "test_stellar.py::test_sign_tx[StellarCreateAccountOp]": "2582717c25974d2b3ee156624b00375148ff7fd12eeea73625a7c367fa610373", -"test_stellar.py::test_sign_tx[StellarCreatePassiveOfferOp]": "6b0f0d2b746f98e2c85006ea7e2d5c49cd9277662e47f223138ff418066791e3", +"test_stellar.py::test_sign_tx[StellarCreatePassiveSellOfferOp]": "6b0f0d2b746f98e2c85006ea7e2d5c49cd9277662e47f223138ff418066791e3", "test_stellar.py::test_sign_tx[StellarManageDataOp]": "8fbec6547a8f9d1f002181db0cbe57fe86abef8d365b1c06fd14292cd0b068a7", "test_stellar.py::test_sign_tx[StellarManageBuyOfferOp]": "fc57e1ca8b65588aa16cc3524d6dc0f01e094ad5d16a6f7e739a69c101b554bc", "test_stellar.py::test_sign_tx[StellarManageSellOfferOp]": "6ed84765b2ed46711be0ed1219d91c27e927119d352f37b2baf8c6501186bbce",