1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-11 07:50:57 +00:00

Update protobuf

This commit is contained in:
gabrielkerekes 2020-07-17 09:13:08 +02:00 committed by Pavol Rusnak
parent 7c66a16bef
commit e92baf5b02
10 changed files with 192 additions and 7 deletions

View File

@ -25,6 +25,12 @@ enum CardanoAddressType {
REWARD_SCRIPT = 15;
}
enum CardanoCertificateType {
STAKE_REGISTRATION = 0;
STAKE_DEREGISTRATION = 1;
STAKE_DELEGATION = 2;
}
/**
* Structure representing cardano PointerAddress pointer,
* which points to a staking key registration certificate.
@ -103,13 +109,16 @@ message CardanoPublicKey {
* @next Failure
*/
message CardanoSignTx {
repeated CardanoTxInputType inputs = 1; // inputs to be used in transaction
repeated CardanoTxOutputType outputs = 2; // outputs to be used in transaction
// optional uint32 transactions_count = 3; // left as a comment so we know to skip the id 3 in the future
optional uint32 protocol_magic = 5; // network's protocol magic
optional uint64 fee = 6; // transaction fee - added in shelley
optional uint64 ttl = 7; // transaction ttl - added in shelley
optional uint32 network_id = 8; // network id - mainnet or testnet
repeated CardanoTxInputType inputs = 1; // inputs to be used in transaction
repeated CardanoTxOutputType outputs = 2; // outputs to be used in transaction
// optional uint32 transactions_count = 3; // left as a comment so we know to skip the id 3 in the future
optional uint32 protocol_magic = 5; // network's protocol magic
optional uint64 fee = 6; // transaction fee - added in shelley
optional uint64 ttl = 7; // transaction ttl - added in shelley
optional uint32 network_id = 8; // network id - mainnet or testnet
repeated CardanoTxCertificateType certificates = 9; // transaction certificates - added in shelley
repeated CardanoTxWithdrawalType withdrawals = 10; // transaction withdrawals - added in shelley
optional bytes metadata_hash = 11; // transaction metadata hash - added in shelley
/**
* Structure representing cardano transaction input
*/
@ -129,6 +138,21 @@ message CardanoSignTx {
optional uint64 amount = 3; // amount to spend
optional CardanoAddressParametersType address_parameters = 4; // parameters used to derive the address
}
/**
* Structure representing cardano transaction certificate
*/
message CardanoTxCertificateType {
optional CardanoCertificateType type = 1; // certificate type
repeated uint32 path = 2; // BIP-32 path to derive (staking) key
optional bytes pool = 3; // pool hash
}
/**
* Structure representing cardano transaction withdrawals
*/
message CardanoTxWithdrawalType {
repeated uint32 path = 1;
optional uint64 amount = 2;
}
}
/**

View File

@ -0,0 +1,8 @@
# Automatically generated by pb2py
# fmt: off
if False:
from typing_extensions import Literal
STAKE_REGISTRATION = 0 # type: Literal[0]
STAKE_DEREGISTRATION = 1 # type: Literal[1]
STAKE_DELEGATION = 2 # type: Literal[2]

View File

@ -2,8 +2,10 @@
# fmt: off
import protobuf as p
from .CardanoTxCertificateType import CardanoTxCertificateType
from .CardanoTxInputType import CardanoTxInputType
from .CardanoTxOutputType import CardanoTxOutputType
from .CardanoTxWithdrawalType import CardanoTxWithdrawalType
if __debug__:
try:
@ -24,6 +26,9 @@ class CardanoSignTx(p.MessageType):
fee: int = None,
ttl: int = None,
network_id: int = None,
certificates: List[CardanoTxCertificateType] = None,
withdrawals: List[CardanoTxWithdrawalType] = None,
metadata_hash: bytes = None,
) -> None:
self.inputs = inputs if inputs is not None else []
self.outputs = outputs if outputs is not None else []
@ -31,6 +36,9 @@ class CardanoSignTx(p.MessageType):
self.fee = fee
self.ttl = ttl
self.network_id = network_id
self.certificates = certificates if certificates is not None else []
self.withdrawals = withdrawals if withdrawals is not None else []
self.metadata_hash = metadata_hash
@classmethod
def get_fields(cls) -> Dict:
@ -41,4 +49,7 @@ class CardanoSignTx(p.MessageType):
6: ('fee', p.UVarintType, 0),
7: ('ttl', p.UVarintType, 0),
8: ('network_id', p.UVarintType, 0),
9: ('certificates', CardanoTxCertificateType, p.FLAG_REPEATED),
10: ('withdrawals', CardanoTxWithdrawalType, p.FLAG_REPEATED),
11: ('metadata_hash', p.BytesType, 0),
}

View File

@ -0,0 +1,32 @@
# Automatically generated by pb2py
# fmt: off
import protobuf as p
if __debug__:
try:
from typing import Dict, List # noqa: F401
from typing_extensions import Literal # noqa: F401
EnumTypeCardanoCertificateType = Literal[0, 1, 2]
except ImportError:
pass
class CardanoTxCertificateType(p.MessageType):
def __init__(
self,
type: EnumTypeCardanoCertificateType = None,
path: List[int] = None,
pool: bytes = None,
) -> None:
self.type = type
self.path = path if path is not None else []
self.pool = pool
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('type', p.EnumType("CardanoCertificateType", (0, 1, 2)), 0),
2: ('path', p.UVarintType, p.FLAG_REPEATED),
3: ('pool', p.BytesType, 0),
}

View File

@ -0,0 +1,28 @@
# Automatically generated by pb2py
# fmt: off
import protobuf as p
if __debug__:
try:
from typing import Dict, List # noqa: F401
from typing_extensions import Literal # noqa: F401
except ImportError:
pass
class CardanoTxWithdrawalType(p.MessageType):
def __init__(
self,
path: List[int] = None,
amount: int = None,
) -> None:
self.path = path if path is not None else []
self.amount = amount
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('path', p.UVarintType, p.FLAG_REPEATED),
2: ('amount', p.UVarintType, 0),
}

View File

@ -0,0 +1,8 @@
# Automatically generated by pb2py
# fmt: off
if False:
from typing_extensions import Literal
STAKE_REGISTRATION = 0 # type: Literal[0]
STAKE_DEREGISTRATION = 1 # type: Literal[1]
STAKE_DELEGATION = 2 # type: Literal[2]

View File

@ -2,8 +2,10 @@
# fmt: off
from .. import protobuf as p
from .CardanoTxCertificateType import CardanoTxCertificateType
from .CardanoTxInputType import CardanoTxInputType
from .CardanoTxOutputType import CardanoTxOutputType
from .CardanoTxWithdrawalType import CardanoTxWithdrawalType
if __debug__:
try:
@ -24,6 +26,9 @@ class CardanoSignTx(p.MessageType):
fee: int = None,
ttl: int = None,
network_id: int = None,
certificates: List[CardanoTxCertificateType] = None,
withdrawals: List[CardanoTxWithdrawalType] = None,
metadata_hash: bytes = None,
) -> None:
self.inputs = inputs if inputs is not None else []
self.outputs = outputs if outputs is not None else []
@ -31,6 +36,9 @@ class CardanoSignTx(p.MessageType):
self.fee = fee
self.ttl = ttl
self.network_id = network_id
self.certificates = certificates if certificates is not None else []
self.withdrawals = withdrawals if withdrawals is not None else []
self.metadata_hash = metadata_hash
@classmethod
def get_fields(cls) -> Dict:
@ -41,4 +49,7 @@ class CardanoSignTx(p.MessageType):
6: ('fee', p.UVarintType, 0),
7: ('ttl', p.UVarintType, 0),
8: ('network_id', p.UVarintType, 0),
9: ('certificates', CardanoTxCertificateType, p.FLAG_REPEATED),
10: ('withdrawals', CardanoTxWithdrawalType, p.FLAG_REPEATED),
11: ('metadata_hash', p.BytesType, 0),
}

View File

@ -0,0 +1,32 @@
# Automatically generated by pb2py
# fmt: off
from .. import protobuf as p
if __debug__:
try:
from typing import Dict, List # noqa: F401
from typing_extensions import Literal # noqa: F401
EnumTypeCardanoCertificateType = Literal[0, 1, 2]
except ImportError:
pass
class CardanoTxCertificateType(p.MessageType):
def __init__(
self,
type: EnumTypeCardanoCertificateType = None,
path: List[int] = None,
pool: bytes = None,
) -> None:
self.type = type
self.path = path if path is not None else []
self.pool = pool
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('type', p.EnumType("CardanoCertificateType", (0, 1, 2)), 0),
2: ('path', p.UVarintType, p.FLAG_REPEATED),
3: ('pool', p.BytesType, 0),
}

View File

@ -0,0 +1,28 @@
# Automatically generated by pb2py
# fmt: off
from .. import protobuf as p
if __debug__:
try:
from typing import Dict, List # noqa: F401
from typing_extensions import Literal # noqa: F401
except ImportError:
pass
class CardanoTxWithdrawalType(p.MessageType):
def __init__(
self,
path: List[int] = None,
amount: int = None,
) -> None:
self.path = path if path is not None else []
self.amount = amount
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('path', p.UVarintType, p.FLAG_REPEATED),
2: ('amount', p.UVarintType, 0),
}

View File

@ -28,8 +28,10 @@ from .CardanoGetPublicKey import CardanoGetPublicKey
from .CardanoPublicKey import CardanoPublicKey
from .CardanoSignTx import CardanoSignTx
from .CardanoSignedTx import CardanoSignedTx
from .CardanoTxCertificateType import CardanoTxCertificateType
from .CardanoTxInputType import CardanoTxInputType
from .CardanoTxOutputType import CardanoTxOutputType
from .CardanoTxWithdrawalType import CardanoTxWithdrawalType
from .ChangePin import ChangePin
from .ChangeWipeCode import ChangeWipeCode
from .CipherKeyValue import CipherKeyValue
@ -280,6 +282,7 @@ from . import BinanceTimeInForce
from . import ButtonRequestType
from . import Capability
from . import CardanoAddressType
from . import CardanoCertificateType
from . import DebugLinkShowTextStyle
from . import DebugSwipeDirection
from . import FailureType