refactor(common & core & legacy): Stellar, rename StellarManageOfferOp to StellarManageSellOfferOp and rename StellarPathPaymentOp to StellarPathPaymentStrictReceiveOp.

pull/1896/head
Jun Luo 3 years ago committed by matejcik
parent 0068c12f77
commit 3a5768c4bf

@ -74,8 +74,8 @@ message StellarSignTx {
* Response: device is ready for client to send the next operation * Response: device is ready for client to send the next operation
* @next StellarPaymentOp * @next StellarPaymentOp
* @next StellarCreateAccountOp * @next StellarCreateAccountOp
* @next StellarPathPaymentOp * @next StellarPathPaymentStrictReceiveOp
* @next StellarManageOfferOp * @next StellarManageSellOfferOp
* @next StellarCreatePassiveOfferOp * @next StellarCreatePassiveOfferOp
* @next StellarSetOptionsOp * @next StellarSetOptionsOp
* @next StellarChangeTrustOp * @next StellarChangeTrustOp
@ -115,7 +115,7 @@ message StellarCreateAccountOp {
* @next StellarTxOpRequest * @next StellarTxOpRequest
* @next StellarSignedTx * @next StellarSignedTx
*/ */
message StellarPathPaymentOp { message StellarPathPaymentStrictReceiveOp {
optional string source_account = 1; // (optional) source address optional string source_account = 1; // (optional) source address
required StellarAsset send_asset = 2; required StellarAsset send_asset = 2;
required sint64 send_max = 3; required sint64 send_max = 3;
@ -130,7 +130,7 @@ message StellarPathPaymentOp {
* @next StellarTxOpRequest * @next StellarTxOpRequest
* @next StellarSignedTx * @next StellarSignedTx
*/ */
message StellarManageOfferOp { message StellarManageSellOfferOp {
optional string source_account = 1; // (optional) source account address optional string source_account = 1; // (optional) source account address
required StellarAsset selling_asset = 2; required StellarAsset selling_asset = 2;
required StellarAsset buying_asset = 3; required StellarAsset buying_asset = 3;

@ -229,8 +229,8 @@ enum MessageType {
MessageType_StellarAddress = 208 [(wire_out) = true]; MessageType_StellarAddress = 208 [(wire_out) = true];
MessageType_StellarCreateAccountOp = 210 [(wire_in) = true]; MessageType_StellarCreateAccountOp = 210 [(wire_in) = true];
MessageType_StellarPaymentOp = 211 [(wire_in) = true]; MessageType_StellarPaymentOp = 211 [(wire_in) = true];
MessageType_StellarPathPaymentOp = 212 [(wire_in) = true]; MessageType_StellarPathPaymentStrictReceiveOp = 212 [(wire_in) = true];
MessageType_StellarManageOfferOp = 213 [(wire_in) = true]; MessageType_StellarManageSellOfferOp = 213 [(wire_in) = true];
MessageType_StellarCreatePassiveOfferOp = 214 [(wire_in) = true]; MessageType_StellarCreatePassiveOfferOp = 214 [(wire_in) = true];
MessageType_StellarSetOptionsOp = 215 [(wire_in) = true]; MessageType_StellarSetOptionsOp = 215 [(wire_in) = true];
MessageType_StellarChangeTrustOp = 216 [(wire_in) = true]; MessageType_StellarChangeTrustOp = 216 [(wire_in) = true];

@ -336,7 +336,7 @@
} }
}, },
{ {
"name": "StellarManageOfferOp", "name": "StellarManageSellOfferOp",
"parameters": { "parameters": {
"xdr": "AAAAAgAAAAAvIrnGLwi3dPPr5t1ufbk8PsLL3gJ5Vho9nFIluMMikgAAAGQAAAAAAAAD6AAAAAEAAAAAG4J3zQAAAABd5CqEAAAAAAAAAAEAAAAAAAAAAwAAAAJBQkNERUZHSElKS0wAAAAAKYSWAsIOWDZfEjwS2HocpFUNEM0hsK4OGNROPlb9ahUAAAABWAAAAAAAAAAphJYCwg5YNl8SPBLYehykVQ0QzSGwrg4Y1E4+Vv1qFQAAAAAdzxaYAAAAAwAAAAQAAAAAAAAFOQAAAAAAAAAA", "xdr": "AAAAAgAAAAAvIrnGLwi3dPPr5t1ufbk8PsLL3gJ5Vho9nFIluMMikgAAAGQAAAAAAAAD6AAAAAEAAAAAG4J3zQAAAABd5CqEAAAAAAAAAAEAAAAAAAAAAwAAAAJBQkNERUZHSElKS0wAAAAAKYSWAsIOWDZfEjwS2HocpFUNEM0hsK4OGNROPlb9ahUAAAABWAAAAAAAAAAphJYCwg5YNl8SPBLYehykVQ0QzSGwrg4Y1E4+Vv1qFQAAAAAdzxaYAAAAAwAAAAQAAAAAAAAFOQAAAAAAAAAA",
"address_n": "m/44'/148'/0'", "address_n": "m/44'/148'/0'",
@ -351,7 +351,7 @@
}, },
"operations": [ "operations": [
{ {
"_message_type": "StellarManageOfferOp", "_message_type": "StellarManageSellOfferOp",
"selling_asset": { "selling_asset": {
"type": "ALPHANUM12", "type": "ALPHANUM12",
"code": "ABCDEFGHIJKL", "code": "ABCDEFGHIJKL",
@ -375,7 +375,7 @@
} }
}, },
{ {
"name": "StellarPathPaymentOp", "name": "StellarPathPaymentStrictReceiveOp",
"parameters": { "parameters": {
"xdr": "AAAAAgAAAAAvIrnGLwi3dPPr5t1ufbk8PsLL3gJ5Vho9nFIluMMikgAAAGQAAAAAAAAD6AAAAAEAAAAAG4J3zQAAAABd5CqEAAAAAAAAAAEAAAAAAAAAAgAAAAFYAAAAAAAAACmElgLCDlg2XxI8Eth6HKRVDRDNIbCuDhjUTj5W/WoVAAAAAB3PFpgAAAAAXVVkJGaxhbhDFS6eIZFR28WJICfsQBAaUXvtXKAwwuAAAAACQUJDREVGR0hJSktMAAAAACmElgLCDlg2XxI8Eth6HKRVDRDNIbCuDhjUTj5W/WoVAAAAAAAB4kAAAAAAAAAAAAAAAAA=", "xdr": "AAAAAgAAAAAvIrnGLwi3dPPr5t1ufbk8PsLL3gJ5Vho9nFIluMMikgAAAGQAAAAAAAAD6AAAAAEAAAAAG4J3zQAAAABd5CqEAAAAAAAAAAEAAAAAAAAAAgAAAAFYAAAAAAAAACmElgLCDlg2XxI8Eth6HKRVDRDNIbCuDhjUTj5W/WoVAAAAAB3PFpgAAAAAXVVkJGaxhbhDFS6eIZFR28WJICfsQBAaUXvtXKAwwuAAAAACQUJDREVGR0hJSktMAAAAACmElgLCDlg2XxI8Eth6HKRVDRDNIbCuDhjUTj5W/WoVAAAAAAAB4kAAAAAAAAAAAAAAAAA=",
"address_n": "m/44'/148'/0'", "address_n": "m/44'/148'/0'",
@ -390,7 +390,7 @@
}, },
"operations": [ "operations": [
{ {
"_message_type": "StellarPathPaymentOp", "_message_type": "StellarPathPaymentStrictReceiveOp",
"send_asset": { "send_asset": {
"type": "ALPHANUM4", "type": "ALPHANUM4",
"code": "X", "code": "X",

@ -0,0 +1 @@
Stellar: rename StellarManageOfferOp to StellarManageSellOfferOp and StellarPathPaymentOp to StellarPathPaymentStrictReceiveOp.

@ -25,8 +25,8 @@ Stellar transaction is composed of one or more operations. We support all [opera
- Create Account - Create Account
- Create Passive Offer - Create Passive Offer
- Manage Data - Manage Data
- Manage Offer - Manage Sell Offer
- Path Payment - Path Payment Strict Receive
- Payment - Payment
- Set Options - Set Options

@ -14,8 +14,8 @@ if False:
StellarCreateAccountOp, StellarCreateAccountOp,
StellarCreatePassiveOfferOp, StellarCreatePassiveOfferOp,
StellarManageDataOp, StellarManageDataOp,
StellarManageOfferOp, StellarManageSellOfferOp,
StellarPathPaymentOp, StellarPathPaymentStrictReceiveOp,
StellarPaymentOp, StellarPaymentOp,
StellarSetOptionsOp, StellarSetOptionsOp,
) )
@ -28,8 +28,8 @@ if False:
StellarCreateAccountOp, StellarCreateAccountOp,
StellarCreatePassiveOfferOp, StellarCreatePassiveOfferOp,
StellarManageDataOp, StellarManageDataOp,
StellarManageOfferOp, StellarManageSellOfferOp,
StellarPathPaymentOp, StellarPathPaymentStrictReceiveOp,
StellarPaymentOp, StellarPaymentOp,
StellarSetOptionsOp, StellarSetOptionsOp,
] ]
@ -47,8 +47,8 @@ op_codes: dict[int, int] = {
MessageType.StellarCreateAccountOp: 0, MessageType.StellarCreateAccountOp: 0,
MessageType.StellarCreatePassiveOfferOp: 4, MessageType.StellarCreatePassiveOfferOp: 4,
MessageType.StellarManageDataOp: 10, MessageType.StellarManageDataOp: 10,
MessageType.StellarManageOfferOp: 3, MessageType.StellarManageSellOfferOp: 3,
MessageType.StellarPathPaymentOp: 2, MessageType.StellarPathPaymentStrictReceiveOp: 2,
MessageType.StellarPaymentOp: 1, MessageType.StellarPaymentOp: 1,
MessageType.StellarSetOptionsOp: 5, MessageType.StellarSetOptionsOp: 5,
} }
@ -61,8 +61,8 @@ op_wire_types = [
MessageType.StellarCreateAccountOp, MessageType.StellarCreateAccountOp,
MessageType.StellarCreatePassiveOfferOp, MessageType.StellarCreatePassiveOfferOp,
MessageType.StellarManageDataOp, MessageType.StellarManageDataOp,
MessageType.StellarManageOfferOp, MessageType.StellarManageSellOfferOp,
MessageType.StellarPathPaymentOp, MessageType.StellarPathPaymentStrictReceiveOp,
MessageType.StellarPaymentOp, MessageType.StellarPaymentOp,
MessageType.StellarSetOptionsOp, MessageType.StellarSetOptionsOp,
] ]

@ -34,12 +34,12 @@ async def process_operation(
elif serialize.StellarManageDataOp.is_type_of(op): elif serialize.StellarManageDataOp.is_type_of(op):
await layout.confirm_manage_data_op(ctx, op) await layout.confirm_manage_data_op(ctx, op)
serialize.write_manage_data_op(w, op) serialize.write_manage_data_op(w, op)
elif serialize.StellarManageOfferOp.is_type_of(op): elif serialize.StellarManageSellOfferOp.is_type_of(op):
await layout.confirm_manage_offer_op(ctx, op) await layout.confirm_manage_sell_offer_op(ctx, op)
serialize.write_manage_offer_op(w, op) serialize.write_manage_sell_offer_op(w, op)
elif serialize.StellarPathPaymentOp.is_type_of(op): elif serialize.StellarPathPaymentStrictReceiveOp.is_type_of(op):
await layout.confirm_path_payment_op(ctx, op) await layout.confirm_path_payment_strict_receive_op(ctx, op)
serialize.write_path_payment_op(w, op) serialize.write_path_payment_strict_receive_op(w, op)
elif serialize.StellarPaymentOp.is_type_of(op): elif serialize.StellarPaymentOp.is_type_of(op):
await layout.confirm_payment_op(ctx, op) await layout.confirm_payment_op(ctx, op)
serialize.write_payment_op(w, op) serialize.write_payment_op(w, op)

@ -8,8 +8,8 @@ from trezor.messages import (
StellarCreateAccountOp, StellarCreateAccountOp,
StellarCreatePassiveOfferOp, StellarCreatePassiveOfferOp,
StellarManageDataOp, StellarManageDataOp,
StellarManageOfferOp, StellarManageSellOfferOp,
StellarPathPaymentOp, StellarPathPaymentStrictReceiveOp,
StellarPaymentOp, StellarPaymentOp,
StellarSetOptionsOp, StellarSetOptionsOp,
) )
@ -106,7 +106,9 @@ async def confirm_create_passive_offer_op(
await _confirm_offer(ctx, text, op) await _confirm_offer(ctx, text, op)
async def confirm_manage_offer_op(ctx: Context, op: StellarManageOfferOp) -> None: async def confirm_manage_sell_offer_op(
ctx: Context, op: StellarManageSellOfferOp
) -> None:
if op.offer_id == 0: if op.offer_id == 0:
text = "New Offer" text = "New Offer"
else: else:
@ -121,7 +123,7 @@ async def confirm_manage_offer_op(ctx: Context, op: StellarManageOfferOp) -> Non
async def _confirm_offer( async def _confirm_offer(
ctx: Context, ctx: Context,
title: str, title: str,
op: StellarCreatePassiveOfferOp | StellarManageOfferOp, op: StellarCreatePassiveOfferOp | StellarManageSellOfferOp,
) -> None: ) -> None:
await confirm_properties( await confirm_properties(
ctx, ctx,
@ -161,7 +163,9 @@ async def confirm_manage_data_op(ctx: Context, op: StellarManageDataOp) -> None:
) )
async def confirm_path_payment_op(ctx: Context, op: StellarPathPaymentOp) -> None: async def confirm_path_payment_strict_receive_op(
ctx: Context, op: StellarPathPaymentStrictReceiveOp
) -> None:
await confirm_output( await confirm_output(
ctx, ctx,
address=op.destination_account, address=op.destination_account,
@ -175,7 +179,7 @@ async def confirm_path_payment_op(ctx: Context, op: StellarPathPaymentOp) -> Non
title="Debited amount", title="Debited amount",
amount=format_amount(op.send_max, op.send_asset), amount=format_amount(op.send_max, op.send_asset),
description="Pay at most:", description="Pay at most:",
br_type="op_path_payment", br_type="op_path_payment_strict_receive",
) )
await confirm_asset_issuer(ctx, op.send_asset) await confirm_asset_issuer(ctx, op.send_asset)

@ -8,8 +8,8 @@ from trezor.messages import (
StellarCreateAccountOp, StellarCreateAccountOp,
StellarCreatePassiveOfferOp, StellarCreatePassiveOfferOp,
StellarManageDataOp, StellarManageDataOp,
StellarManageOfferOp, StellarManageSellOfferOp,
StellarPathPaymentOp, StellarPathPaymentStrictReceiveOp,
StellarPaymentOp, StellarPaymentOp,
StellarSetOptionsOp, StellarSetOptionsOp,
) )
@ -65,7 +65,7 @@ def write_manage_data_op(w: Writer, msg: StellarManageDataOp) -> None:
writers.write_string(w, msg.value) writers.write_string(w, msg.value)
def write_manage_offer_op(w: Writer, msg: StellarManageOfferOp) -> None: def write_manage_sell_offer_op(w: Writer, msg: StellarManageSellOfferOp) -> None:
_write_asset(w, msg.selling_asset) _write_asset(w, msg.selling_asset)
_write_asset(w, msg.buying_asset) _write_asset(w, msg.buying_asset)
writers.write_uint64(w, msg.amount) # amount to sell writers.write_uint64(w, msg.amount) # amount to sell
@ -74,7 +74,9 @@ def write_manage_offer_op(w: Writer, msg: StellarManageOfferOp) -> None:
writers.write_uint64(w, msg.offer_id) writers.write_uint64(w, msg.offer_id)
def write_path_payment_op(w: Writer, msg: StellarPathPaymentOp) -> None: def write_path_payment_strict_receive_op(
w: Writer, msg: StellarPathPaymentStrictReceiveOp
) -> None:
_write_asset(w, msg.send_asset) _write_asset(w, msg.send_asset)
writers.write_uint64(w, msg.send_max) writers.write_uint64(w, msg.send_max)
writers.write_pubkey(w, msg.destination_account) writers.write_pubkey(w, msg.destination_account)

@ -121,8 +121,8 @@ if not utils.BITCOIN_ONLY:
StellarAddress = 208 StellarAddress = 208
StellarCreateAccountOp = 210 StellarCreateAccountOp = 210
StellarPaymentOp = 211 StellarPaymentOp = 211
StellarPathPaymentOp = 212 StellarPathPaymentStrictReceiveOp = 212
StellarManageOfferOp = 213 StellarManageSellOfferOp = 213
StellarCreatePassiveOfferOp = 214 StellarCreatePassiveOfferOp = 214
StellarSetOptionsOp = 215 StellarSetOptionsOp = 215
StellarChangeTrustOp = 216 StellarChangeTrustOp = 216

@ -126,8 +126,8 @@ if TYPE_CHECKING:
StellarAddress = 208 StellarAddress = 208
StellarCreateAccountOp = 210 StellarCreateAccountOp = 210
StellarPaymentOp = 211 StellarPaymentOp = 211
StellarPathPaymentOp = 212 StellarPathPaymentStrictReceiveOp = 212
StellarManageOfferOp = 213 StellarManageSellOfferOp = 213
StellarCreatePassiveOfferOp = 214 StellarCreatePassiveOfferOp = 214
StellarSetOptionsOp = 215 StellarSetOptionsOp = 215
StellarChangeTrustOp = 216 StellarChangeTrustOp = 216

@ -4772,7 +4772,7 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["StellarCreateAccountOp"]: def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["StellarCreateAccountOp"]:
return isinstance(msg, cls) return isinstance(msg, cls)
class StellarPathPaymentOp(protobuf.MessageType): class StellarPathPaymentStrictReceiveOp(protobuf.MessageType):
source_account: "str | None" source_account: "str | None"
send_asset: "StellarAsset" send_asset: "StellarAsset"
send_max: "int" send_max: "int"
@ -4795,10 +4795,10 @@ if TYPE_CHECKING:
pass pass
@classmethod @classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["StellarPathPaymentOp"]: def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["StellarPathPaymentStrictReceiveOp"]:
return isinstance(msg, cls) return isinstance(msg, cls)
class StellarManageOfferOp(protobuf.MessageType): class StellarManageSellOfferOp(protobuf.MessageType):
source_account: "str | None" source_account: "str | None"
selling_asset: "StellarAsset" selling_asset: "StellarAsset"
buying_asset: "StellarAsset" buying_asset: "StellarAsset"
@ -4821,7 +4821,7 @@ if TYPE_CHECKING:
pass pass
@classmethod @classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["StellarManageOfferOp"]: def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["StellarManageSellOfferOp"]:
return isinstance(msg, cls) return isinstance(msg, cls)
class StellarCreatePassiveOfferOp(protobuf.MessageType): class StellarCreatePassiveOfferOp(protobuf.MessageType):

@ -0,0 +1 @@
Stellar: rename StellarManageOfferOp to StellarManageSellOfferOp and StellarPathPaymentOp to StellarPathPaymentStrictReceiveOp.

@ -118,8 +118,9 @@ void fsm_msgStellarGetAddress(const StellarGetAddress *msg);
void fsm_msgStellarSignTx(const StellarSignTx *msg); void fsm_msgStellarSignTx(const StellarSignTx *msg);
void fsm_msgStellarPaymentOp(const StellarPaymentOp *msg); void fsm_msgStellarPaymentOp(const StellarPaymentOp *msg);
void fsm_msgStellarCreateAccountOp(const StellarCreateAccountOp *msg); void fsm_msgStellarCreateAccountOp(const StellarCreateAccountOp *msg);
void fsm_msgStellarPathPaymentOp(const StellarPathPaymentOp *msg); void fsm_msgStellarPathPaymentStrictReceiveOp(
void fsm_msgStellarManageOfferOp(const StellarManageOfferOp *msg); const StellarPathPaymentStrictReceiveOp *msg);
void fsm_msgStellarManageSellOfferOp(const StellarManageSellOfferOp *msg);
void fsm_msgStellarCreatePassiveOfferOp(const StellarCreatePassiveOfferOp *msg); void fsm_msgStellarCreatePassiveOfferOp(const StellarCreatePassiveOfferOp *msg);
void fsm_msgStellarSetOptionsOp(const StellarSetOptionsOp *msg); void fsm_msgStellarSetOptionsOp(const StellarSetOptionsOp *msg);
void fsm_msgStellarChangeTrustOp(const StellarChangeTrustOp *msg); void fsm_msgStellarChangeTrustOp(const StellarChangeTrustOp *msg);

@ -109,8 +109,9 @@ void fsm_msgStellarPaymentOp(const StellarPaymentOp *msg) {
} }
} }
void fsm_msgStellarPathPaymentOp(const StellarPathPaymentOp *msg) { void fsm_msgStellarPathPaymentStrictReceiveOp(
if (!stellar_confirmPathPaymentOp(msg)) return; const StellarPathPaymentStrictReceiveOp *msg) {
if (!stellar_confirmPathPaymentStrictReceiveOp(msg)) return;
if (stellar_allOperationsConfirmed()) { if (stellar_allOperationsConfirmed()) {
RESP_INIT(StellarSignedTx); RESP_INIT(StellarSignedTx);
@ -127,8 +128,8 @@ void fsm_msgStellarPathPaymentOp(const StellarPathPaymentOp *msg) {
} }
} }
void fsm_msgStellarManageOfferOp(const StellarManageOfferOp *msg) { void fsm_msgStellarManageSellOfferOp(const StellarManageSellOfferOp *msg) {
if (!stellar_confirmManageOfferOp(msg)) return; if (!stellar_confirmManageSellOfferOp(msg)) return;
if (stellar_allOperationsConfirmed()) { if (stellar_allOperationsConfirmed()) {
RESP_INIT(StellarSignedTx); RESP_INIT(StellarSignedTx);

@ -17,12 +17,12 @@ StellarPaymentOp.destination_account max_size:57
StellarCreateAccountOp.source_account max_size:57 StellarCreateAccountOp.source_account max_size:57
StellarCreateAccountOp.new_account max_size:57 StellarCreateAccountOp.new_account max_size:57
StellarPathPaymentOp.source_account max_size:57 StellarPathPaymentStrictReceiveOp.source_account max_size:57
StellarPathPaymentOp.destination_account max_size:57 StellarPathPaymentStrictReceiveOp.destination_account max_size:57
StellarPathPaymentOp.paths max_count:5 StellarPathPaymentStrictReceiveOp.paths max_count:5
StellarManageOfferOp.source_account max_size:57 StellarManageSellOfferOp.source_account max_size:57
StellarCreatePassiveOfferOp.source_account max_size:57 StellarCreatePassiveOfferOp.source_account max_size:57

@ -289,7 +289,8 @@ bool stellar_confirmPaymentOp(const StellarPaymentOp *msg) {
return true; return true;
} }
bool stellar_confirmPathPaymentOp(const StellarPathPaymentOp *msg) { bool stellar_confirmPathPaymentStrictReceiveOp(
const StellarPathPaymentStrictReceiveOp *msg) {
if (!stellar_signing) return false; if (!stellar_signing) return false;
if (!stellar_confirmSourceAccount(msg->has_source_account, if (!stellar_confirmSourceAccount(msg->has_source_account,
@ -387,7 +388,7 @@ bool stellar_confirmPathPaymentOp(const StellarPathPaymentOp *msg) {
return true; return true;
} }
bool stellar_confirmManageOfferOp(const StellarManageOfferOp *msg) { bool stellar_confirmManageSellOfferOp(const StellarManageSellOfferOp *msg) {
if (!stellar_signing) return false; if (!stellar_signing) return false;
if (!stellar_confirmSourceAccount(msg->has_source_account, if (!stellar_confirmSourceAccount(msg->has_source_account,

@ -59,8 +59,9 @@ bool stellar_confirmSourceAccount(bool has_source_account,
const char *str_account); const char *str_account);
bool stellar_confirmCreateAccountOp(const StellarCreateAccountOp *msg); bool stellar_confirmCreateAccountOp(const StellarCreateAccountOp *msg);
bool stellar_confirmPaymentOp(const StellarPaymentOp *msg); bool stellar_confirmPaymentOp(const StellarPaymentOp *msg);
bool stellar_confirmPathPaymentOp(const StellarPathPaymentOp *msg); bool stellar_confirmPathPaymentStrictReceiveOp(
bool stellar_confirmManageOfferOp(const StellarManageOfferOp *msg); const StellarPathPaymentStrictReceiveOp *msg);
bool stellar_confirmManageSellOfferOp(const StellarManageSellOfferOp *msg);
bool stellar_confirmCreatePassiveOfferOp( bool stellar_confirmCreatePassiveOfferOp(
const StellarCreatePassiveOfferOp *msg); const StellarCreatePassiveOfferOp *msg);
bool stellar_confirmSetOptionsOp(const StellarSetOptionsOp *msg); bool stellar_confirmSetOptionsOp(const StellarSetOptionsOp *msg);

@ -147,8 +147,8 @@ class MessageType(IntEnum):
StellarAddress = 208 StellarAddress = 208
StellarCreateAccountOp = 210 StellarCreateAccountOp = 210
StellarPaymentOp = 211 StellarPaymentOp = 211
StellarPathPaymentOp = 212 StellarPathPaymentStrictReceiveOp = 212
StellarManageOfferOp = 213 StellarManageSellOfferOp = 213
StellarCreatePassiveOfferOp = 214 StellarCreatePassiveOfferOp = 214
StellarSetOptionsOp = 215 StellarSetOptionsOp = 215
StellarChangeTrustOp = 216 StellarChangeTrustOp = 216
@ -6324,7 +6324,7 @@ class StellarCreateAccountOp(protobuf.MessageType):
self.source_account = source_account self.source_account = source_account
class StellarPathPaymentOp(protobuf.MessageType): class StellarPathPaymentStrictReceiveOp(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 212 MESSAGE_WIRE_TYPE = 212
FIELDS = { FIELDS = {
1: protobuf.Field("source_account", "string", repeated=False, required=False), 1: protobuf.Field("source_account", "string", repeated=False, required=False),
@ -6356,7 +6356,7 @@ class StellarPathPaymentOp(protobuf.MessageType):
self.source_account = source_account self.source_account = source_account
class StellarManageOfferOp(protobuf.MessageType): class StellarManageSellOfferOp(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 213 MESSAGE_WIRE_TYPE = 213
FIELDS = { FIELDS = {
1: protobuf.Field("source_account", "string", repeated=False, required=False), 1: protobuf.Field("source_account", "string", repeated=False, required=False),

@ -128,7 +128,7 @@ def _read_operation(op: "Operation"):
amount=_read_amount(op.amount), amount=_read_amount(op.amount),
) )
if isinstance(op, PathPaymentStrictReceive): if isinstance(op, PathPaymentStrictReceive):
operation = messages.StellarPathPaymentOp( operation = messages.StellarPathPaymentStrictReceiveOp(
source_account=source_account, source_account=source_account,
send_asset=_read_asset(op.send_asset), send_asset=_read_asset(op.send_asset),
send_max=_read_amount(op.send_max), send_max=_read_amount(op.send_max),
@ -140,7 +140,7 @@ def _read_operation(op: "Operation"):
return operation return operation
if isinstance(op, ManageSellOffer): if isinstance(op, ManageSellOffer):
price = _read_price(op.price) price = _read_price(op.price)
return messages.StellarManageOfferOp( return messages.StellarManageSellOfferOp(
source_account=source_account, source_account=source_account,
selling_asset=_read_asset(op.selling), selling_asset=_read_asset(op.selling),
buying_asset=_read_asset(op.buying), buying_asset=_read_asset(op.buying),

@ -325,7 +325,7 @@ def test_path_payment_strict_receive():
tx, operations = stellar.from_envelope(envelope) tx, operations = stellar.from_envelope(envelope)
assert len(operations) == 1 assert len(operations) == 1
assert isinstance(operations[0], messages.StellarPathPaymentOp) assert isinstance(operations[0], messages.StellarPathPaymentStrictReceiveOp)
assert operations[0].source_account == operation_source assert operations[0].source_account == operation_source
assert operations[0].destination_account == destination assert operations[0].destination_account == destination
assert operations[0].send_asset.type == messages.StellarAssetType.NATIVE assert operations[0].send_asset.type == messages.StellarAssetType.NATIVE
@ -368,7 +368,7 @@ def test_manage_sell_offer_new_offer():
tx, operations = stellar.from_envelope(envelope) tx, operations = stellar.from_envelope(envelope)
assert len(operations) == 1 assert len(operations) == 1
assert isinstance(operations[0], messages.StellarManageOfferOp) assert isinstance(operations[0], messages.StellarManageSellOfferOp)
assert operations[0].source_account == operation_source assert operations[0].source_account == operation_source
assert operations[0].selling_asset.type == messages.StellarAssetType.NATIVE assert operations[0].selling_asset.type == messages.StellarAssetType.NATIVE
assert operations[0].buying_asset.type == messages.StellarAssetType.ALPHANUM4 assert operations[0].buying_asset.type == messages.StellarAssetType.ALPHANUM4
@ -408,7 +408,7 @@ def test_manage_sell_offer_update_offer():
tx, operations = stellar.from_envelope(envelope) tx, operations = stellar.from_envelope(envelope)
assert len(operations) == 1 assert len(operations) == 1
assert isinstance(operations[0], messages.StellarManageOfferOp) assert isinstance(operations[0], messages.StellarManageSellOfferOp)
assert operations[0].source_account == operation_source assert operations[0].source_account == operation_source
assert operations[0].selling_asset.type == messages.StellarAssetType.NATIVE assert operations[0].selling_asset.type == messages.StellarAssetType.NATIVE
assert operations[0].buying_asset.type == messages.StellarAssetType.ALPHANUM4 assert operations[0].buying_asset.type == messages.StellarAssetType.ALPHANUM4

@ -846,8 +846,8 @@
"test_stellar.py::test_sign_tx[StellarCreateAccountOp]": "2582717c25974d2b3ee156624b00375148ff7fd12eeea73625a7c367fa610373", "test_stellar.py::test_sign_tx[StellarCreateAccountOp]": "2582717c25974d2b3ee156624b00375148ff7fd12eeea73625a7c367fa610373",
"test_stellar.py::test_sign_tx[StellarCreatePassiveOfferOp]": "6b0f0d2b746f98e2c85006ea7e2d5c49cd9277662e47f223138ff418066791e3", "test_stellar.py::test_sign_tx[StellarCreatePassiveOfferOp]": "6b0f0d2b746f98e2c85006ea7e2d5c49cd9277662e47f223138ff418066791e3",
"test_stellar.py::test_sign_tx[StellarManageDataOp]": "8fbec6547a8f9d1f002181db0cbe57fe86abef8d365b1c06fd14292cd0b068a7", "test_stellar.py::test_sign_tx[StellarManageDataOp]": "8fbec6547a8f9d1f002181db0cbe57fe86abef8d365b1c06fd14292cd0b068a7",
"test_stellar.py::test_sign_tx[StellarManageOfferOp]": "6ed84765b2ed46711be0ed1219d91c27e927119d352f37b2baf8c6501186bbce", "test_stellar.py::test_sign_tx[StellarManageSellOfferOp]": "6ed84765b2ed46711be0ed1219d91c27e927119d352f37b2baf8c6501186bbce",
"test_stellar.py::test_sign_tx[StellarPathPaymentOp]": "58f3bfaece0706bc172d6e6564b728ec0b7f8e2629d8c64dc60672786586076d", "test_stellar.py::test_sign_tx[StellarPathPaymentStrictReceiveOp]": "58f3bfaece0706bc172d6e6564b728ec0b7f8e2629d8c64dc60672786586076d",
"test_stellar.py::test_sign_tx[StellarPaymentOp-asset12]": "1d8e9d5d65420a259f7e2deef1efaf0ce5be966a0f1e5b8e95b832f176f00de2", "test_stellar.py::test_sign_tx[StellarPaymentOp-asset12]": "1d8e9d5d65420a259f7e2deef1efaf0ce5be966a0f1e5b8e95b832f176f00de2",
"test_stellar.py::test_sign_tx[StellarPaymentOp-asset4]": "0de0b815dad5d348a3b9d06e37da94800363e5de8e6ca9cd0f84e5070f7e1b22", "test_stellar.py::test_sign_tx[StellarPaymentOp-asset4]": "0de0b815dad5d348a3b9d06e37da94800363e5de8e6ca9cd0f84e5070f7e1b22",
"test_stellar.py::test_sign_tx[StellarPaymentOp-native_asset]": "b2015b9e0f9ff60e2ea4fca2942e97b70a320386c2043fb36acde4a830272098", "test_stellar.py::test_sign_tx[StellarPaymentOp-native_asset]": "b2015b9e0f9ff60e2ea4fca2942e97b70a320386c2043fb36acde4a830272098",

Loading…
Cancel
Save