mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
feat(cardano): add babbage data types
This commit is contained in:
parent
687a981d12
commit
99a7c48e64
@ -46,6 +46,11 @@ enum CardanoNativeScriptHashDisplayFormat {
|
||||
POLICY_ID = 2;
|
||||
}
|
||||
|
||||
enum CardanoTxOutputSerializationFormat {
|
||||
ARRAY_LEGACY = 0; // legacy_transaction_output in CDDL
|
||||
MAP_BABBAGE = 1; // post_alonzo_transaction_output in CDDL
|
||||
}
|
||||
|
||||
enum CardanoCertificateType {
|
||||
STAKE_REGISTRATION = 0;
|
||||
STAKE_DEREGISTRATION = 1;
|
||||
@ -210,6 +215,9 @@ message CardanoSignTxInit {
|
||||
optional bytes script_data_hash = 16;
|
||||
required uint32 collateral_inputs_count = 17;
|
||||
required uint32 required_signers_count = 18;
|
||||
optional bool has_collateral_return = 19 [default=false];
|
||||
optional uint64 total_collateral = 20;
|
||||
optional uint32 reference_inputs_count = 21 [default=0];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -226,11 +234,14 @@ message CardanoTxInput {
|
||||
* @next CardanoTxItemAck
|
||||
*/
|
||||
message CardanoTxOutput {
|
||||
optional string address = 1; // target coin address in bech32 or base58
|
||||
optional CardanoAddressParametersType address_parameters = 2; // parameters used to derive the address
|
||||
required uint64 amount = 3; // amount to spend
|
||||
optional string address = 1; // target coin address in bech32 or base58
|
||||
optional CardanoAddressParametersType address_parameters = 2; // parameters used to derive the address
|
||||
required uint64 amount = 3; // amount to spend
|
||||
required uint32 asset_groups_count = 4;
|
||||
optional bytes datum_hash = 5;
|
||||
optional CardanoTxOutputSerializationFormat format = 6 [default=ARRAY_LEGACY];
|
||||
optional uint32 inline_datum_size = 7 [default=0]; // 0 means no inline datum
|
||||
optional uint32 reference_script_size = 8 [default=0]; // 0 means no reference script
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,6 +263,22 @@ message CardanoToken {
|
||||
optional sint64 mint_amount = 3; // mint amount (can also be negative in which case the tokens are burnt)
|
||||
}
|
||||
|
||||
/**
|
||||
* Request: Transaction output inline datum chunk
|
||||
* @next CardanoTxItemAck
|
||||
*/
|
||||
message CardanoTxInlineDatumChunk {
|
||||
required bytes data = 1; // expected maximum chunk size is 1024 bytes
|
||||
}
|
||||
|
||||
/**
|
||||
* Request: Transaction output reference script chunk
|
||||
* @next CardanoTxItemAck
|
||||
*/
|
||||
message CardanoTxReferenceScriptChunk {
|
||||
required bytes data = 1; // expected maximum chunk size is 1024 bytes
|
||||
}
|
||||
|
||||
/**
|
||||
* Request: Stake pool owner parameters
|
||||
* @next CardanoTxItemAck
|
||||
@ -371,12 +398,23 @@ message CardanoTxRequiredSigner {
|
||||
repeated uint32 key_path = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request: Transaction reference input data
|
||||
* @next CardanoTxItemAck
|
||||
*/
|
||||
message CardanoTxReferenceInput {
|
||||
required bytes prev_hash = 1;
|
||||
required uint32 prev_index = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Response: Acknowledgement of the last transaction item received
|
||||
* @next CardanoTxInput
|
||||
* @next CardanoTxOutput
|
||||
* @next CardanoAssetGroup
|
||||
* @next CardanoToken
|
||||
* @next CardanoTxInlineDatumChunk
|
||||
* @next CardanoTxReferenceScriptChunk
|
||||
* @next CardanoTxCertificate
|
||||
* @next CardanoPoolOwner
|
||||
* @next CardanoPoolRelayParameters
|
||||
@ -386,6 +424,7 @@ message CardanoTxRequiredSigner {
|
||||
* @next CardanoTxMint
|
||||
* @next CardanoTxCollateralInput
|
||||
* @next CardanoTxRequiredSigner
|
||||
* @next CardanoTxReferenceInput
|
||||
*/
|
||||
message CardanoTxItemAck {
|
||||
}
|
||||
|
@ -283,6 +283,9 @@ enum MessageType {
|
||||
MessageType_CardanoTxMint = 332 [(wire_in) = true];
|
||||
MessageType_CardanoTxCollateralInput = 333 [(wire_in) = true];
|
||||
MessageType_CardanoTxRequiredSigner = 334 [(wire_in) = true];
|
||||
MessageType_CardanoTxInlineDatumChunk = 335 [(wire_in) = true];
|
||||
MessageType_CardanoTxReferenceScriptChunk = 336 [(wire_in) = true];
|
||||
MessageType_CardanoTxReferenceInput = 337 [(wire_in) = true];
|
||||
|
||||
// Ripple
|
||||
MessageType_RippleGetAddress = 400 [(wire_in) = true];
|
||||
|
@ -431,6 +431,8 @@ if not utils.BITCOIN_ONLY:
|
||||
import trezor.enums.CardanoPoolRelayType
|
||||
trezor.enums.CardanoTxAuxiliaryDataSupplementType
|
||||
import trezor.enums.CardanoTxAuxiliaryDataSupplementType
|
||||
trezor.enums.CardanoTxOutputSerializationFormat
|
||||
import trezor.enums.CardanoTxOutputSerializationFormat
|
||||
trezor.enums.CardanoTxSigningMode
|
||||
import trezor.enums.CardanoTxSigningMode
|
||||
trezor.enums.CardanoTxWitnessType
|
||||
|
@ -0,0 +1,6 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
# isort:skip_file
|
||||
|
||||
ARRAY_LEGACY = 0
|
||||
MAP_BABBAGE = 1
|
@ -168,6 +168,9 @@ if not utils.BITCOIN_ONLY:
|
||||
CardanoTxMint = 332
|
||||
CardanoTxCollateralInput = 333
|
||||
CardanoTxRequiredSigner = 334
|
||||
CardanoTxInlineDatumChunk = 335
|
||||
CardanoTxReferenceScriptChunk = 336
|
||||
CardanoTxReferenceInput = 337
|
||||
RippleGetAddress = 400
|
||||
RippleAddress = 401
|
||||
RippleSignTx = 402
|
||||
|
@ -186,6 +186,9 @@ if TYPE_CHECKING:
|
||||
CardanoTxMint = 332
|
||||
CardanoTxCollateralInput = 333
|
||||
CardanoTxRequiredSigner = 334
|
||||
CardanoTxInlineDatumChunk = 335
|
||||
CardanoTxReferenceScriptChunk = 336
|
||||
CardanoTxReferenceInput = 337
|
||||
RippleGetAddress = 400
|
||||
RippleAddress = 401
|
||||
RippleSignTx = 402
|
||||
@ -361,6 +364,10 @@ if TYPE_CHECKING:
|
||||
BECH32 = 1
|
||||
POLICY_ID = 2
|
||||
|
||||
class CardanoTxOutputSerializationFormat(IntEnum):
|
||||
ARRAY_LEGACY = 0
|
||||
MAP_BABBAGE = 1
|
||||
|
||||
class CardanoCertificateType(IntEnum):
|
||||
STAKE_REGISTRATION = 0
|
||||
STAKE_DEREGISTRATION = 1
|
||||
|
@ -30,6 +30,7 @@ if TYPE_CHECKING:
|
||||
from trezor.enums import CardanoNativeScriptType # noqa: F401
|
||||
from trezor.enums import CardanoPoolRelayType # noqa: F401
|
||||
from trezor.enums import CardanoTxAuxiliaryDataSupplementType # noqa: F401
|
||||
from trezor.enums import CardanoTxOutputSerializationFormat # noqa: F401
|
||||
from trezor.enums import CardanoTxSigningMode # noqa: F401
|
||||
from trezor.enums import CardanoTxWitnessType # noqa: F401
|
||||
from trezor.enums import DebugButton # noqa: F401
|
||||
@ -1336,6 +1337,9 @@ if TYPE_CHECKING:
|
||||
script_data_hash: "bytes | None"
|
||||
collateral_inputs_count: "int"
|
||||
required_signers_count: "int"
|
||||
has_collateral_return: "bool"
|
||||
total_collateral: "int | None"
|
||||
reference_inputs_count: "int"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@ -1358,6 +1362,9 @@ if TYPE_CHECKING:
|
||||
validity_interval_start: "int | None" = None,
|
||||
include_network_id: "bool | None" = None,
|
||||
script_data_hash: "bytes | None" = None,
|
||||
has_collateral_return: "bool | None" = None,
|
||||
total_collateral: "int | None" = None,
|
||||
reference_inputs_count: "int | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -1387,6 +1394,9 @@ if TYPE_CHECKING:
|
||||
amount: "int"
|
||||
asset_groups_count: "int"
|
||||
datum_hash: "bytes | None"
|
||||
format: "CardanoTxOutputSerializationFormat"
|
||||
inline_datum_size: "int"
|
||||
reference_script_size: "int"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@ -1396,6 +1406,9 @@ if TYPE_CHECKING:
|
||||
address: "str | None" = None,
|
||||
address_parameters: "CardanoAddressParametersType | None" = None,
|
||||
datum_hash: "bytes | None" = None,
|
||||
format: "CardanoTxOutputSerializationFormat | None" = None,
|
||||
inline_datum_size: "int | None" = None,
|
||||
reference_script_size: "int | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -1437,6 +1450,34 @@ if TYPE_CHECKING:
|
||||
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoToken"]:
|
||||
return isinstance(msg, cls)
|
||||
|
||||
class CardanoTxInlineDatumChunk(protobuf.MessageType):
|
||||
data: "bytes"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
data: "bytes",
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxInlineDatumChunk"]:
|
||||
return isinstance(msg, cls)
|
||||
|
||||
class CardanoTxReferenceScriptChunk(protobuf.MessageType):
|
||||
data: "bytes"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
data: "bytes",
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxReferenceScriptChunk"]:
|
||||
return isinstance(msg, cls)
|
||||
|
||||
class CardanoPoolOwner(protobuf.MessageType):
|
||||
staking_key_path: "list[int]"
|
||||
staking_key_hash: "bytes | None"
|
||||
@ -1649,6 +1690,22 @@ if TYPE_CHECKING:
|
||||
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxRequiredSigner"]:
|
||||
return isinstance(msg, cls)
|
||||
|
||||
class CardanoTxReferenceInput(protobuf.MessageType):
|
||||
prev_hash: "bytes"
|
||||
prev_index: "int"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
prev_hash: "bytes",
|
||||
prev_index: "int",
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxReferenceInput"]:
|
||||
return isinstance(msg, cls)
|
||||
|
||||
class CardanoTxItemAck(protobuf.MessageType):
|
||||
|
||||
@classmethod
|
||||
|
@ -194,6 +194,9 @@ class MessageType(IntEnum):
|
||||
CardanoTxMint = 332
|
||||
CardanoTxCollateralInput = 333
|
||||
CardanoTxRequiredSigner = 334
|
||||
CardanoTxInlineDatumChunk = 335
|
||||
CardanoTxReferenceScriptChunk = 336
|
||||
CardanoTxReferenceInput = 337
|
||||
RippleGetAddress = 400
|
||||
RippleAddress = 401
|
||||
RippleSignTx = 402
|
||||
@ -382,6 +385,11 @@ class CardanoNativeScriptHashDisplayFormat(IntEnum):
|
||||
POLICY_ID = 2
|
||||
|
||||
|
||||
class CardanoTxOutputSerializationFormat(IntEnum):
|
||||
ARRAY_LEGACY = 0
|
||||
MAP_BABBAGE = 1
|
||||
|
||||
|
||||
class CardanoCertificateType(IntEnum):
|
||||
STAKE_REGISTRATION = 0
|
||||
STAKE_DEREGISTRATION = 1
|
||||
@ -2257,6 +2265,9 @@ class CardanoSignTxInit(protobuf.MessageType):
|
||||
16: protobuf.Field("script_data_hash", "bytes", repeated=False, required=False),
|
||||
17: protobuf.Field("collateral_inputs_count", "uint32", repeated=False, required=True),
|
||||
18: protobuf.Field("required_signers_count", "uint32", repeated=False, required=True),
|
||||
19: protobuf.Field("has_collateral_return", "bool", repeated=False, required=False),
|
||||
20: protobuf.Field("total_collateral", "uint64", repeated=False, required=False),
|
||||
21: protobuf.Field("reference_inputs_count", "uint32", repeated=False, required=False),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
@ -2280,6 +2291,9 @@ class CardanoSignTxInit(protobuf.MessageType):
|
||||
validity_interval_start: Optional["int"] = None,
|
||||
include_network_id: Optional["bool"] = False,
|
||||
script_data_hash: Optional["bytes"] = None,
|
||||
has_collateral_return: Optional["bool"] = False,
|
||||
total_collateral: Optional["int"] = None,
|
||||
reference_inputs_count: Optional["int"] = 0,
|
||||
) -> None:
|
||||
self.signing_mode = signing_mode
|
||||
self.protocol_magic = protocol_magic
|
||||
@ -2299,6 +2313,9 @@ class CardanoSignTxInit(protobuf.MessageType):
|
||||
self.validity_interval_start = validity_interval_start
|
||||
self.include_network_id = include_network_id
|
||||
self.script_data_hash = script_data_hash
|
||||
self.has_collateral_return = has_collateral_return
|
||||
self.total_collateral = total_collateral
|
||||
self.reference_inputs_count = reference_inputs_count
|
||||
|
||||
|
||||
class CardanoTxInput(protobuf.MessageType):
|
||||
@ -2326,6 +2343,9 @@ class CardanoTxOutput(protobuf.MessageType):
|
||||
3: protobuf.Field("amount", "uint64", repeated=False, required=True),
|
||||
4: protobuf.Field("asset_groups_count", "uint32", repeated=False, required=True),
|
||||
5: protobuf.Field("datum_hash", "bytes", repeated=False, required=False),
|
||||
6: protobuf.Field("format", "CardanoTxOutputSerializationFormat", repeated=False, required=False),
|
||||
7: protobuf.Field("inline_datum_size", "uint32", repeated=False, required=False),
|
||||
8: protobuf.Field("reference_script_size", "uint32", repeated=False, required=False),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
@ -2336,12 +2356,18 @@ class CardanoTxOutput(protobuf.MessageType):
|
||||
address: Optional["str"] = None,
|
||||
address_parameters: Optional["CardanoAddressParametersType"] = None,
|
||||
datum_hash: Optional["bytes"] = None,
|
||||
format: Optional["CardanoTxOutputSerializationFormat"] = CardanoTxOutputSerializationFormat.ARRAY_LEGACY,
|
||||
inline_datum_size: Optional["int"] = 0,
|
||||
reference_script_size: Optional["int"] = 0,
|
||||
) -> None:
|
||||
self.amount = amount
|
||||
self.asset_groups_count = asset_groups_count
|
||||
self.address = address
|
||||
self.address_parameters = address_parameters
|
||||
self.datum_hash = datum_hash
|
||||
self.format = format
|
||||
self.inline_datum_size = inline_datum_size
|
||||
self.reference_script_size = reference_script_size
|
||||
|
||||
|
||||
class CardanoAssetGroup(protobuf.MessageType):
|
||||
@ -2381,6 +2407,34 @@ class CardanoToken(protobuf.MessageType):
|
||||
self.mint_amount = mint_amount
|
||||
|
||||
|
||||
class CardanoTxInlineDatumChunk(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 335
|
||||
FIELDS = {
|
||||
1: protobuf.Field("data", "bytes", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
data: "bytes",
|
||||
) -> None:
|
||||
self.data = data
|
||||
|
||||
|
||||
class CardanoTxReferenceScriptChunk(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 336
|
||||
FIELDS = {
|
||||
1: protobuf.Field("data", "bytes", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
data: "bytes",
|
||||
) -> None:
|
||||
self.data = data
|
||||
|
||||
|
||||
class CardanoPoolOwner(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 328
|
||||
FIELDS = {
|
||||
@ -2622,6 +2676,23 @@ class CardanoTxRequiredSigner(protobuf.MessageType):
|
||||
self.key_hash = key_hash
|
||||
|
||||
|
||||
class CardanoTxReferenceInput(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 337
|
||||
FIELDS = {
|
||||
1: protobuf.Field("prev_hash", "bytes", repeated=False, required=True),
|
||||
2: protobuf.Field("prev_index", "uint32", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
prev_hash: "bytes",
|
||||
prev_index: "int",
|
||||
) -> None:
|
||||
self.prev_hash = prev_hash
|
||||
self.prev_index = prev_index
|
||||
|
||||
|
||||
class CardanoTxItemAck(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 313
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user